Skip to content

Commit 02736bc

Browse files
committed
Lint fixes
1 parent e36dbc7 commit 02736bc

File tree

19 files changed

+188
-163
lines changed

19 files changed

+188
-163
lines changed

@types/animations/animation.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class AnimationProvider {
88
$injector: ng.InjectorService,
99
$$rAFScheduler: import("./raf-scheduler.js").RafScheduler,
1010
$$animateCache: any,
11-
) => (element: any, event: any, options: any) => AnimateRunner)
11+
) => (elementParam: any, event: any, options: any) => AnimateRunner)
1212
)[];
1313
}
1414
import { AnimateRunner } from "./runner/animate-runner.js";

src/angular.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ngMinErr = minErr("ng");
2626
const $injectorMinErr = minErr("$injector");
2727

2828
/** @type {Object.<string, NgModule>} */
29-
const modules = {};
29+
const moduleRegistry = {};
3030

3131
export class Angular {
3232
constructor() {
@@ -119,11 +119,11 @@ export class Angular {
119119
module(name, requires, configFn) {
120120
assertNotHasOwnProperty(name, "module");
121121

122-
if (requires && hasOwn(modules, name)) {
123-
modules[name] = null; // force ensure to recreate the module
122+
if (requires && hasOwn(moduleRegistry, name)) {
123+
moduleRegistry[name] = null; // force ensure to recreate the module
124124
}
125125

126-
return ensure(modules, name, () => {
126+
return ensure(moduleRegistry, name, () => {
127127
if (!requires) {
128128
throw $injectorMinErr(
129129
"nomod",
@@ -331,6 +331,8 @@ export class Angular {
331331
if (scope) {
332332
return scope.$proxy;
333333
}
334+
335+
return undefined;
334336
}
335337
}
336338

src/animations/animate-css-driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export function AnimateCssDriverProvider($$animationProvider) {
214214

215215
// no point in doing anything when there are no elements to animate
216216
if (!fromAnimation && !toAnimation && anchorAnimations.length === 0)
217-
return;
217+
return undefined;
218218

219219
return {
220220
start() {

src/animations/animate-js-driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function AnimateJsDriverProvider($$animationProvider) {
1616

1717
const toAnimation = prepareAnimation(animationDetails.to);
1818

19-
if (!fromAnimation && !toAnimation) return;
19+
if (!fromAnimation && !toAnimation) return undefined;
2020

2121
return {
2222
start() {

src/animations/animate-js.js

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function AnimateJsProvider($animateProvider) {
9494
}
9595

9696
// no matching animations
97-
if (!before && !after) return;
97+
if (!before && !after) return undefined;
9898

9999
function applyOptions() {
100100
options.domOperation();
@@ -231,32 +231,38 @@ export function AnimateJsProvider($animateProvider) {
231231
},
232232
};
233233

234-
function executeAnimationFn(fn, element, event, options, onDone) {
234+
function executeAnimationFn(
235+
fn,
236+
elemParam,
237+
eventParam,
238+
optionsParam,
239+
onDone,
240+
) {
235241
let args;
236242

237-
switch (event) {
243+
switch (eventParam) {
238244
case "animate":
239-
args = [element, options.from, options.to, onDone];
245+
args = [elemParam, optionsParam.from, optionsParam.to, onDone];
240246
break;
241247

242248
case "setClass":
243-
args = [element, classesToAdd, classesToRemove, onDone];
249+
args = [elemParam, classesToAdd, classesToRemove, onDone];
244250
break;
245251

246252
case "addClass":
247-
args = [element, classesToAdd, onDone];
253+
args = [elemParam, classesToAdd, onDone];
248254
break;
249255

250256
case "removeClass":
251-
args = [element, classesToRemove, onDone];
257+
args = [elemParam, classesToRemove, onDone];
252258
break;
253259

254260
default:
255-
args = [element, onDone];
261+
args = [elemParam, onDone];
256262
break;
257263
}
258264

259-
args.push(options);
265+
args.push(optionsParam);
260266

261267
let value = fn.apply(fn, args);
262268

@@ -279,41 +285,22 @@ export function AnimateJsProvider($animateProvider) {
279285
}
280286

281287
function groupEventedAnimations(
282-
element,
283-
event,
284-
options,
285-
animations,
288+
elemParam,
289+
eventParam,
290+
optionsParam,
291+
animationsParam,
286292
fnName,
287293
) {
288294
const operations = [];
289295

290-
animations.forEach((ani) => {
296+
animationsParam.forEach((ani) => {
291297
const animation = ani[fnName];
292298

293299
if (!animation) return;
294300

295301
// note that all of these animations will run in parallel
296302
operations.push(() => {
297-
let runner;
298-
299-
let endProgressCb;
300-
301-
let resolved = false;
302-
303-
const onAnimationComplete = function (rejected) {
304-
if (!resolved) {
305-
resolved = true;
306-
(
307-
endProgressCb ||
308-
(() => {
309-
/* empty */
310-
})
311-
)(rejected);
312-
runner.complete(!rejected);
313-
}
314-
};
315-
316-
runner = new AnimateRunner({
303+
const newRunner = new AnimateRunner({
317304
end() {
318305
onAnimationComplete();
319306
},
@@ -322,37 +309,52 @@ export function AnimateJsProvider($animateProvider) {
322309
},
323310
});
324311

325-
endProgressCb = executeAnimationFn(
312+
const endProgressCb = executeAnimationFn(
326313
animation,
327-
element,
328-
event,
329-
options,
314+
elemParam,
315+
eventParam,
316+
optionsParam,
330317
(result) => {
331318
const cancelled = result === false;
332319

333320
onAnimationComplete(cancelled);
334321
},
335322
);
336323

337-
return runner;
324+
let resolved = false;
325+
326+
const onAnimationComplete = function (rejected) {
327+
if (!resolved) {
328+
resolved = true;
329+
(
330+
endProgressCb ||
331+
(() => {
332+
/* empty */
333+
})
334+
)(rejected);
335+
newRunner.complete(!rejected);
336+
}
337+
};
338+
339+
return newRunner;
338340
});
339341
});
340342

341343
return operations;
342344
}
343345

344346
function packageAnimations(
345-
element,
346-
event,
347-
options,
348-
animations,
347+
elementParam,
348+
eventParam,
349+
optionsParam,
350+
animationsParam,
349351
fnName,
350352
) {
351353
let operations = groupEventedAnimations(
352-
element,
353-
event,
354-
options,
355-
animations,
354+
elementParam,
355+
eventParam,
356+
optionsParam,
357+
animationsParam,
356358
fnName,
357359
);
358360

@@ -363,32 +365,32 @@ export function AnimateJsProvider($animateProvider) {
363365

364366
if (fnName === "beforeSetClass") {
365367
a = groupEventedAnimations(
366-
element,
368+
elementParam,
367369
"removeClass",
368-
options,
369-
animations,
370+
optionsParam,
371+
animationsParam,
370372
"beforeRemoveClass",
371373
);
372374
b = groupEventedAnimations(
373-
element,
375+
elementParam,
374376
"addClass",
375-
options,
376-
animations,
377+
optionsParam,
378+
animationsParam,
377379
"beforeAddClass",
378380
);
379381
} else if (fnName === "setClass") {
380382
a = groupEventedAnimations(
381-
element,
383+
elementParam,
382384
"removeClass",
383-
options,
384-
animations,
385+
optionsParam,
386+
animationsParam,
385387
"removeClass",
386388
);
387389
b = groupEventedAnimations(
388-
element,
390+
elementParam,
389391
"addClass",
390-
options,
391-
animations,
392+
optionsParam,
393+
animationsParam,
392394
"addClass",
393395
);
394396
}

src/animations/animate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ export function AnimateProvider($provide) {
309309
} else {
310310
element.setAttribute("animate", `${enabled}`);
311311
}
312+
313+
return true;
312314
},
313315

314316
/**

0 commit comments

Comments
 (0)