-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
108 lines (107 loc) · 3.34 KB
/
Copy patheslint.config.js
File metadata and controls
108 lines (107 loc) · 3.34 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const js = require("@eslint/js");
const globals = require("globals");
const tsParser = require("@typescript-eslint/parser");
const tseslint = require("@typescript-eslint/eslint-plugin");
module.exports = [
{
ignores: [
"**/node_modules/**",
"packages/**/out/**",
"packages/**/test/**",
"coverage/**",
"dist/**",
"fixtures/**",
".aurelia-cache/**",
"**/*.tsbuildinfo",
"examples/**",
],
},
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2023,
sourceType: "module",
project: "./tsconfig.eslint.json",
tsconfigRootDir: __dirname,
},
globals: {
...globals.es2023,
...globals.node,
},
},
plugins: {
"@typescript-eslint": tseslint,
},
rules: {
...js.configs.recommended.rules,
...tseslint.configs["recommended-type-checked"].rules,
"no-empty": "off",
"no-var": "error",
"prefer-const": ["error", { destructuring: "all" }],
// TODO: re-enable if template literal churn is worth enforcing; disabled to reduce noise.
"prefer-template": "off",
eqeqeq: ["error", "smart"],
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrors: "none" },
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
"@typescript-eslint/consistent-type-assertions": [
"error",
{ assertionStyle: "as", objectLiteralTypeAssertions: "allow-as-parameter" },
],
"@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true, ignoreRestArgs: true }],
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true, ignoreIIFE: true }],
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
"@typescript-eslint/restrict-template-expressions": [
"error",
{ allowNumber: true, allowBoolean: true, allowNullish: false },
],
// TODO: re-evaluate once non-null assertions are cleaned up; disabling to reduce noise while invariants are enforced elsewhere.
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": [
"warn",
{
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
minimumDescriptionLength: 5,
},
],
"no-restricted-syntax": [
"error",
{
selector: "CallExpression[callee.name='require']",
message: "Use ESM imports instead of require().",
},
],
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
},
{
files: ["**/*.{js,cjs,mjs}"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "module",
globals: {
...globals.es2023,
...globals.node,
},
},
rules: {
...js.configs.recommended.rules,
"no-empty": "off",
"no-var": "error",
"prefer-const": ["error", { destructuring: "all" }],
// TODO: re-enable if template literal churn is worth enforcing; disabled to reduce noise.
"prefer-template": "off",
eqeqeq: ["error", "smart"],
},
},
];