-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy patheslint.config.mjs
More file actions
127 lines (104 loc) · 3.06 KB
/
eslint.config.mjs
File metadata and controls
127 lines (104 loc) · 3.06 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import eslint from "@eslint/js";
import globals from "globals";
import stylistic from "@stylistic/eslint-plugin";
import tseslint from "typescript-eslint";
const sharedOptions = {
js: {
files: ["**/*.{js,mjs}"],
languageOptions: {
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
...globals.webextensions,
},
},
},
ts: {
files: ["**/*.ts"],
languageOptions: {
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
...globals.webextensions,
},
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
},
},
},
};
const overrides = {
js: {
...sharedOptions.js,
name: "web-eid/js/override",
plugins: { "@stylistic/js": stylistic },
rules: {
"sort-imports": ["error", { allowSeparatedGroups: true }],
"@stylistic/js/quotes": ["error", "double"],
"@stylistic/js/key-spacing": ["error", { "align": "value" }],
"@stylistic/js/comma-dangle": ["error", "always-multiline"],
"@stylistic/js/object-curly-spacing": ["error", "always"],
"@stylistic/js/array-bracket-spacing": "error",
"@stylistic/js/indent": ["error", 2, { "SwitchCase": 1 }],
"@stylistic/js/semi": "error",
"@stylistic/js/eol-last": ["warn", "always"],
"@stylistic/js/linebreak-style": ["error", "unix"],
"@stylistic/js/max-len": ["error", { code: 160 }],
},
},
ts: {
...sharedOptions.ts,
name: "web-eid/ts/override",
plugins: {
"@typescript-eslint": tseslint.plugin,
"@stylistic/ts": stylistic,
},
rules: {
"@typescript-eslint/array-type": ["error", { default: "generic" }],
"@stylistic/ts/semi": "error",
"@stylistic/ts/quotes": ["error", "double"],
"@stylistic/ts/comma-dangle": ["error", "always-multiline"],
"@stylistic/ts/object-curly-spacing": ["error", "always"],
"@stylistic/ts/indent": ["error", 2, { "SwitchCase": 1 }],
"@stylistic/ts/eol-last": ["error", "always"],
"@stylistic/ts/linebreak-style": ["error", "unix"],
"@stylistic/ts/max-len": ["error", { code: 160 }],
},
},
};
export default [
{
ignores: [
"dist/",
"node_modules/",
"examples/",
"web-eid.*",
"config.*",
"errors/",
"models/",
"services/",
"utils/",
],
},
{
name: "eslint/recommended",
...eslint.configs.recommended,
...sharedOptions.js,
},
...tseslint.configs.recommendedTypeChecked.map((recommended) => ({
...recommended,
...sharedOptions.ts,
})),
...tseslint.configs.stylisticTypeChecked.map((stylistic) => ({
...stylistic,
...sharedOptions.ts,
})),
overrides.js,
overrides.ts,
];