Skip to content

Commit ce4ef5a

Browse files
NathanWalkerclaude
andcommitted
chore: fix eslint config for typescript-eslint v8 and make nx lint core pass
The config referenced @typescript-eslint/no-extra-semi, which was removed in typescript-eslint v8, causing a rule-not-found error on every linted file. Removing it surfaced pre-existing issues, addressed as follows: - Disable the v8 successors of the already-disabled ban-types rule (no-unsafe-function-type, no-wrapper-object-types, no-empty-object-type) plus no-unsafe-declaration-merging (interface+class merging is a core NativeScript pattern), and allow short-circuit/ternary expression statements, matching existing code style. - Stop linting generated iOS typings (platforms/) and the vendored css parser (css/lib/) in packages/core. - Drop parserOptions.project from packages/core lint config: no type-aware rules are in use, and it caused parsing errors for ~20 handwritten d.ts files not included in any tsconfig. - Code fixes: do..while(true) -> while(true) in CSS3Parser, prefer-const in inspector_modules, module -> namespace in file-system/trace d.ts files, eslint-disable for the required triple-slash reference in index.d.ts. nx lint core, nx test core (192 passed) and nx build core all pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 11165a7 commit ce4ef5a

7 files changed

Lines changed: 16 additions & 18 deletions

File tree

.eslintrc.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@
3939
"@typescript-eslint/no-this-alias": "warn",
4040
"@typescript-eslint/no-namespace": "off",
4141
"@typescript-eslint/no-inferrable-types": "off",
42-
"@typescript-eslint/no-extra-semi": "error",
42+
"@typescript-eslint/no-empty-object-type": "off",
43+
"@typescript-eslint/no-unsafe-function-type": "off",
44+
"@typescript-eslint/no-wrapper-object-types": "off",
45+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
46+
"@typescript-eslint/no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
4347
"no-extra-semi": "off"
4448
}
4549
},
4650
{
4751
"files": ["*.js", "*.jsx"],
4852
"extends": ["plugin:@nx/javascript"],
4953
"rules": {
50-
"@typescript-eslint/no-extra-semi": "error",
5154
"no-extra-semi": "off"
5255
}
5356
},

packages/core/.eslintrc.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
22
"extends": "../../.eslintrc.json",
33
"rules": {},
4-
"ignorePatterns": ["!**/*", "**/global-types.d.ts", "**/node_modules/**/*", "**/__tests__/**/*", "**/vite.config.*.timestamp*", "**/vitest.config.*.timestamp*"],
4+
"ignorePatterns": ["!**/*", "**/global-types.d.ts", "**/node_modules/**/*", "**/__tests__/**/*", "**/platforms/**/*", "**/css/lib/**/*", "**/vite.config.*.timestamp*", "**/vitest.config.*.timestamp*"],
55
"overrides": [
6-
{
7-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8-
"parserOptions": {
9-
"project": ["packages/core/tsconfig.*?.json"]
10-
},
11-
"rules": {}
12-
},
136
{
147
"files": ["*.ts", "*.tsx"],
158
"rules": {}

packages/core/css/CSS3Parser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ export class CSS3Parser {
669669
text: undefined,
670670
components: [],
671671
};
672-
do {
672+
// eslint-disable-next-line no-constant-condition
673+
while (true) {
673674
if (this.nextInputCodePointIndex >= this.text.length) {
674675
funcToken.text = name + '(' + this.text.substring(start);
675676

@@ -692,6 +693,6 @@ export class CSS3Parser {
692693
}
693694
// TODO: Else we won't advance
694695
}
695-
} while (true);
696+
}
696697
}
697698
}

packages/core/file-system/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export class Folder extends FileSystemEntity {
287287
/**
288288
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
289289
*/
290-
export module knownFolders {
290+
export namespace knownFolders {
291291
/**
292292
* Gets the Documents folder available for the current application. This Folder is private for the application and not accessible from Users/External apps.
293293
*/
@@ -314,7 +314,7 @@ export module knownFolders {
314314
/**
315315
* Contains iOS-specific known folders.
316316
*/
317-
module ios {
317+
namespace ios {
318318
/**
319319
* Gets the NSLibraryDirectory. Note that the folder will not be created if it did not exist.
320320
*/
@@ -360,7 +360,7 @@ export module knownFolders {
360360
/**
361361
* Enables path-specific operations like join, extension, etc.
362362
*/
363-
export module path {
363+
export namespace path {
364364
/**
365365
* Normalizes a path, taking care of occurrances like ".." and "//".
366366
* @param path The path to be normalized.

packages/core/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
12
/// <reference path="./global-types.d.ts" />
23
/**
34
* IMPORTANT: this is not generated automatically due to this issue:

packages/core/inspector_modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function remapStack(raw: string): string {
183183
const lines = raw.split('\n');
184184
const out = lines.map((line) => {
185185
// 1) Parenthesized frame: at fn (file:...:L:C)
186-
let m = /\((.+):(\d+):(\d+)\)/.exec(line);
186+
const m = /\((.+):(\d+):(\d+)\)/.exec(line);
187187
if (m) {
188188
try {
189189
const [_, file, l, c] = m;

packages/core/trace/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export namespace Trace {
9393

9494
export function removeEventListener(listener: TraceEventListener): void;
9595

96-
export module messageType {
96+
export namespace messageType {
9797
export const log = 0;
9898
export const info = 1;
9999
export const warn = 2;
@@ -103,7 +103,7 @@ export namespace Trace {
103103
/**
104104
* all predefined categories.
105105
*/
106-
export module categories {
106+
export namespace categories {
107107
export const VisualTreeEvents = 'VisualTreeEvents';
108108
export const Layout = 'Layout';
109109
export const Style = 'Style';

0 commit comments

Comments
 (0)