Skip to content

Commit 1606bd1

Browse files
committed
refactor(apps, napi, tasks): remove noUnusedLocals from tsconfigs (#20155)
Remove `noUnusedLocals` option from `tsconfig.json` files. It's redundant, as Oxlint `no-unused-vars` covers this for us. It's an annoyance to have `noUnusedLocals` enabled, as in VS Code TypeScript complains about unused vars, even if they're prefixed with `_`. Removing this option allows simplifying type tests added in #20066. Only reason these types had to be exported was to stop TS complaining that they were unused.
1 parent 42aff15 commit 1606bd1

File tree

7 files changed

+14
-22
lines changed

7 files changed

+14
-22
lines changed

apps/oxfmt/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"noEmit": true,
77
"target": "ESNext",
88
"strict": true,
9-
"skipLibCheck": true,
10-
"noUnusedLocals": true
9+
"skipLibCheck": true
1110
},
1211
"include": ["scripts", "conformance/*.ts", "src-js", "test/**/*.ts"],
1312
"exclude": ["test/**/fixtures"]

apps/oxlint/src-js/visitor.test-d.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@ import type { Node, CallExpression } from "./generated/types.d.ts";
44

55
// Empty visitor object is allowed
66
const emptyVisitor = {};
7-
export type _Empty = ExpectTrue<ExpectExtends<VisitorObject, typeof emptyVisitor>>;
7+
type _Empty = ExpectTrue<ExpectExtends<VisitorObject, typeof emptyVisitor>>;
88

99
// Specific node visitors have a stricter type for the parameter
1010
const callExpressionVisitor = {
1111
CallExpression: (_node: CallExpression) => {},
1212
};
13-
export type _CallExpr = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionVisitor>>;
13+
type _CallExpr = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionVisitor>>;
1414

1515
const callExpressionExitVisitor = {
1616
"CallExpression:exit": (_node: CallExpression) => {},
1717
};
18-
export type _CallExprExit = ExpectTrue<
19-
ExpectExtends<VisitorObject, typeof callExpressionExitVisitor>
20-
>;
18+
type _CallExprExit = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionExitVisitor>>;
2119

2220
const debuggerStatementWrongTypeVisitor = {
2321
DebuggerStatement: (_node: CallExpression) => {},
2422
};
25-
export type _DebuggerStmtWrongType = ExpectFalse<
23+
type _DebuggerStmtWrongType = ExpectFalse<
2624
ExpectExtends<VisitorObject, typeof debuggerStatementWrongTypeVisitor>
2725
>;
2826

@@ -31,13 +29,13 @@ const selectorsVisitor = {
3129
"FunctionExpression > Identifier": (_node: Node) => {},
3230
":matches(FunctionExpression, FunctionDeclaration)": (_node: Node) => {},
3331
};
34-
export type _Selectors = ExpectTrue<ExpectExtends<VisitorObject, typeof selectorsVisitor>>;
32+
type _Selectors = ExpectTrue<ExpectExtends<VisitorObject, typeof selectorsVisitor>>;
3533

3634
// Visitor functions can omit the node parameter
3735
const callExpressionNoParamVisitor = {
3836
CallExpression: () => {},
3937
};
40-
export type _CallExprNoParam = ExpectTrue<
38+
type _CallExprNoParam = ExpectTrue<
4139
ExpectExtends<VisitorObject, typeof callExpressionNoParamVisitor>
4240
>;
4341

@@ -47,22 +45,22 @@ export type _CallExprNoParam = ExpectTrue<
4745
const callExpressionUndefinedVisitor = {
4846
CallExpression: undefined,
4947
};
50-
export type _CallExprUndefined = ExpectTrue<
48+
type _CallExprUndefined = ExpectTrue<
5149
ExpectExtends<VisitorObject, typeof callExpressionUndefinedVisitor>
5250
>;
5351

5452
// Other types are not allowed
5553
const invalidNullVisitor = {
5654
CallExpression: null,
5755
};
58-
export type _InvalidNull = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidNullVisitor>>;
56+
type _InvalidNull = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidNullVisitor>>;
5957

6058
const invalidObjectVisitor = {
6159
CallExpression: {},
6260
};
63-
export type _InvalidObject = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidObjectVisitor>>;
61+
type _InvalidObject = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidObjectVisitor>>;
6462

6563
const invalidStringVisitor = {
6664
CallExpression: "oh dear",
6765
};
68-
export type _InvalidString = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidStringVisitor>>;
66+
type _InvalidString = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidStringVisitor>>;

apps/oxlint/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"target": "ESNext",
88
"allowImportingTsExtensions": true,
99
"strict": true,
10-
"skipLibCheck": true,
11-
"noUnusedLocals": true
10+
"skipLibCheck": true
1211
},
1312
"exclude": ["node_modules", "fixtures", "test/fixtures/*/files", "conformance/submodules"]
1413
}

napi/minify/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"module": "Preserve",
55
"moduleResolution": "Bundler",
66
"noEmit": true,
7-
"target": "ESNext",
8-
"noUnusedLocals": true
7+
"target": "ESNext"
98
}
109
}

napi/parser/tsconfig.node.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"noEmit": true,
77
"target": "ESNext",
88
"allowImportingTsExtensions": true,
9-
"noUnusedLocals": true,
109
"skipLibCheck": true,
1110
"strict": false
1211
},

napi/transform/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"module": "Preserve",
55
"moduleResolution": "Bundler",
66
"noEmit": true,
7-
"target": "ESNext",
8-
"noUnusedLocals": true
7+
"target": "ESNext"
98
}
109
}

tasks/e2e/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"compilerOptions": {
33
"experimentalDecorators": true,
44
"module": "esnext",
5-
"noUnusedLocals": true,
65
"strict": false
76
}
87
}

0 commit comments

Comments
 (0)