Skip to content

Commit 03cfc0c

Browse files
authored
chore(tslint): update tslint rules and fix errors (NativeScript#5747)
* chore(tslint): fix tslint config & errors * chore(tslint): enable double quotes, whitespace, and arrow-return-shorthand rules and fix errors
1 parent a767c8e commit 03cfc0c

152 files changed

Lines changed: 2210 additions & 2197 deletions

File tree

Some content is hidden

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"**/platforms": true,
77
"**/*.js": true,
88
"**/*.js.map": true
9-
}
9+
},
10+
"tslint.configFile": "./build/tslint.json"
1011
}

apps/app/css-perf-test/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {EventData as ObservableEventData} from "tns-core-modules/data/observable";
1+
import {EventData as ObservableEventData } from "tns-core-modules/data/observable";
22

33
export function navigatedTo(args: ObservableEventData) {
44
setTimeout(() => {

apps/app/css-perf-test/root.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Page} from "tns-core-modules/ui/page";
1+
import { Page } from "tns-core-modules/ui/page";
22

33
export function onTap(args: any) {
44
(<any>global).startTime = (<any>global).time();

apps/app/cuteness.io/main-page.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {EventData as ObservableEventData} from "tns-core-modules/data/observable";
2-
import {Page} from "tns-core-modules/ui/page";
3-
import {ItemEventData as ListViewItemEventData} from "tns-core-modules/ui/list-view";
4-
import {topmost as topmostFrame} from "tns-core-modules/ui/frame";
5-
import {AppViewModel} from "./reddit-app-view-model";
1+
import {EventData as ObservableEventData } from "tns-core-modules/data/observable";
2+
import { Page } from "tns-core-modules/ui/page";
3+
import {ItemEventData as ListViewItemEventData } from "tns-core-modules/ui/list-view";
4+
import {topmost as topmostFrame } from "tns-core-modules/ui/frame";
5+
import { AppViewModel } from "./reddit-app-view-model";
66

77
var appViewModel = new AppViewModel();
88

apps/app/devtools-app/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function navigate() {
3030
frame.topmost().navigate("gallery-app/main-page");
3131
}
3232

33-
export function change(args){
33+
export function change(args) {
3434
args.object.text = "hi " + Math.random();
3535

3636
}

apps/app/modaltest/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function onTap3(args: EventData) {
2626
}
2727

2828
function closeModal() {
29-
console.log('closeModal Called');
29+
console.log("closeModal Called");
3030
}
3131

3232
export function sync(args: EventData) {

apps/app/modaltest/modal-tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { View, EventData } from "tns-core-modules/ui/core/view";
22

3-
const colors = ['red', 'orange', 'magenta'];
3+
const colors = ["red", "orange", "magenta"];
44
let x = 0;
55

66
export function onLoaded(args) {

apps/app/navigation-app/main-page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { EventData } from 'tns-core-modules/data/observable';
2-
import { Page, NavigatedData } from 'tns-core-modules/ui/page';
3-
import { topmost, NavigationEntry } from 'tns-core-modules/ui/frame';
1+
import { EventData } from "tns-core-modules/data/observable";
2+
import { Page, NavigatedData } from "tns-core-modules/ui/page";
3+
import { topmost, NavigationEntry } from "tns-core-modules/ui/frame";
44

55
export function nav() {
66
const e: NavigationEntry = {

apps/app/perf-app/flexbox/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {TabView} from "tns-core-modules/ui/tab-view";
1+
import { TabView } from "tns-core-modules/ui/tab-view";
22
import * as utils from "tns-core-modules/utils/utils";
33

44
const titles = ["Etiam lacinia", "Imperdiet ante", "A interdum", "Quisque tempus", "Sodales viverra"];

apps/app/perf-app/properties/tests.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Label } from "tns-core-modules/ui/label";
44

55
const average = 3;
66
const noValue = "noValue";
7-
const colors = ['red', 'green'];
7+
const colors = ["red", "green"];
88

99
export function addRemove(counts: Array<number>, parent: LayoutBase): string {
1010
let result = `addRemove`;
@@ -29,7 +29,7 @@ export function addRemove(counts: Array<number>, parent: LayoutBase): string {
2929
}
3030

3131
export function setText(counts: Array<number>, parent?: LayoutBase): string {
32-
let result = `setText ${parent ? 'with nativeView' : ''}`;
32+
let result = `setText ${parent ? "with nativeView" : ""}`;
3333
counts.forEach((count) => {
3434
const lbl = setup(parent);
3535
const time = executeTest(() => {
@@ -44,7 +44,7 @@ export function setText(counts: Array<number>, parent?: LayoutBase): string {
4444
}
4545

4646
export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase): string {
47-
let result = `setBackgroundColor ${parent ? 'with nativeView' : ''}`;
47+
let result = `setBackgroundColor ${parent ? "with nativeView" : ""}`;
4848
counts.forEach((count) => {
4949
if (parent && count > 10000) {
5050
result += setResultTime(noValue);
@@ -66,7 +66,7 @@ export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase):
6666

6767
const borders = [1, 2, 3];
6868
export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): string {
69-
let result = `setBorderWidths ${parent ? 'with nativeView' : ''}`;
69+
let result = `setBorderWidths ${parent ? "with nativeView" : ""}`;
7070
counts.forEach((count) => {
7171
if (count > 10000 && parent) {
7272
result += setResultTime(noValue);
@@ -90,7 +90,7 @@ export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): str
9090
}
9191

9292
export function setColor(counts: Array<number>, parent?: LayoutBase): string {
93-
let result = `setColor ${parent ? 'with nativeView' : ''}`;
93+
let result = `setColor ${parent ? "with nativeView" : ""}`;
9494
counts.forEach((count) => {
9595
const lbl = setup(parent);
9696
const style = lbl.style;
@@ -128,7 +128,7 @@ export function setColorWithParents(counts: Array<number>, parent: LayoutBase):
128128

129129
const fontSizes = [10, 20];
130130
export function setFontSize(counts: Array<number>, parent?: LayoutBase): string {
131-
let result = `setFontSize ${parent ? 'with nativeView' : ''}`;
131+
let result = `setFontSize ${parent ? "with nativeView" : ""}`;
132132
counts.forEach((count) => {
133133
const lbl = setup(parent);
134134
const style = lbl.style;
@@ -165,13 +165,13 @@ export function setFontSizeWithParents(counts: Array<number>, parent: LayoutBase
165165
}
166166

167167
export function setFontWeight(counts: Array<number>, parent?: LayoutBase): string {
168-
let result = `setFontWeight ${parent ? 'with nativeView' : ''}`;
168+
let result = `setFontWeight ${parent ? "with nativeView" : ""}`;
169169
counts.forEach((count) => {
170170
const lbl = setup(parent);
171171
const style = lbl.style;
172172
const time = executeTest(() => {
173173
for (let i = 0; i < count; i++) {
174-
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal';
174+
style.fontWeight = i % 2 === 0 ? "bold" : "normal";
175175
}
176176
});
177177
result += setResultTime(time);
@@ -192,7 +192,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
192192
setupParents(parent);
193193
const time = executeTest(() => {
194194
for (let i = 0; i < count; i++) {
195-
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal'
195+
style.fontWeight = i % 2 === 0 ? "bold" : "normal"
196196
}
197197
});
198198
result += setResultTime(time);
@@ -202,7 +202,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
202202
}
203203

204204
export function setBindingContext(counts: Array<number>, parent?: LayoutBase): string {
205-
let result = `setBindingContext ${parent ? 'with nativeView' : ''}`;
205+
let result = `setBindingContext ${parent ? "with nativeView" : ""}`;
206206
counts.forEach((count) => {
207207
const lbl = setup(parent);
208208
const time = executeTest(() => {

0 commit comments

Comments
 (0)