Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit e21d358

Browse files
christopherthielenmergify[bot]
authored andcommitted
chore(lint): Fix or ignore eslint recommended linter rules
1 parent 60308d1 commit e21d358

File tree

7 files changed

+18
-20
lines changed

7 files changed

+18
-20
lines changed

src/directives/stateDirectives.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-interface */
2+
/* eslint-disable prefer-const */
13
/**
24
* # Angular 1 Directives
35
*
@@ -38,11 +40,10 @@ export interface ng1_directive {}
3840

3941
/** @hidden */
4042
function parseStateRef(ref: string) {
41-
let parsed;
4243
const paramsOnly = ref.match(/^\s*({[^}]*})\s*$/);
4344
if (paramsOnly) ref = '(' + paramsOnly[1] + ')';
4445

45-
parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/);
46+
const parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/);
4647
if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
4748
return { state: parsed[1] || null, paramExpr: parsed[3] || null };
4849
}
@@ -640,7 +641,7 @@ uiSrefActiveDirective = [
640641
setStatesFromDefinitionObject(uiSrefActive);
641642
}
642643

643-
function setStatesFromDefinitionObject(statesDefinition: object) {
644+
function setStatesFromDefinitionObject(statesDefinition: Obj) {
644645
if (isObject(statesDefinition)) {
645646
states = [];
646647
forEach(statesDefinition, function (stateOrName: StateOrName | Array<StateOrName>, activeClass: string) {

src/directives/viewDirective.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
unnestR,
2525
ViewService,
2626
} from '@uirouter/core';
27-
import { IAugmentedJQuery, IInterpolateService, IScope, ITimeoutService, ITranscludeFunction } from 'angular';
27+
import { IAugmentedJQuery, IInterpolateService, IScope, ITranscludeFunction } from 'angular';
2828
import { ng as angular } from '../angular';
2929
import { Ng1Controller, Ng1StateDeclaration } from '../interface';
3030
import { getLocals } from '../services';
@@ -170,6 +170,7 @@ export type UIViewAnimData = {
170170
* ```
171171
*/
172172
export let uiView: ng1_directive;
173+
// eslint-disable-next-line prefer-const
173174
uiView = [
174175
'$view',
175176
'$animate',
@@ -183,7 +184,7 @@ uiView = [
183184
$interpolate: IInterpolateService,
184185
$q: $QLike
185186
) {
186-
function getRenderer(attrs: Obj, scope: IScope) {
187+
function getRenderer() {
187188
return {
188189
enter: function (element: JQuery, target: any, cb: Function) {
189190
if (angular.version.minor > 2) {
@@ -221,15 +222,11 @@ uiView = [
221222
return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {
222223
const onloadExp = attrs['onload'] || '',
223224
autoScrollExp = attrs['autoscroll'],
224-
renderer = getRenderer(attrs, scope),
225+
renderer = getRenderer(),
225226
inherited = $element.inheritedData('$uiView') || rootData,
226227
name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';
227228

228-
let previousEl: JQuery,
229-
currentEl: JQuery,
230-
currentScope: IScope,
231-
viewConfig: Ng1ViewConfig,
232-
unregister: Function;
229+
let previousEl: JQuery, currentEl: JQuery, currentScope: IScope, viewConfig: Ng1ViewConfig;
233230

234231
const activeUIView: ActiveUIView = {
235232
$type: 'ng1',
@@ -263,7 +260,7 @@ uiView = [
263260

264261
updateView();
265262

266-
unregister = $view.registerUIView(activeUIView);
263+
const unregister = $view.registerUIView(activeUIView);
267264
scope.$on('$destroy', function () {
268265
trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);
269266
unregister();
@@ -363,16 +360,15 @@ uiView = [
363360
},
364361
];
365362

366-
$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];
363+
$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q'];
367364

368365
/** @hidden */
369366
function $ViewDirectiveFill(
370367
$compile: angular.ICompileService,
371368
$controller: angular.IControllerService,
372369
$transitions: TransitionService,
373370
$view: ViewService,
374-
$q: angular.IQService,
375-
$timeout: ITimeoutService
371+
$q: angular.IQService
376372
) {
377373
const getControllerAs = parse('viewDecl.controllerAs');
378374
const getResolveAs = parse('viewDecl.resolveAs');

src/legacy/stateEvents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export let $stateNotFound: IAngularEvent;
341341
.provider('$stateEvents', ($StateEventsProvider as any) as IServiceProviderFactory)
342342
.run([
343343
'$stateEvents',
344+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
344345
function ($stateEvents: any) {
345346
/* Invokes $get() */
346347
},

src/locationServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class Ng1LocationServices implements LocationConfig, LocationServices {
4949
x != null ? x.toString().replace(/(~~|~2F)/g, (m) => ({ '~~': '~', '~2F': '/' }[m])) : x;
5050
}
5151

52+
// eslint-disable-next-line @typescript-eslint/no-empty-function
5253
dispose() {}
5354

5455
constructor($locationProvider: ILocationProvider) {

src/services.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
/* eslint-disable @typescript-eslint/no-unused-vars */
13
/**
24
* # Angular 1 types
35
*
@@ -119,7 +121,7 @@ function runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRoute
119121
services.$q = <any>$q;
120122

121123
// https://github.com/angular-ui/ui-router/issues/3678
122-
if (!$injector.hasOwnProperty('strictDi')) {
124+
if (!Object.prototype.hasOwnProperty.call($injector, 'strictDi')) {
123125
try {
124126
$injector.invoke(function (checkStrictDi) {});
125127
} catch (error) {

src/statebuilders/onEnterExitRetain.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
services,
88
ResolveContext,
99
extend,
10-
BuilderFunction,
1110
} from '@uirouter/core';
1211
import { getLocals } from '../services';
1312
import { Ng1StateDeclaration } from '../interface';
@@ -22,7 +21,7 @@ import { Ng1StateDeclaration } from '../interface';
2221
* @internalapi
2322
*/
2423
export const getStateHookBuilder = (hookName: 'onEnter' | 'onExit' | 'onRetain') =>
25-
function stateHookBuilder(stateObject: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {
24+
function stateHookBuilder(stateObject: StateObject): TransitionStateHookFn {
2625
const hook = stateObject[hookName];
2726
const pathname = hookName === 'onExit' ? 'from' : 'to';
2827

src/statebuilders/views.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/** @publicapi @module ng1 */ /** */
2-
import { ng as angular } from '../angular';
32
import {
43
StateObject,
54
pick,
@@ -22,7 +21,6 @@ import {
2221
} from '@uirouter/core';
2322
import { Ng1ViewDeclaration } from '../interface';
2423
import { TemplateFactory } from '../templateFactory';
25-
import IInjectorService = angular.auto.IInjectorService;
2624

2725
/** @internalapi */
2826
export function getNg1ViewConfigFactory(): ViewConfigFactory {

0 commit comments

Comments
 (0)