-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy patheslint.config.mjs
More file actions
63 lines (61 loc) · 1.88 KB
/
eslint.config.mjs
File metadata and controls
63 lines (61 loc) · 1.88 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
import globals from "globals";
import pluginJs from "@eslint/js";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
// eslint-disable-next-line no-undef
global.structuredClone = global.structuredClone || (obj => JSON.parse(JSON.stringify(obj)));
export default [
{
ignores: [ "**/*.spec.ts" ],
files: [ "**/*.{js,mjs,cjs,ts}" ],
languageOptions: {
parser: tsParser,
globals: globals.browser,
},
plugins: {
js: pluginJs,
"@typescript-eslint": tsPlugin,
},
rules: {
...pluginJs.configs.recommended.rules,
...tsPlugin.configs.recommended.rules,
"max-lines-per-function": [ "warn", {
max: 40,
skipBlankLines: true,
skipComments: true
} ],
"no-console": "warn",
"no-var": "warn",
"prefer-const": "warn",
"prefer-template": "warn",
"sort-imports": [ "warn", {
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: [ "none", "all", "multiple", "single" ]
} ],
"strict": [ "warn", "global" ],
"valid-typeof": "warn",
"@typescript-eslint/explicit-function-return-type": [ "warn", {
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
} ],
// Add any additional TypeScript specific rules here
// Optional: Warn about any explicit `null` return
"no-restricted-syntax": [
"warn",
{
selector: "ReturnStatement[argument.type='Literal'][argument.value=null]",
message: "Avoid returning `null`. Consider returning a more meaningful value."
},
{
selector: "ReturnStatement[argument.type='Literal'][argument.value=undefined]",
message: "Avoid returning `undefined`. Consider returning a more meaningful value."
}
]
}
}
];