Skip to content

Commit 15bd0fb

Browse files
committed
build(*): lint
1 parent 250939e commit 15bd0fb

File tree

4 files changed

+80
-28
lines changed

4 files changed

+80
-28
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ before_install:
1212
- sleep 3
1313

1414
script:
15+
- npm run lint
1516
- npm run test:lib
1617
- cat ./coverage/igniteui-angular-wrappers/lcov.info | coveralls
1718

angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"projectType": "library",
125125
"root": "projects/igniteui-angular-wrappers",
126126
"sourceRoot": "projects/igniteui-angular-wrappers/src",
127-
"prefix": "lib",
127+
"prefix": "ig",
128128
"architect": {
129129
"build": {
130130
"builder": "@angular-devkit/build-ng-packagr:build",
@@ -166,4 +166,4 @@
166166
"cli": {
167167
"analytics": false
168168
}
169-
}
169+
}

projects/igniteui-angular-wrappers/src/lib/igvalidator/igvalidator.component.ts

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,59 @@
1-
import { Component, IterableDiffers, ElementRef, KeyValueDiffers, ChangeDetectorRef, Renderer2 } from '@angular/core';
1+
import { Component, IterableDiffers, ElementRef, KeyValueDiffers, ChangeDetectorRef, Renderer2, OnInit } from '@angular/core';
22
import { IgControlBase } from '../igcontrolbase/igcontrolbase';
33

44
declare var jQuery: any;
55

66
@Component({
77
selector: 'ig-validator',
88
template: '<ng-content></ng-content>',
9-
inputs: ['widgetId', 'options', 'changeDetectionInterval', 'disabled', 'create', 'onchange', 'onblur', 'onsubmit', 'required', 'number', 'date', 'email', 'lengthRange', 'valueRange', 'creditCard', 'pattern', 'messageTarget', 'errorMessage', 'successMessage', 'threshold', 'equalTo', 'custom', 'fields', 'notificationOptions', 'requiredIndication', 'optionalIndication'],
10-
outputs: ['validating', 'validated', 'success', 'error', 'errorShowing', 'errorHiding', 'errorShown', 'errorHidden', 'successShowing', 'successHiding', 'successShown', 'successHidden', 'formValidating', 'formValidated', 'formError', 'formSuccess']
9+
inputs: [
10+
'widgetId',
11+
'options',
12+
'changeDetectionInterval',
13+
'disabled',
14+
'create',
15+
'onchange',
16+
'onblur',
17+
'onsubmit',
18+
'required',
19+
'number',
20+
'date',
21+
'email',
22+
'lengthRange',
23+
'valueRange',
24+
'creditCard',
25+
'pattern',
26+
'messageTarget',
27+
'errorMessage',
28+
'successMessage',
29+
'threshold',
30+
'equalTo',
31+
'custom',
32+
'fields',
33+
'notificationOptions',
34+
'requiredIndication',
35+
'optionalIndication'
36+
],
37+
outputs: [
38+
'validating',
39+
'validated',
40+
'success',
41+
'error',
42+
'errorShowing',
43+
'errorHiding',
44+
'errorShown',
45+
'errorHidden',
46+
'successShowing',
47+
'successHiding',
48+
'successShown',
49+
'successHidden',
50+
'formValidating',
51+
'formValidated',
52+
'formError',
53+
'formSuccess'
54+
]
1155
})
12-
export class IgValidatorComponent extends IgControlBase<IgValidator> {
56+
export class IgValidatorComponent extends IgControlBase<IgValidator> implements OnInit {
1357
constructor(el: ElementRef, renderer: Renderer2, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef) {
1458
super(el, renderer, differs, kvalDiffers, cdr);
1559
}
@@ -19,32 +63,35 @@ export class IgValidatorComponent extends IgControlBase<IgValidator> {
1963
this._el = jQuery(document).find('#' + this.widgetId);
2064
jQuery(this._el)[this._widgetName](this.options);
2165
this._events = new Map<string, string>();
22-
// events binding
23-
const that = this;
66+
2467
for (const propt in jQuery.ui[this._widgetName].prototype.events) {
68+
if (jQuery.ui[this._widgetName].prototype.events.hasOwnProperty(prompt)) {
2569
evtName = this._widgetName.toLowerCase() + propt.toLowerCase();
2670
this._events[evtName] = propt;
27-
jQuery(this._el).on(evtName, function(evt, ui) {
28-
that[that._events[evt.type]].emit({ event: evt, ui });
71+
jQuery(this._el).on(evtName, (evt, ui) => {
72+
this[this._events[evt.type]].emit({ event: evt, ui });
2973
});
74+
}
3075
}
3176
}
3277

3378
/**
3479
* Trigger validation and show errors for invalid fields.
3580
*
36-
* @param field Optional field object, its selector or zero-based index to check. Only has effect with fields collection and skips other fields.
81+
* @param field Optional field object, its selector or zero-based index to check.
82+
* Only has effect with fields collection and skips other fields.
3783
*/
3884
/* istanbul ignore next */
39-
public validate(field?: Object): boolean { return; }
85+
public validate(field?: object): boolean { return; }
4086

4187
/**
4288
* Trigger validation but do not display error messages.
4389
*
44-
* @param field Optional field object, its selector or zero-based index to check. Only has effect with fields collection and skips other fields.
90+
* @param field Optional field object, its selector or zero-based index to check.
91+
* Only has effect with fields collection and skips other fields.
4592
*/
4693
/* istanbul ignore next */
47-
public isValid(field?: Object): boolean { return; }
94+
public isValid(field?: object): boolean { return; }
4895

4996
/**
5097
* Hide any possible message(s) (either messageTarget or igNotifier).
@@ -53,58 +100,62 @@ export class IgValidatorComponent extends IgControlBase<IgValidator> {
53100
* @param field Optional field object, its selector or zero-based index to hide message for.
54101
*/
55102
/* istanbul ignore next */
56-
public hide(field?: Object): void { return; }
103+
public hide(field?: object): void { return; }
57104

58105
/**
59-
* Gets all current error messages for invalid field(s). Note that this method does not valdiate and states and messages are only updated on validation, so
60-
* this can be used on formValidated event or after validate/isValid method calls.
106+
* Gets all current error messages for invalid field(s).
107+
* Note that this method does not valdiate and states and messages are only updated on validation, so
108+
* this can be used on formValidated event or after validate/isValid method calls.
61109
*
62110
* @param field Optional field object, selector or zero-based index for a single field to get error message for.
63111
*/
64112
/* istanbul ignore next */
65-
public getErrorMessages(field?: Object): any[] { return; }
113+
public getErrorMessages(field?: object): any[] { return; }
66114

67115
/**
68116
* Check for currently displayed message(s). Takes an optional field.
69-
* Note: When the validator has a fields colleciton, not passing a field will return a cumulative true even if just one field has a visible message.
117+
* Note: When the validator has a fields colleciton, not passing a
118+
* field will return a cumulative true even if just one field has a visible message.
70119
*
71120
* @param field Optional field object, selector or zero-based index for a single field to get error message for.
72121
*/
73122
/* istanbul ignore next */
74-
public isMessageDisplayed(field?: Object): boolean { return; }
123+
public isMessageDisplayed(field?: object): boolean { return; }
75124

76125
/**
77126
* Gets the notifier for the igValidator or for a single filed.
78127
*
79128
* @param field Optional field object, its selector or zero-based index to get notifier for.
80129
*/
81130
/* istanbul ignore next */
82-
public notifier(field?: Object): Object { return; }
131+
public notifier(field?: object): object { return; }
83132

84133
/**
85-
* Adds an new input to the fields collection and initializes it with the validator. Note: Additional fields are only accepted if the validator has been created with the collection.
134+
* Adds an new input to the fields collection and initializes it with the validator.
135+
* Note: Additional fields are only accepted if the validator has been created with the collection.
86136
*
87137
* @param field An object with the field selector and options.
88138
*/
89139
/* istanbul ignore next */
90-
public addField(field: Object): void { return; }
140+
public addField(field: object): void { return; }
91141

92142
/**
93143
* Removes an input from the fields collection.
94144
*
95145
* @param field The field object to remove, its zero-based index or selector.
96146
*/
97147
/* istanbul ignore next */
98-
public removeField(field: Object): void { return; }
148+
public removeField(field: object): void { return; }
99149

100150
/**
101-
* Updates a field in the validator collection. Used to reinitialize field in case a control has been created after the validator or to pass in new options.
151+
* Updates a field in the validator collection.
152+
* Used to reinitialize field in case a control has been created after the validator or to pass in new options.
102153
*
103154
* @param field The field object to update, its zero-based index or selector.
104155
* @param fieldOptions New options to apply to the field.
105156
*/
106157
/* istanbul ignore next */
107-
public updateField(field: Object, fieldOptions?: Object): void { return; }
158+
public updateField(field: object, fieldOptions?: object): void { return; }
108159

109160
/**
110161
* Destroys the validator widget.

projects/igniteui-angular-wrappers/tslint.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"directive-selector": [
55
true,
66
"attribute",
7-
"lib",
7+
"ig",
88
"camelCase"
99
],
1010
"component-selector": [
1111
true,
1212
"element",
13-
"lib",
13+
["ig", "test"],
1414
"kebab-case"
1515
]
1616
}

0 commit comments

Comments
 (0)