Skip to content

Commit be73d52

Browse files
committed
chore: eslint migration
1 parent 7f06cae commit be73d52

File tree

7 files changed

+86
-27
lines changed

7 files changed

+86
-27
lines changed

.eslintrc.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,13 @@
1212
"files": ["*.ts", "*.tsx"],
1313
"extends": ["plugin:@nx/typescript"],
1414
"rules": {
15-
"@typescript-eslint/no-inferrable-types": "off",
16-
"@typescript-eslint/no-extra-semi": "error",
17-
"no-extra-semi": "off"
15+
"@typescript-eslint/no-inferrable-types": "off"
1816
}
1917
},
2018
{
2119
"files": ["*.js", "*.jsx"],
2220
"extends": ["plugin:@nx/javascript"],
23-
"rules": {
24-
"@typescript-eslint/no-extra-semi": "error",
25-
"no-extra-semi": "off"
26-
}
21+
"rules": {}
2722
}
2823
]
2924
}

packages/angular/src/lib/animations/animation-player.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
/* eslint-disable @typescript-eslint/ban-types */
2+
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
33
import { AnimationPlayer } from '@angular/animations';
44
import { View, EventData, KeyframeAnimation } from '@nativescript/core';
55

@@ -16,7 +16,13 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
1616
private _started = false;
1717
private animation: KeyframeAnimation;
1818

19-
constructor(private target: NgView, keyframes: Keyframe[], private duration: number, private delay: number, easing: string) {
19+
constructor(
20+
private target: NgView,
21+
keyframes: Keyframe[],
22+
private duration: number,
23+
private delay: number,
24+
easing: string,
25+
) {
2026
this.initKeyframeAnimation(keyframes, duration, delay, easing);
2127
}
2228

packages/angular/src/lib/nativescript-ng-zone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/ban-types */
1+
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
22
/* eslint-disable @typescript-eslint/no-empty-function */
33
/* eslint-disable @typescript-eslint/no-explicit-any */
44
/* eslint-disable @typescript-eslint/triple-slash-reference */

packages/angular/src/lib/router/router.module.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
1-
import { APP_BASE_HREF, CommonModule, HashLocationStrategy, Location, LocationStrategy, LOCATION_INITIALIZED, PathLocationStrategy, PlatformLocation } from '@angular/common';
2-
import { ApplicationRef, APP_BOOTSTRAP_LISTENER, ComponentRef, Inject, Injectable, Injector, ModuleWithProviders, NgModule, NgProbeToken, NO_ERRORS_SCHEMA, Optional, inject, provideAppInitializer } from '@angular/core';
3-
import { ExtraOptions, NoPreloading, PreloadingStrategy, provideRoutes, Router, RouterModule, RouterPreloader, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, Routes, ɵROUTER_PROVIDERS } from '@angular/router';
1+
import {
2+
APP_BASE_HREF,
3+
CommonModule,
4+
HashLocationStrategy,
5+
Location,
6+
LocationStrategy,
7+
LOCATION_INITIALIZED,
8+
PathLocationStrategy,
9+
PlatformLocation,
10+
} from '@angular/common';
11+
import {
12+
ApplicationRef,
13+
APP_BOOTSTRAP_LISTENER,
14+
ComponentRef,
15+
Inject,
16+
Injectable,
17+
Injector,
18+
ModuleWithProviders,
19+
NgModule,
20+
NgProbeToken,
21+
NO_ERRORS_SCHEMA,
22+
Optional,
23+
inject,
24+
provideAppInitializer,
25+
} from '@angular/core';
26+
import {
27+
ExtraOptions,
28+
NoPreloading,
29+
PreloadingStrategy,
30+
provideRoutes,
31+
Router,
32+
RouterModule,
33+
RouterPreloader,
34+
ROUTER_CONFIGURATION,
35+
ROUTER_INITIALIZER,
36+
Routes,
37+
ɵROUTER_PROVIDERS,
38+
} from '@angular/router';
439
import { of, Subject } from 'rxjs';
540
import { NativeScriptCommonModule } from '../nativescript-common.module';
641
import { START_PATH } from '../tokens';
@@ -55,7 +90,7 @@ export class RouterInitializer {
5590
appInitializer(): Promise<any> {
5691
const p: Promise<any> = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
5792
return p.then(() => {
58-
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-non-null-assertion
93+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/no-non-null-assertion
5994
let resolve: Function = null!;
6095
const res = new Promise((r) => (resolve = r));
6196
const router: any = this.injector.get(Router);
@@ -114,8 +149,14 @@ export function routerNgProbeToken() {
114149
return new NgProbeToken('Router', Router);
115150
}
116151

117-
export function provideLocationStrategy(platformLocationStrategy: PlatformLocation, baseHref: string, options: ExtraOptions = {}) {
118-
return options.useHash ? new HashLocationStrategy(platformLocationStrategy, baseHref) : new PathLocationStrategy(platformLocationStrategy, baseHref);
152+
export function provideLocationStrategy(
153+
platformLocationStrategy: PlatformLocation,
154+
baseHref: string,
155+
options: ExtraOptions = {},
156+
) {
157+
return options.useHash
158+
? new HashLocationStrategy(platformLocationStrategy, baseHref)
159+
: new PathLocationStrategy(platformLocationStrategy, baseHref);
119160
}
120161

121162
export function provideLocationInitialized(startpath: string | Promise<string>) {

packages/angular/src/lib/utils/general.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) {
1313
* Utility method which will only fire the callback once ever
1414
* @param fn callback to call only once
1515
*/
16-
// eslint-disable-next-line @typescript-eslint/ban-types
16+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
1717
export function once(fn: Function) {
1818
let wasCalled = false;
1919

@@ -35,9 +35,11 @@ export interface ComponentType<T> {
3535

3636
export function isListLikeIterable(obj: any): boolean {
3737
if (!isJsObject(obj)) return false;
38-
return Array.isArray(obj) ||
39-
(!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
40-
Symbol.iterator in obj); // JS Iterable have a Symbol.iterator prop
38+
return (
39+
Array.isArray(obj) ||
40+
(!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
41+
Symbol.iterator in obj)
42+
); // JS Iterable have a Symbol.iterator prop
4143
}
4244

4345
export function isJsObject(o: any): boolean {

packages/angular/src/lib/utils/ng-safe.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function NativeScriptNgSafeEvent(
1010
onlyLast?: boolean;
1111
onlyFirst?: boolean;
1212
alwaysRunBefore?: string;
13-
} = {}
13+
} = {},
1414
) {
1515
const event = runAfterEvent;
1616
return function (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {
@@ -66,7 +66,6 @@ export function NativeScriptNgSafeEvent(
6666
.events[event].buffer.filter((v) => v.key === propertyKey)
6767
.forEach((fn) => fn.fn());
6868
getNgSafe().events[event].buffer = getNgSafe().events[event].buffer.filter((v) => v.key !== propertyKey);
69-
getNgSafe().runBefore[propertyKey];
7069
if (getNgSafe().runBefore[propertyKey]) {
7170
return getNgSafe().runBefore[propertyKey].apply(this, args);
7271
}

packages/angular/src/lib/view-util.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import { unsetValue, View } from '@nativescript/core';
22
import { getViewClass, getViewMeta, isKnownView } from './element-registry';
33
import { NamespaceFilter } from './property-filter';
4-
import { CommentNode, isContentView, isDetachedElement, isInvisibleNode, isLayout, isView, NgView, TextNode } from './views';
4+
import {
5+
CommentNode,
6+
isContentView,
7+
isDetachedElement,
8+
isInvisibleNode,
9+
isLayout,
10+
isView,
11+
NgView,
12+
TextNode,
13+
} from './views';
514

615
import { NativeScriptDebug } from './trace';
716
import { NgLayoutBase } from './views/view-types';
@@ -27,7 +36,9 @@ function printNgTree(view: NgView) {
2736
}
2837
function printChildrenRecurse(parent: NgView) {
2938
const children = parent.firstChild ? [parent.firstChild, ...getChildrenSiblings(parent.firstChild).nextSiblings] : [];
30-
console.log(`parent: ${parent}, firstChild: ${parent.firstChild}, lastChild: ${parent.lastChild} children: ${children}`);
39+
console.log(
40+
`parent: ${parent}, firstChild: ${parent.firstChild}, lastChild: ${parent.lastChild} children: ${children}`,
41+
);
3142
if (parent.firstChild) {
3243
console.log(`----- start ${parent}`);
3344
}
@@ -61,11 +72,14 @@ function printSiblingsTree(view: NgView) {
6172
console.log(`${view} previousSiblings: ${previousSiblings} nextSiblings: ${nextSiblings}`);
6273
}
6374

64-
// eslint-disable-next-line @typescript-eslint/ban-types
75+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
6576
const propertyMaps: Map<Function, Map<string, string>> = new Map<Function, Map<string, string>>();
6677

6778
export class ViewUtil {
68-
constructor(private namespaceFilters?: NamespaceFilter[], private reuseViews?: boolean) {}
79+
constructor(
80+
private namespaceFilters?: NamespaceFilter[],
81+
private reuseViews?: boolean,
82+
) {}
6983
/**
7084
* Inserts a child into a parrent, preferably before next.
7185
* @param parent parent view
@@ -136,7 +150,9 @@ export class ViewUtil {
136150
*/
137151
private insertInList(parent: NgView, child: NgView, previous: NgView, next: NgView): void {
138152
if (NativeScriptDebug.isLogEnabled()) {
139-
NativeScriptDebug.viewUtilLog(`ViewUtil.insertInList parent: ${parent}, view: ${child}, ` + `previous: ${previous}, next: ${next}`);
153+
NativeScriptDebug.viewUtilLog(
154+
`ViewUtil.insertInList parent: ${parent}, view: ${child}, ` + `previous: ${previous}, next: ${next}`,
155+
);
140156
}
141157

142158
if (previous) {

0 commit comments

Comments
 (0)