Skip to content

Commit d6da6cb

Browse files
committed
Lint fixes
1 parent 81116dc commit d6da6cb

File tree

7 files changed

+47
-40
lines changed

7 files changed

+47
-40
lines changed

src/core/parse/ast/ast.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ export class AST {
560560
} else {
561561
return /** @type {import("../lexer/lexer.js").Token} */ (token);
562562
}
563+
564+
return undefined;
563565
}
564566

565567
/**
@@ -597,10 +599,10 @@ export class AST {
597599
if (this.tokens.length > i) {
598600
const token = this.tokens[i];
599601

600-
const t = token.text;
602+
const { text } = token;
601603

602604
if (
603-
expected.includes(t) ||
605+
expected.includes(text) ||
604606
(!expected[0] && !expected[1] && !expected[2] && !expected[3])
605607
) {
606608
return token;

src/core/scope/scope.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function createScope(target = {}, context) {
9797
return proxy;
9898
}
9999

100-
const g = globalThis;
100+
const global = globalThis;
101101

102102
const proto = Object.prototype;
103103

@@ -115,10 +115,10 @@ export function isNonScope(target) {
115115
if (
116116
target[NONSCOPE] === true ||
117117
(target.constructor && target.constructor[NONSCOPE]) === true ||
118-
target === g.window ||
119-
target === g.document ||
120-
target === g.self ||
121-
target === g.frames ||
118+
target === global.window ||
119+
target === global.document ||
120+
target === global.self ||
121+
target === global.frames ||
122122
target instanceof Window ||
123123
target instanceof Document ||
124124
target instanceof Element ||
@@ -395,9 +395,9 @@ export class Scope {
395395
const keys = this.objectListeners.get(proxy);
396396

397397
for (let i = 0, l = keys.length; i < l; i++) {
398-
const listeners = this.watchers.get(keys[i]);
398+
const currentListeners = this.watchers.get(keys[i]);
399399

400-
if (listeners) this.#scheduleListener(listeners);
400+
if (currentListeners) this.#scheduleListener(currentListeners);
401401
}
402402
decodeURI;
403403
}
@@ -618,9 +618,9 @@ export class Scope {
618618
for (let i = 0, l = keys.length; i < l; i++) {
619619
const key = keys[i];
620620

621-
const listeners = this.watchers.get(key);
621+
const currentListeners = this.watchers.get(key);
622622

623-
if (listeners) this.#scheduleListener(listeners);
623+
if (currentListeners) this.#scheduleListener(currentListeners);
624624
}
625625
}
626626

@@ -1141,8 +1141,8 @@ export class Scope {
11411141
$apply(expr) {
11421142
try {
11431143
return $parse(expr)(this.$proxy);
1144-
} catch (e) {
1145-
$exceptionHandler(e);
1144+
} catch (err) {
1145+
$exceptionHandler(err);
11461146
}
11471147
}
11481148

@@ -1370,8 +1370,8 @@ export class Scope {
13701370

13711371
fn();
13721372
}
1373-
} catch (e) {
1374-
$exceptionHandler(e);
1373+
} catch (err) {
1374+
$exceptionHandler(err);
13751375
}
13761376
}
13771377

@@ -1412,14 +1412,14 @@ export class Scope {
14121412
}
14131413

14141414
$searchByName(name) {
1415-
const getByName = (scope, name) => {
1416-
if (scope.$scopename === name) {
1415+
const getByName = (scope, nameParam) => {
1416+
if (scope.$scopename === nameParam) {
14171417
return scope;
14181418
} else {
14191419
let res = undefined;
14201420

14211421
for (const child of scope.$children) {
1422-
const found = getByName(child, name);
1422+
const found = getByName(child, nameParam);
14231423

14241424
if (found) {
14251425
res = found;

src/directive/aria/aria.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const isNodeOneOf = function (elem, nodeTypeArray) {
2020
if (nodeTypeArray.indexOf(elem.nodeName) !== -1) {
2121
return true;
2222
}
23+
24+
return false;
2325
};
2426

2527
/**
@@ -129,7 +131,7 @@ export function ngClickAriaDirective($aria, $parse) {
129131
return {
130132
restrict: "A",
131133
compile(_elem, attr) {
132-
if (hasOwn(attr, ARIA_DISABLE_ATTR)) return;
134+
if (hasOwn(attr, ARIA_DISABLE_ATTR)) return undefined;
133135

134136
const fn = $parse(attr.ngClick);
135137

@@ -268,7 +270,7 @@ export function ngModelAriaDirective($aria) {
268270
require: "ngModel",
269271
priority: 200, // Make sure watches are fired after any other directives that affect the ngModel value
270272
compile(_, attr) {
271-
if (hasOwn(attr, ARIA_DISABLE_ATTR)) return;
273+
if (hasOwn(attr, ARIA_DISABLE_ATTR)) return undefined;
272274

273275
const shape = getShape(attr);
274276

src/directive/input/input.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function textInputType(scope, element, attr, ctrl) {
130130
stringBasedInputType(ctrl);
131131
}
132132

133-
function baseInputType(scope, element, attr, ctrl) {
133+
function baseInputType(_, element, attr, ctrl) {
134134
const type = element.type.toLowerCase();
135135

136136
let composing = false;
@@ -193,6 +193,7 @@ function baseInputType(scope, element, attr, ctrl) {
193193
) {
194194
element.addEventListener(PARTIAL_VALIDATION_EVENTS, function (ev) {
195195
if (!timeout) {
196+
// eslint-disable-next-line no-invalid-this
196197
const validity = this[VALIDITY_STATE_PROPERTY];
197198

198199
const origBadInput = validity.badInput;
@@ -521,7 +522,7 @@ export function createDateInputType(type, regexp, parseDate) {
521522

522523
function isValidDate(value) {
523524
// Invalid Date: getTime() returns NaN
524-
return value && !(value.getTime && value.getTime() !== value.getTime());
525+
return value && !(value.getTime && Number.isNaN(value.getTime()));
525526
}
526527

527528
function parseObservedDateValue(val) {
@@ -963,10 +964,8 @@ function radioInputType(scope, element, attr, ctrl) {
963964
}
964965

965966
const listener = function (ev) {
966-
let value;
967-
968967
if (element.checked) {
969-
value = attr.value;
968+
let { value } = attr;
970969

971970
if (doTrim) {
972971
value = trim(value);
@@ -1108,7 +1107,7 @@ export function hiddenInputBrowserCacheDirective() {
11081107
}
11091108

11101109
return {
1111-
pre(scope, element) {
1110+
pre(_scope, element) {
11121111
const node = element;
11131112

11141113
// Support: Edge
@@ -1122,6 +1121,8 @@ export function hiddenInputBrowserCacheDirective() {
11221121
if (Object.defineProperty) {
11231122
Object.defineProperty(node, "value", valueProperty);
11241123
}
1124+
1125+
return undefined;
11251126
},
11261127
};
11271128
},

src/directive/messages/messages.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ class NgMessageCtrl {
171171
parentLookup.push(prevNode);
172172
}
173173
}
174+
175+
return undefined;
174176
}
175177

176178
insertMessageNode(parent, comment, key) {
@@ -264,12 +266,12 @@ export const ngMessageDefaultDirective = ngMessageDirectiveFactory(true);
264266
* @returns {(any) => ng.Directive}
265267
*/
266268
function ngMessageDirectiveFactory(isDefault) {
267-
ngMessageDirective.$inject = ["$animate"];
269+
ngMessageDirectiveFn.$inject = ["$animate"];
268270
/**
269271
* @param {ng.AnimateService} $animate
270272
* @returns {ng.Directive}
271273
*/
272-
function ngMessageDirective($animate) {
274+
function ngMessageDirectiveFn($animate) {
273275
return {
274276
restrict: "AE",
275277
transclude: "element",
@@ -369,7 +371,7 @@ function ngMessageDirectiveFactory(isDefault) {
369371
};
370372
}
371373

372-
return ngMessageDirective;
374+
return ngMessageDirectiveFn;
373375
}
374376

375377
function contains(collection, key) {

src/directive/options/options.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,22 @@ export function ngOptionsDirective($compile, $parse) {
169169

170170
const value = optionValues[key];
171171

172-
const locals = getLocals(value, key);
172+
const updatedLocals = getLocals(value, key);
173173

174-
const selectValue = getTrackByValueFn(value, locals);
174+
const selectValue = getTrackByValueFn(value, updatedLocals);
175175

176176
watchedArray.push(selectValue);
177177

178178
// Only need to watch the displayFn if there is a specific label expression
179179
if (match[2] || match[1]) {
180-
const label = displayFn(scope, locals);
180+
const label = displayFn(scope, updatedLocals);
181181

182182
watchedArray.push(label);
183183
}
184184

185185
// Only need to watch the disableWhenFn if there is a specific disable expression
186186
if (match[4]) {
187-
const disableWhen = disableWhenFn(scope, locals);
187+
const disableWhen = disableWhenFn(scope, updatedLocals);
188188

189189
watchedArray.push(disableWhen);
190190
}
@@ -214,17 +214,17 @@ export function ngOptionsDirective($compile, $parse) {
214214

215215
const value = optionValues[key];
216216

217-
const locals = getLocals(value, key);
217+
const updatedLocals = getLocals(value, key);
218218

219-
const viewValue = viewValueFn(scope, locals);
219+
const viewValue = viewValueFn(scope, updatedLocals);
220220

221-
const selectValue = getTrackByValueFn(viewValue, locals);
221+
const selectValue = getTrackByValueFn(viewValue, updatedLocals);
222222

223-
const label = displayFn(scope, locals);
223+
const label = displayFn(scope, updatedLocals);
224224

225-
const group = groupByFn(scope, locals);
225+
const group = groupByFn(scope, updatedLocals);
226226

227-
const disabled = disableWhenFn(scope, locals);
227+
const disabled = disableWhenFn(scope, updatedLocals);
228228

229229
const optionItem = new Option(
230230
selectValue,

src/router/state/state-registry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class StateRegistryProvider {
101101
$transition$: trans,
102102
});
103103

104-
return that.$injector.invoke(hook, this, locals);
104+
return that.$injector.invoke(hook, that, locals);
105105
}
106106

107107
return hook ? decoratedNg1Hook : undefined;

0 commit comments

Comments
 (0)