Skip to content

Commit e0e71dc

Browse files
committed
Continue lint fixes
1 parent 272bb08 commit e0e71dc

File tree

12 files changed

+61
-50
lines changed

12 files changed

+61
-50
lines changed

@types/shared/common.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function equals(o1: any, o2: any): any;
1+
export function equals(o1: any, o2: any): boolean;
22
/**
33
* prototypal inheritance helper.
44
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ export default defineConfig([
9797
"max-classes-per-file": ["error", 3],
9898
"consistent-return": "error",
9999
"dot-notation": "error",
100-
"id-length": ["warn", { min: 2, exceptions: ["i", "j", "_", "__"] }],
100+
"id-length": [
101+
"warn",
102+
{ min: 2, exceptions: ["i", "j", "x", "y", "k", "v", "_", "__"] },
103+
],
101104
"sort-imports": [
102105
"error",
103106
{

src/core/compile/attributes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
directiveNormalize,
55
hasAnimate,
66
hasOwn,
7-
isProxy,
87
isString,
98
isUndefined,
109
minErr,

src/router/hooks/redirect-to.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ export const registerRedirectToHook = (transitionService, stateService) => {
1818
function handleResult(result) {
1919
if (!result) return;
2020

21-
if (result instanceof TargetState) return result;
21+
if (result instanceof TargetState) {
22+
return result;
23+
}
2224

23-
if (isString(result))
25+
if (isString(result)) {
2426
return $state.target(result, trans.params(), trans.options());
27+
}
2528

26-
if (result.state || result.params)
29+
if (result.state || result.params) {
2730
return $state.target(
2831
result.state || trans.to(),
2932
result.params || trans.params(),
3033
trans.options(),
3134
);
35+
}
36+
37+
return undefined;
3238
}
3339

3440
if (isFunction(redirect)) {

src/router/state/state-builder.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function getParamsBuilder(paramFactory) {
103103

104104
return urlParams
105105
.concat(nonUrlParams)
106-
.map((p) => [p.id, p])
106+
.map((x) => [x.id, x])
107107
.reduce(applyPairs, {});
108108
};
109109
}
@@ -200,30 +200,30 @@ export function resolvablesBuilder(state) {
200200
const literal2Resolvable = pattern([
201201
[
202202
(x) => x.resolveFn,
203-
(p) => new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy),
203+
(y) => new Resolvable(getToken(y), y.resolveFn, y.deps, y.policy),
204204
],
205205
[
206206
(x) => x.useFactory,
207-
(p) =>
207+
(y) =>
208208
new Resolvable(
209-
getToken(p),
210-
p.useFactory,
211-
p.deps || p.dependencies,
212-
p.policy,
209+
getToken(y),
210+
y.useFactory,
211+
y.deps || y.dependencies,
212+
y.policy,
213213
),
214214
],
215215
[
216216
(x) => x.useClass,
217-
(p) => new Resolvable(getToken(p), () => new p.useClass(), [], p.policy),
217+
(y) => new Resolvable(getToken(y), () => new y.useClass(), [], y.policy),
218218
],
219219
[
220220
(x) => x.useValue,
221-
(p) =>
222-
new Resolvable(getToken(p), () => p.useValue, [], p.policy, p.useValue),
221+
(y) =>
222+
new Resolvable(getToken(y), () => y.useValue, [], y.policy, y.useValue),
223223
],
224224
[
225225
(x) => x.useExisting,
226-
(p) => new Resolvable(getToken(p), (x) => x, [p.useExisting], p.policy),
226+
(y) => new Resolvable(getToken(y), (x) => x, [y.useExisting], y.policy),
227227
],
228228
]);
229229

src/services/cookie/cookie.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ export class CookieService {
124124
...this.defaults,
125125
...options,
126126
})}`;
127-
} catch (e) {
128-
this.$exceptionHandler(e);
127+
} catch (err) {
128+
this.$exceptionHandler(err);
129129
}
130130
}
131131

@@ -271,12 +271,12 @@ function buildOptions(opts = {}) {
271271
if (isDefined(opts.samesite)) {
272272
if (!isString(opts.samesite))
273273
throw new TypeError(`${BADARG}:samesite ${opts.samesite}`);
274-
const s = opts.samesite.toLowerCase();
274+
const samesite = opts.samesite.toLowerCase();
275275

276-
if (!["lax", "strict", "none"].includes(s)) {
276+
if (!["lax", "strict", "none"].includes(samesite)) {
277277
throw new TypeError(`${BADARG}:samesite ${opts.samesite}`);
278278
}
279-
parts.push(`samesite=${s}`);
279+
parts.push(`samesite=${samesite}`);
280280
}
281281

282282
// Join all parts with semicolons

src/services/http/http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,8 @@ export function http(
10701070
if (responseType) {
10711071
try {
10721072
xhr.responseType = responseType;
1073-
} catch (e) {
1074-
if (responseType !== "json") throw e;
1073+
} catch (err) {
1074+
if (responseType !== "json") throw err;
10751075
}
10761076
}
10771077

src/services/pubsub/pubsub.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ export class PubSub {
229229
// Defer removal until after publishing is complete, but replace the
230230
// function with a no-op so it isn't called.
231231
this.pendingKeys.push(key);
232-
this.subscriptions[key + 1] = () => {};
232+
this.subscriptions[key + 1] = () => {
233+
/* empty */
234+
};
233235
} else {
234236
if (keys) {
235237
this.topics[topic] = keys.filter((k) => k !== key);

src/services/rest/rfc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ export function expandExpression(expression, vars) {
238238
// not exploded: join k,v pairs by ','
239239
const pairs = keys
240240
.map(
241-
(k) =>
242-
`${pctEncode(k, conf.allowReserved)},${pctEncode(value[k], conf.allowReserved)}`,
241+
(key) =>
242+
`${pctEncode(key, conf.allowReserved)},${pctEncode(value[key], conf.allowReserved)}`,
243243
)
244244
.join(",");
245245

src/services/sce/sce.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class SceDelegateProvider {
194194
*/
195195
this.trustedResourceUrlList = function (value) {
196196
if (arguments.length) {
197-
trustedResourceUrlList = value.map((v) => adjustMatcher(v));
197+
trustedResourceUrlList = value.map(adjustMatcher);
198198
}
199199

200200
return trustedResourceUrlList;
@@ -224,7 +224,7 @@ export class SceDelegateProvider {
224224
*/
225225
this.bannedResourceUrlList = function (value) {
226226
if (arguments.length) {
227-
bannedResourceUrlList = value.map((v) => adjustMatcher(v));
227+
bannedResourceUrlList = value.map(adjustMatcher);
228228
}
229229

230230
return bannedResourceUrlList;
@@ -274,14 +274,12 @@ export class SceDelegateProvider {
274274
function isResourceUrlAllowedByPolicy(url) {
275275
const parsedUrl = urlResolve(url.toString());
276276

277-
let i;
278-
279-
let n;
280-
281-
let allowed = false;
277+
let i,
278+
j,
279+
allowed = false;
282280

283281
// Ensure that at least one item from the trusted resource URL list allows this url.
284-
for (i = 0, n = trustedResourceUrlList.length; i < n; i++) {
282+
for (i = 0, j = trustedResourceUrlList.length; i < j; i++) {
285283
if (matchUrl(trustedResourceUrlList[i], parsedUrl)) {
286284
allowed = true;
287285
break;
@@ -290,7 +288,7 @@ export class SceDelegateProvider {
290288

291289
if (allowed) {
292290
// Ensure that no item from the banned resource URL list has blocked this url.
293-
for (i = 0, n = bannedResourceUrlList.length; i < n; i++) {
291+
for (i = 0, j = bannedResourceUrlList.length; i < j; i++) {
294292
if (matchUrl(bannedResourceUrlList[i], parsedUrl)) {
295293
allowed = false;
296294
break;
@@ -499,8 +497,9 @@ export class SceDelegateProvider {
499497
// htmlSanitizer throws its own error when no sanitizer is available.
500498
return htmlSanitizer();
501499
}
500+
502501
// Default error when the $sce service has no way to make the input safe.
503-
$exceptionHandler(
502+
return $exceptionHandler(
504503
$sceMinErr(
505504
"unsafe",
506505
"Attempting to use an unsafe value in a safe context.",
@@ -562,9 +561,7 @@ export function SceProvider() {
562561
sce.trustAs = sce.getTrusted = function (type, value) {
563562
return value;
564563
};
565-
sce.valueOf = function ($) {
566-
return $;
567-
};
564+
sce.valueOf = (v) => v;
568565
}
569566

570567
/**

0 commit comments

Comments
 (0)