Skip to content

Commit 0632215

Browse files
authored
chore: eslint cleanup (#10160)
1 parent bff35e5 commit 0632215

File tree

18 files changed

+97
-71
lines changed

18 files changed

+97
-71
lines changed

.eslintrc.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,22 @@
2424
{
2525
"files": ["*.ts", "*.tsx"],
2626
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "plugin:@nrwl/nx/typescript"],
27-
"rules": {}
27+
"rules": {
28+
"no-empty": "off",
29+
"no-useless-escape": "off",
30+
"no-inner-declarations": "off",
31+
"no-prototype-builtins": "off",
32+
"@typescript-eslint/no-empty-interface": "off",
33+
"@typescript-eslint/no-var-requires": "off",
34+
"@typescript-eslint/no-empty-function": "off",
35+
"@typescript-eslint/ban-ts-comment": "off",
36+
"@typescript-eslint/ban-types": "off",
37+
"@typescript-eslint/no-unused-vars": "off",
38+
"@typescript-eslint/no-explicit-any": "off",
39+
"@typescript-eslint/no-this-alias": "warn",
40+
"@typescript-eslint/no-namespace": "off",
41+
"@typescript-eslint/no-inferrable-types": "off"
42+
}
2843
},
2944
{
3045
"files": ["*.js", "*.jsx"],

packages/core/core-types/index.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export namespace CoreTypes {
3838
};
3939

4040
export type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
41-
export module KeyboardType {
41+
export namespace KeyboardType {
4242
export const datetime = 'datetime';
4343
export const phone = 'phone';
4444
export const number = 'number';
@@ -47,7 +47,7 @@ export namespace CoreTypes {
4747
export const integer = 'integer';
4848
}
4949
export type AutofillType = 'username' | 'password' | 'none' | string;
50-
export module AutofillType {
50+
export namespace AutofillType {
5151
export const username = 'username';
5252
export const password = 'password';
5353
export const newUsername = 'newUsername';
@@ -57,7 +57,7 @@ export namespace CoreTypes {
5757
}
5858

5959
export type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
60-
export module ReturnKeyType {
60+
export namespace ReturnKeyType {
6161
export const done = 'done';
6262
export const next = 'next';
6363
export const go = 'go';
@@ -66,51 +66,51 @@ export namespace CoreTypes {
6666
}
6767

6868
export type TextAlignmentType = 'initial' | 'left' | 'center' | 'right' | 'justify';
69-
export module TextAlignment {
69+
export namespace TextAlignment {
7070
export const left = 'left';
7171
export const center = 'center';
7272
export const right = 'right';
7373
export const justify = 'justify';
7474
}
7575

7676
export type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through';
77-
export module TextDecoration {
77+
export namespace TextDecoration {
7878
export const none = 'none';
7979
export const underline = 'underline';
8080
export const lineThrough = 'line-through';
8181
}
8282

8383
export type TextTransformType = 'initial' | 'none' | 'capitalize' | 'uppercase' | 'lowercase';
84-
export module TextTransform {
84+
export namespace TextTransform {
8585
export const none = 'none';
8686
export const capitalize = 'capitalize';
8787
export const uppercase = 'uppercase';
8888
export const lowercase = 'lowercase';
8989
}
9090

9191
export type WhiteSpaceType = 'initial' | 'normal' | 'nowrap';
92-
export module WhiteSpace {
92+
export namespace WhiteSpace {
9393
export const normal = 'normal';
9494
export const nowrap = 'nowrap';
9595
}
9696

9797
export type MaxLinesType = number;
9898

9999
export type OrientationType = 'horizontal' | 'vertical';
100-
export module Orientation {
100+
export namespace Orientation {
101101
export const horizontal = 'horizontal';
102102
export const vertical = 'vertical';
103103
}
104104

105105
export type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
106-
export module DeviceOrientation {
106+
export namespace DeviceOrientation {
107107
export const portrait = 'portrait';
108108
export const landscape = 'landscape';
109109
export const unknown = 'unknown';
110110
}
111111

112112
export type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch';
113-
export module HorizontalAlignment {
113+
export namespace HorizontalAlignment {
114114
export const left = 'left';
115115
export const center = 'center';
116116
export const right = 'right';
@@ -120,7 +120,7 @@ export namespace CoreTypes {
120120
}
121121

122122
export type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch';
123-
export module VerticalAlignment {
123+
export namespace VerticalAlignment {
124124
export const top = 'top';
125125
export const middle = 'middle';
126126
export const bottom = 'bottom';
@@ -143,15 +143,15 @@ export namespace CoreTypes {
143143
}
144144

145145
export type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
146-
export module ImageStretch {
146+
export namespace ImageStretch {
147147
export const none: ImageStretchType = 'none';
148148
export const aspectFill: ImageStretchType = 'aspectFill';
149149
export const aspectFit: ImageStretchType = 'aspectFit';
150150
export const fill: ImageStretchType = 'fill';
151151
}
152152

153153
export type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed';
154-
export module Visibility {
154+
export namespace Visibility {
155155
export const visible: VisibilityType = 'visible';
156156
export const collapse: VisibilityType = 'collapse';
157157
export const collapsed: VisibilityType = 'collapsed';
@@ -161,79 +161,79 @@ export namespace CoreTypes {
161161
const parseStrict = makeParser<CoreTypes.VisibilityType>(isValid);
162162
}
163163

164-
export module FontAttributes {
164+
export namespace FontAttributes {
165165
export const Normal = 0;
166166
export const Bold = 1;
167167
export const Italic = 1 << 1;
168168
}
169169

170-
export module DeviceType {
170+
export namespace DeviceType {
171171
export const Phone: string = 'Phone';
172172
export const Tablet: string = 'Tablet';
173173
}
174174

175175
export type UpdateTextTriggerType = 'focusLost' | 'textChanged';
176-
export module UpdateTextTrigger {
176+
export namespace UpdateTextTrigger {
177177
export const focusLost: UpdateTextTriggerType = 'focusLost';
178178
export const textChanged: UpdateTextTriggerType = 'textChanged';
179179
}
180180

181-
export module Accuracy {
181+
export namespace Accuracy {
182182
export const any: number = 300;
183183
export const high: number = 3;
184184
}
185185

186186
export type DockType = 'left' | 'top' | 'right' | 'bottom';
187-
export module Dock {
187+
export namespace Dock {
188188
export const left: DockType = 'left';
189189
export const top: DockType = 'top';
190190
export const right: DockType = 'right';
191191
export const bottom: DockType = 'bottom';
192192
}
193193

194194
export type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
195-
export module AutocapitalizationType {
195+
export namespace AutocapitalizationType {
196196
export const none: AutocapitalizationInputType = 'none';
197197
export const words: AutocapitalizationInputType = 'words';
198198
export const sentences: AutocapitalizationInputType = 'sentences';
199199
export const allCharacters: AutocapitalizationInputType = 'allcharacters';
200200
}
201201

202-
export module NavigationBarVisibility {
202+
export namespace NavigationBarVisibility {
203203
export const auto: string = 'auto';
204204
export const never: string = 'never';
205205
export const always: string = 'always';
206206
}
207207

208-
export module AndroidActionBarIconVisibility {
208+
export namespace AndroidActionBarIconVisibility {
209209
export const auto: string = 'auto';
210210
export const never: string = 'never';
211211
export const always: string = 'always';
212212
}
213213

214-
export module AndroidActionItemPosition {
214+
export namespace AndroidActionItemPosition {
215215
export const actionBar: string = 'actionBar';
216216
export const actionBarIfRoom: string = 'actionBarIfRoom';
217217
export const popup: string = 'popup';
218218
}
219219

220-
export module IOSActionItemPosition {
220+
export namespace IOSActionItemPosition {
221221
export const left: string = 'left';
222222
export const right: string = 'right';
223223
}
224224

225-
export module ImageFormat {
225+
export namespace ImageFormat {
226226
export const png: string = 'png';
227227
export const jpeg: string = 'jpeg';
228228
export const jpg: string = 'jpg';
229229
}
230230

231-
export module FontStyle {
231+
export namespace FontStyle {
232232
export const normal: string = 'normal';
233233
export const italic: string = 'italic';
234234
}
235235

236-
export module FontWeight {
236+
export namespace FontWeight {
237237
export const thin: string = '100';
238238
export const extraLight: string = '200';
239239
export const light: string = '300';
@@ -246,7 +246,7 @@ export namespace CoreTypes {
246246
}
247247

248248
export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
249-
export module BackgroundRepeat {
249+
export namespace BackgroundRepeat {
250250
export const repeat: BackgroundRepeatType = 'repeat';
251251
export const repeatX: BackgroundRepeatType = 'repeat-x';
252252
export const repeatY: BackgroundRepeatType = 'repeat-y';
@@ -257,26 +257,26 @@ export namespace CoreTypes {
257257

258258
let animation: typeof animationModule;
259259

260-
export module AnimationCurve {
260+
export namespace AnimationCurve {
261261
export const ease = 'ease';
262262
export const easeIn = 'easeIn';
263263
export const easeOut = 'easeOut';
264264
export const easeInOut = 'easeInOut';
265265
export const linear = 'linear';
266266
export const spring = 'spring';
267-
export function cubicBezier(x1: number, y1: number, x2: number, y2: number): Object {
267+
export function cubicBezier(x1: number, y1: number, x2: number, y2: number) {
268268
animation = animation || require('../ui/animation');
269269

270270
return new animation.CubicBezierAnimationCurve(x1, y1, x2, y2);
271271
}
272272
}
273273

274-
export module StatusBarStyle {
274+
export namespace StatusBarStyle {
275275
export const light = 'light';
276276
export const dark = 'dark';
277277
}
278278

279-
export module SystemAppearance {
279+
export namespace SystemAppearance {
280280
export const light = 'light';
281281
export const dark = 'dark';
282282
}

packages/core/css/parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ function parseArgumentsList<T>(text: string, start: number, argument: (value: st
460460
return { start, end, value };
461461
}
462462

463+
// eslint-disable-next-line no-constant-condition
463464
for (let index = 0; true; index++) {
464465
const arg = argument(text, end, index);
465466
if (!arg) {

packages/core/data/observable-array/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class ObservableArray<T> extends Observable {
9595
}
9696

9797
*[Symbol.iterator]() {
98-
for (let item of this._array) {
98+
for (const item of this._array) {
9999
yield item;
100100
}
101101
}

packages/core/globals/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export function initGlobal() {
362362
}
363363
}
364364

365-
declare var jest: any;
365+
declare const jest: any;
366366
function isTestingEnv() {
367367
return typeof jest !== 'undefined';
368368
}

packages/core/ui/action-bar/action-bar-common.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ export class ActionBarBase extends View implements ActionBarDefinition {
2222
public effectiveContentInsetLeft: number;
2323
public effectiveContentInsetRight: number;
2424

25-
get navigationButton(): NavigationButton {
26-
return this._navigationButton;
27-
}
2825
disposeNativeView() {
2926
this._actionItems = null;
3027
super.disposeNativeView();
3128
}
29+
30+
get navigationButton(): NavigationButton {
31+
return this._navigationButton;
32+
}
3233
set navigationButton(value: NavigationButton) {
3334
if (this._navigationButton !== value) {
3435
if (this._navigationButton) {

packages/core/ui/core/bindable/bindable-expressions.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ const logicalOperators = {
5151
const expressionParsers = {
5252
'ArrayExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
5353
const parsed = [];
54-
for (let element of expression.elements) {
55-
let value = convertExpressionToValue(element, model, isBackConvert, changedModel);
54+
for (const element of expression.elements) {
55+
const value = convertExpressionToValue(element, model, isBackConvert, changedModel);
5656
element.type == 'SpreadElement' ? parsed.push(...value) : parsed.push(value);
5757
}
5858
return parsed;
@@ -116,8 +116,8 @@ const expressionParsers = {
116116
}
117117

118118
const parsedArgs = [];
119-
for (let argument of expression.arguments) {
120-
let value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
119+
for (const argument of expression.arguments) {
120+
const value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
121121
argument.type == 'SpreadElement' ? parsedArgs.push(...value) : parsedArgs.push(value);
122122
}
123123
return expression.optional ? callback?.(...parsedArgs) : callback(...parsedArgs);
@@ -181,8 +181,8 @@ const expressionParsers = {
181181
'NewExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
182182
const callback = convertExpressionToValue(expression.callee, model, isBackConvert, changedModel);
183183
const parsedArgs = [];
184-
for (let argument of expression.arguments) {
185-
let value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
184+
for (const argument of expression.arguments) {
185+
const value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
186186
argument.type == 'SpreadElement' ? parsedArgs.push(...value) : parsedArgs.push(value);
187187
}
188188

@@ -194,7 +194,7 @@ const expressionParsers = {
194194
},
195195
'ObjectExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
196196
const parsedObject = {};
197-
for (let property of expression.properties) {
197+
for (const property of expression.properties) {
198198
const value = convertExpressionToValue(property, model, isBackConvert, changedModel);
199199
Object.assign(parsedObject, value);
200200
}
@@ -217,7 +217,7 @@ const expressionParsers = {
217217
const length = expression.quasis.length;
218218

219219
for (let i = 0; i < length; i++) {
220-
let q = expression.quasis[i];
220+
const q = expression.quasis[i];
221221
parsedText += convertExpressionToValue(q, model, isBackConvert, changedModel);
222222
if (!q.tail) {
223223
parsedText += convertExpressionToValue(expression.expressions[i], model, isBackConvert, changedModel);
@@ -262,7 +262,7 @@ export function parseExpression(expressionText: string): ASTExpression {
262262
if (expression == null) {
263263
const program: any = parse(expressionText, { ecmaVersion: 2020 });
264264
const statements = program.body;
265-
for (let statement of statements) {
265+
for (const statement of statements) {
266266
if (statement.type == 'ExpressionStatement') {
267267
expression = statement.expression;
268268
break;

packages/core/ui/core/bindable/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class Binding {
415415
}
416416

417417
// Clear added props
418-
for (let prop of addedProps) {
418+
for (const prop of addedProps) {
419419
delete context[prop];
420420
}
421421
addedProps.length = 0;

packages/core/ui/editable-text-base/index.android.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,15 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
229229
newInputType = android.text.InputType.TYPE_CLASS_NUMBER;
230230
break;
231231

232-
default:
232+
default: {
233233
const inputType = +value;
234234
if (!isNaN(inputType)) {
235235
newInputType = inputType;
236236
} else {
237237
newInputType = android.text.InputType.TYPE_CLASS_TEXT;
238238
}
239239
break;
240+
}
240241
}
241242

242243
this._setInputType(newInputType);

0 commit comments

Comments
 (0)