-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (93 loc) · 2.32 KB
/
eslint.config.js
File metadata and controls
98 lines (93 loc) · 2.32 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
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import globals from "globals";
import stylistic from "@stylistic/eslint-plugin";
// Common language options
const commonLanguageOptions = {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.node,
...globals.es2022
}
};
// Common rules for all file types
const commonRules = {
"no-console": "warn",
"prefer-const": "error",
"no-var": "error"
};
// Common stylistic rules
const commonStylisticRules = {
"@stylistic/array-bracket-spacing": [ "error", "always", { singleValue: true } ],
"@stylistic/comma-dangle": [ "error", "never" ],
"@stylistic/comma-spacing": [ "error", { before: false, after: true } ],
"@stylistic/eol-last": [ "error", "always" ],
"@stylistic/indent": [ "error", "tab" ],
"@stylistic/linebreak-style": [ "error", "unix" ],
"@stylistic/no-multiple-empty-lines": [ "error", { max: 1 } ],
"@stylistic/no-trailing-spaces": [ "error" ],
"@stylistic/object-curly-spacing": [ "error", "always" ],
"@stylistic/quotes": [ "error", "double" ],
"@stylistic/semi": [ "error", "always" ],
"@stylistic/space-before-function-paren": [ "error", {
anonymous: "always",
named: "never",
asyncArrow: "always"
} ],
"@stylistic/space-in-parens": [ "error", "always" ],
"@stylistic/template-curly-spacing": [ "error", "always" ]
};
// TypeScript-specific rules
const typeScriptRules = {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-inferrable-types": "error"
};
export default [
js.configs.recommended,
{
files: [ "**/*.{ts,tsx}" ],
languageOptions: {
...commonLanguageOptions,
parser: tsparser,
parserOptions: {
...commonLanguageOptions,
project: [
"./tsconfig.json",
"./apps/*/tsconfig.json"
]
}
},
plugins: {
"@typescript-eslint": tseslint,
"@stylistic": stylistic
},
rules: {
...commonRules,
...typeScriptRules,
...commonStylisticRules
}
},
{
files: [ "**/*.js", "**/*.mjs" ],
languageOptions: commonLanguageOptions,
plugins: {
"@stylistic": stylistic
},
rules: {
"no-unused-vars": "error",
...commonRules,
...commonStylisticRules
}
},
{
ignores: [
"node_modules/",
"**/dist/",
"**/build/",
"coverage/"
]
}
];