Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/oxfmt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"noEmit": true,
"target": "ESNext",
"strict": true,
"skipLibCheck": true,
"noUnusedLocals": true
"skipLibCheck": true
},
"include": ["scripts", "conformance/*.ts", "src-js", "test/**/*.ts"],
"exclude": ["test/**/fixtures"]
Expand Down
22 changes: 10 additions & 12 deletions apps/oxlint/src-js/visitor.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@ import type { Node, CallExpression } from "./generated/types.d.ts";

// Empty visitor object is allowed
const emptyVisitor = {};
export type _Empty = ExpectTrue<ExpectExtends<VisitorObject, typeof emptyVisitor>>;
type _Empty = ExpectTrue<ExpectExtends<VisitorObject, typeof emptyVisitor>>;

// Specific node visitors have a stricter type for the parameter
const callExpressionVisitor = {
CallExpression: (_node: CallExpression) => {},
};
export type _CallExpr = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionVisitor>>;
type _CallExpr = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionVisitor>>;

const callExpressionExitVisitor = {
"CallExpression:exit": (_node: CallExpression) => {},
};
export type _CallExprExit = ExpectTrue<
ExpectExtends<VisitorObject, typeof callExpressionExitVisitor>
>;
type _CallExprExit = ExpectTrue<ExpectExtends<VisitorObject, typeof callExpressionExitVisitor>>;

const debuggerStatementWrongTypeVisitor = {
DebuggerStatement: (_node: CallExpression) => {},
};
export type _DebuggerStmtWrongType = ExpectFalse<
type _DebuggerStmtWrongType = ExpectFalse<
ExpectExtends<VisitorObject, typeof debuggerStatementWrongTypeVisitor>
>;

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

// Visitor functions can omit the node parameter
const callExpressionNoParamVisitor = {
CallExpression: () => {},
};
export type _CallExprNoParam = ExpectTrue<
type _CallExprNoParam = ExpectTrue<
ExpectExtends<VisitorObject, typeof callExpressionNoParamVisitor>
>;

Expand All @@ -47,22 +45,22 @@ export type _CallExprNoParam = ExpectTrue<
const callExpressionUndefinedVisitor = {
CallExpression: undefined,
};
export type _CallExprUndefined = ExpectTrue<
type _CallExprUndefined = ExpectTrue<
ExpectExtends<VisitorObject, typeof callExpressionUndefinedVisitor>
>;

// Other types are not allowed
const invalidNullVisitor = {
CallExpression: null,
};
export type _InvalidNull = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidNullVisitor>>;
type _InvalidNull = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidNullVisitor>>;

const invalidObjectVisitor = {
CallExpression: {},
};
export type _InvalidObject = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidObjectVisitor>>;
type _InvalidObject = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidObjectVisitor>>;

const invalidStringVisitor = {
CallExpression: "oh dear",
};
export type _InvalidString = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidStringVisitor>>;
type _InvalidString = ExpectFalse<ExpectExtends<VisitorObject, typeof invalidStringVisitor>>;
3 changes: 1 addition & 2 deletions apps/oxlint/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"target": "ESNext",
"allowImportingTsExtensions": true,
"strict": true,
"skipLibCheck": true,
"noUnusedLocals": true
"skipLibCheck": true
},
"exclude": ["node_modules", "fixtures", "test/fixtures/*/files", "conformance/submodules"]
}
3 changes: 1 addition & 2 deletions napi/minify/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"module": "Preserve",
"moduleResolution": "Bundler",
"noEmit": true,
"target": "ESNext",
"noUnusedLocals": true
"target": "ESNext"
}
}
1 change: 0 additions & 1 deletion napi/parser/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"noEmit": true,
"target": "ESNext",
"allowImportingTsExtensions": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"strict": false
},
Expand Down
3 changes: 1 addition & 2 deletions napi/transform/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"module": "Preserve",
"moduleResolution": "Bundler",
"noEmit": true,
"target": "ESNext",
"noUnusedLocals": true
"target": "ESNext"
}
}
1 change: 0 additions & 1 deletion tasks/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"experimentalDecorators": true,
"module": "esnext",
"noUnusedLocals": true,
"strict": false
}
}
Loading