-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy patheslint.config.js
More file actions
36 lines (33 loc) · 1.39 KB
/
Copy patheslint.config.js
File metadata and controls
36 lines (33 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @ts-check
import tseslint from "typescript-eslint";
const fastMode = !!process.env.ESLINT_FAST;
export default tseslint.config(
{
ignores: ["**/dist/**", "**/node_modules/**", "**/build/**", "**/*.js"],
},
{
...tseslint.configs.base,
files: ["**/*.ts"],
languageOptions: {
// @ts-ignore
...tseslint.configs.base.languageOptions,
parserOptions: {
// @ts-ignore
...tseslint.configs.base.languageOptions?.parserOptions,
// `allowDefaultProject` covers files that are not included in any
// tsconfig `include` glob and would otherwise be silently skipped:
// - global.d.ts: root-level declaration file, not part of any project
projectService: fastMode ? false : { allowDefaultProject: ["global.d.ts"] },
},
},
rules: {
"no-debugger": "error", // ban debugger
"prefer-const": ["error", { destructuring: "all" }], // prefer const to let if no reassignment
"no-unsafe-optional-chaining": "error", // ban unsafe optional chaining
eqeqeq: "error", // ban non-strict equal
"@typescript-eslint/no-non-null-asserted-optional-chain": "error", // ban non-null assertion in optional chain
curly: ["error", "all"], // enforce curly braces for all control statements
...(!fastMode && { "@typescript-eslint/consistent-type-exports": "error" }), // enforce consistent type exports
},
}
);