Skip to content

Commit 92e4ef8

Browse files
committed
chore: fix linting and styling
1 parent ae0fca3 commit 92e4ef8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+208
-182
lines changed

apps/nativescript-demo-ng/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../.eslintrc.json",
3-
"ignorePatterns": ["!**/*"],
3+
"ignorePatterns": ["!**/*", "node_modules/**/*"],
44
"overrides": [
55
{
66
"files": ["*.ts"],

apps/nativescript-demo-ng/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"postinstall": "node ./tools/xplat-postinstall.js"
77
},
88
"dependencies": {
9-
"@nativescript/angular": "file:../../packages/angular",
109
"@nativescript/core": "file:../../node_modules/@nativescript/core",
1110
"@nativescript-community/ui-material-bottom-navigation": "^7.0.0"
1211
},

apps/nativescript-demo-ng/references.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/triple-slash-reference */
12
/// <reference path="../../node_modules/@nativescript/types-ios/index.d.ts" />
23
/// <reference path="../../node_modules/@nativescript/types-android/lib/android-29.d.ts" />
34

apps/nativescript-demo-ng/src/app/home/home.component.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class HomeComponent {
1212
tabItems: { [key: string]: { index: number; title?: string; iconSource?: string; textTransform?: string } } = {};
1313
private _tabs = ['start'];
1414
private _hasInitTab: { start?: boolean } = {};
15+
private _tabView: TabView;
1516

1617
constructor(
1718
private _ngZone: NgZone,
@@ -28,14 +29,15 @@ export class HomeComponent {
2829
this._viewTab(0);
2930
}
3031

31-
private _tabView;
3232
onIndexChanged(e) {
3333
if (e && e.object) {
3434
this._tabView = <TabView>e.object;
3535
}
3636
}
3737

38-
loadedTabView(args) {}
38+
loadedTabView(args) {
39+
//
40+
}
3941

4042
private _viewTab(index: number) {
4143
let route;

apps/nativescript-demo-ng/src/tests/detached-loader-tests.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class LoaderComponent extends LoaderComponentBase {}
3535
</StackLayout>
3636
`,
3737
})
38+
// eslint-disable-next-line @angular-eslint/component-class-suffix
3839
export class LoaderComponentOnPush extends LoaderComponentBase {}
3940

4041
@NgModule({

apps/nativescript-demo-ng/src/tests/list-view-tests.spec.ts

+33-43
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let testTemplates: { first: number; second: number };
2727
})
2828
export class TestListViewComponent {
2929
public myItems: Array<DataItem> = ITEMS;
30-
public counter: number = 0;
30+
public counter = 0;
3131
onSetupItemView(args) {
3232
this.counter++;
3333
}
@@ -103,7 +103,9 @@ export class TestListViewSelectorWithEventsComponent {
103103
constructor() {
104104
testTemplates = { first: 0, second: 0 };
105105
}
106-
dummyEvent(evt) {}
106+
dummyEvent(evt) {
107+
//
108+
}
107109
}
108110

109111
@Component({
@@ -146,49 +148,37 @@ describe('ListView-tests', () => {
146148
}).compileComponents()
147149
);
148150

149-
it(
150-
'setupItemView is called for every item',
151-
waitForAsync(async () => {
152-
const fixture = TestBed.createComponent(TestListViewComponent);
153-
fixture.detectChanges();
154-
const component = fixture.componentRef.instance;
155-
await fixture.whenRenderingDone();
156-
expect(component.counter).toBe(3);
157-
})
158-
);
151+
it('setupItemView is called for every item', waitForAsync(async () => {
152+
const fixture = TestBed.createComponent(TestListViewComponent);
153+
fixture.detectChanges();
154+
const component = fixture.componentRef.instance;
155+
await fixture.whenRenderingDone();
156+
expect(component.counter).toBe(3);
157+
}));
159158

160-
it(
161-
'itemTemplateSelector selects templates',
162-
waitForAsync(async () => {
163-
const fixture = TestBed.createComponent(TestListViewSelectorComponent);
164-
fixture.detectChanges();
159+
it('itemTemplateSelector selects templates', waitForAsync(async () => {
160+
const fixture = TestBed.createComponent(TestListViewSelectorComponent);
161+
fixture.detectChanges();
162+
await fixture.whenRenderingDone();
163+
expect(testTemplates).toEqual({ first: 2, second: 1 });
164+
}));
165+
166+
it("itemTemplateSelector doesn't break with events", waitForAsync(async () => {
167+
try {
168+
const fixture = TestBed.createComponent(TestListViewSelectorWithEventsComponent);
169+
fixture.autoDetectChanges(true);
165170
await fixture.whenRenderingDone();
166171
expect(testTemplates).toEqual({ first: 2, second: 1 });
167-
})
168-
);
169-
170-
it(
171-
"itemTemplateSelector doesn't break with events",
172-
waitForAsync(async () => {
173-
try {
174-
const fixture = TestBed.createComponent(TestListViewSelectorWithEventsComponent);
175-
fixture.autoDetectChanges(true);
176-
await fixture.whenRenderingDone();
177-
expect(testTemplates).toEqual({ first: 2, second: 1 });
178-
} catch (e) {
179-
fail(e);
180-
}
181-
})
182-
);
172+
} catch (e) {
173+
fail(e);
174+
}
175+
}));
183176

184-
it(
185-
"'defaultTemplate' does not throw when list-view is scrolled",
186-
waitForAsync(async () => {
187-
const fixture = TestBed.createComponent(TestDefaultItemTemplateComponent);
188-
fixture.detectChanges();
189-
const component = fixture.componentRef.instance;
190-
await fixture.whenRenderingDone();
191-
expect(component.onScrollListViewTo.bind(component)).not.toThrow();
192-
})
193-
);
177+
it("'defaultTemplate' does not throw when list-view is scrolled", waitForAsync(async () => {
178+
const fixture = TestBed.createComponent(TestDefaultItemTemplateComponent);
179+
fixture.detectChanges();
180+
const component = fixture.componentRef.instance;
181+
await fixture.whenRenderingDone();
182+
expect(component.onScrollListViewTo.bind(component)).not.toThrow();
183+
}));
194184
});

apps/nativescript-demo-ng/src/tests/ns-location-strategy.spec.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class FakeFrameService extends FrameService {
1515
}
1616
}
1717

18+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1819
// @ts-ignore
1920
export class FakeFrame extends View implements Frame {
2021
backStack: Array<BackstackEntry>;
@@ -35,7 +36,9 @@ export class FakeFrame extends View implements Frame {
3536
}
3637
}
3738

38-
navigate(entry: any) {}
39+
navigate(entry: any) {
40+
//
41+
}
3942

4043
constructor(private backCB?: () => void) {
4144
super();

apps/nativescript-demo-ng/src/tests/ns-router-link.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Label } from '@nativescript/core';
77

88
describe('NSRouterLink', () => {
99
const mockRouter = {} as Router;
10-
let mockRouterExtensions = {
10+
const mockRouterExtensions = {
1111
navigateByUrl: fake(),
1212
navigate: fake(),
1313
};

apps/nativescript-demo-ng/src/tests/property-sets.spec.ts

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ type ViewUtil = ɵViewUtil.ViewUtil;
55

66
class TestView extends View implements NgView {
77
public meta: ViewClassMeta = { skipAddToDom: false };
8-
public nodeType: number = 1;
9-
public nodeName: string = 'TestView';
8+
public nodeType = 1;
9+
public nodeName = 'TestView';
1010
public parentNode: NgView = null;
1111
public previousSibling: NgView;
1212
public nextSibling: NgView;
1313
public firstChild: NgView;
1414
public lastChild: NgView;
1515
public ngCssClasses: Map<string, boolean> = new Map<string, boolean>();
1616

17-
public stringValue: string = '';
18-
public numValue: number = 0;
17+
public stringValue = '';
18+
public numValue = 0;
1919
public boolValue: boolean = undefined;
2020
public anyValue: any = undefined;
2121
public nested: { property: string } = { property: 'untouched' };
@@ -34,13 +34,13 @@ describe('setting View properties', () => {
3434
});
3535

3636
it('preserves string values', () => {
37-
let view = new TestView();
37+
const view = new TestView();
3838
viewUtil.setProperty(view, 'stringValue', 'blah');
3939
expect(view.stringValue).toBe('blah');
4040
});
4141

4242
it("doesn't convert number values", () => {
43-
let view = new TestView();
43+
const view = new TestView();
4444
viewUtil.setProperty(view, 'numValue', '42');
4545
expect(view.numValue).toBe(<any>'42');
4646

@@ -52,70 +52,70 @@ describe('setting View properties', () => {
5252
});
5353

5454
it("doesn't convert boolean values", () => {
55-
let view = new TestView();
55+
const view = new TestView();
5656
viewUtil.setProperty(view, 'boolValue', 'true');
5757
expect(view.boolValue).toBe(<any>'true');
5858
viewUtil.setProperty(view, 'boolValue', 'false');
5959
expect(view.boolValue).toBe(<any>'false');
6060
});
6161

6262
it('sets style values', () => {
63-
let view = new TestView();
63+
const view = new TestView();
6464
viewUtil.setProperty(view, 'style', 'color: red');
6565
expect(view.style.color.hex).toBe(new Color('red').hex);
6666
});
6767

6868
it("doesn't convert blank strings", () => {
69-
let view = new TestView();
69+
const view = new TestView();
7070
viewUtil.setProperty(view, 'stringValue', '');
7171
expect(view.stringValue).toBe('');
7272
});
7373

7474
it("doesn't convert booleans", () => {
75-
let view = new TestView();
75+
const view = new TestView();
7676
viewUtil.setProperty(view, 'boolValue', true);
7777
expect(view.boolValue).toBe(true);
7878
viewUtil.setProperty(view, 'boolValue', false);
7979
expect(view.boolValue).toBe(false);
8080
});
8181

8282
it('preserves objects', () => {
83-
let value = { name: 'Jim', age: 23 };
84-
let view = new TestView();
83+
const value = { name: 'Jim', age: 23 };
84+
const view = new TestView();
8585
viewUtil.setProperty(view, 'anyValue', value);
8686
expect(value).toEqual(view.anyValue);
8787
});
8888

8989
it('sets nested properties', () => {
90-
let view = new TestView();
90+
const view = new TestView();
9191
viewUtil.setProperty(view, 'nested.property', 'blah');
9292
expect(view.nested.property).toBe('blah');
9393
});
9494

9595
it('sets ios property in ios', () => {
96-
let view = new TestView();
97-
let testUtil = createViewUtil(iosDevice);
96+
const view = new TestView();
97+
const testUtil = createViewUtil(iosDevice);
9898
testUtil.setProperty(view, 'anyValue', 'blah', 'ios');
9999
expect(view.anyValue).toBe('blah');
100100
});
101101

102102
it("doesn't set android property in ios", () => {
103-
let view = new TestView();
104-
let testUtil = createViewUtil(iosDevice);
103+
const view = new TestView();
104+
const testUtil = createViewUtil(iosDevice);
105105
testUtil.setProperty(view, 'anyValue', 'blah', 'android');
106106
expect(view.anyValue).toBeUndefined();
107107
});
108108

109109
it('sets android property in android', () => {
110-
let view = new TestView();
111-
let testUtil = createViewUtil(androidDevice);
110+
const view = new TestView();
111+
const testUtil = createViewUtil(androidDevice);
112112
testUtil.setProperty(view, 'anyValue', 'blah', 'android');
113113
expect(view.anyValue).toBe('blah');
114114
});
115115

116116
it("doesn't set ios property in android", () => {
117-
let view = new TestView();
118-
let testUtil = createViewUtil(androidDevice);
117+
const view = new TestView();
118+
const testUtil = createViewUtil(androidDevice);
119119
testUtil.setProperty(view, 'anyValue', 'blah', 'ios');
120120
expect(view.anyValue).toBeUndefined();
121121
});

apps/nativescript-demo-ng/src/tests/test-config.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// import * as chai from "chai";
66
import * as sinon from 'sinon';
77
// export let assert: typeof chai.assert = (<any>global).chai.assert;
8-
export let fake: typeof sinon.fake = (<any>global).sinon.fake;
9-
export let spy: typeof sinon.spy = (<any>global).sinon.spy;
10-
export let stub: typeof sinon.stub = (<any>global).sinon.stub;
8+
export const fake: typeof sinon.fake = (<any>global).sinon.fake;
9+
export const spy: typeof sinon.spy = (<any>global).sinon.spy;
10+
export const stub: typeof sinon.stub = (<any>global).sinon.stub;

apps/nativescript-demo-ng/src/tests/test-utils.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TextBase } from '@nativescript/core/ui/text-base';
33
import { Device } from '@nativescript/core/platform';
44

55
function getChildren(view: View): Array<View> {
6-
let children: Array<View> = [];
6+
const children: Array<View> = [];
77
(<any>view).eachChildView((child) => {
88
children.push(child);
99
return true;
@@ -19,14 +19,14 @@ export function dumpView(view: View, verbose: boolean = false): string {
1919
}
2020
nodeName = nodeName.toLocaleLowerCase();
2121

22-
let output = ['(', nodeName];
22+
const output = ['(', nodeName];
2323
if (verbose) {
2424
if (view instanceof TextBase) {
2525
output.push('[text=', view.text, ']');
2626
}
2727
}
2828

29-
let children = getChildren(view)
29+
const children = getChildren(view)
3030
.map((c) => dumpView(c, verbose))
3131
.join(', ');
3232
if (children) {

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@
114114
},
115115
"lint-staged": {
116116
"**/*.{js,ts,scss,json,html}": [
117-
"nx format:write --files"
117+
"nx format:write --files",
118+
"nx affected:lint --fix --files"
118119
]
119120
}
120121
}

packages/angular/.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"prefix": "",
2222
"style": "kebab-case"
2323
}
24-
]
24+
],
25+
"@angular-eslint/directive-class-suffix": "off"
2526
}
2627
},
2728
{

packages/angular/references.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/triple-slash-reference */
12
/// <reference path="../../node_modules/@nativescript/core/global-types.d.ts" />
23
declare const global: typeof globalThis;
34
declare const ngDevMode: unknown | null;

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

+2
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/ban-types */
13
import { AnimationPlayer } from '@angular/animations';
24
import { View, EventData, KeyframeAnimation } from '@nativescript/core';
35

0 commit comments

Comments
 (0)