Skip to content

Commit 120ca06

Browse files
authored
Build: Migrate to the ESLint flat config
Closes gh-610
1 parent 3a5968b commit 120ca06

File tree

6 files changed

+170
-204
lines changed

6 files changed

+170
-204
lines changed

.eslintignore

-5
This file was deleted.

.eslintrc.json

-25
This file was deleted.

app/src/.eslintrc.json

-10
This file was deleted.

eslint.config.mjs

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import jqueryConfig from "eslint-config-jquery";
2+
import globals from "globals";
3+
4+
export default [
5+
{
6+
linterOptions: {
7+
reportUnusedDisableDirectives: "error"
8+
}
9+
},
10+
11+
{
12+
ignores: [
13+
"app/dist/**",
14+
"external/**",
15+
"jquery-ui/**",
16+
"template/**",
17+
"test/fixtures/**",
18+
"tmp/**",
19+
"*.min.js"
20+
]
21+
},
22+
23+
{
24+
languageOptions: {
25+
sourceType: "commonjs",
26+
ecmaVersion: 2022,
27+
parserOptions: {
28+
globalReturn: true
29+
},
30+
globals: {
31+
...globals.es2021,
32+
...globals.node
33+
}
34+
},
35+
rules: {
36+
...jqueryConfig.rules,
37+
strict: [ "error", "global" ],
38+
39+
// Too many violations
40+
"camelcase": "off",
41+
"max-len": "off",
42+
"no-unused-vars": "off"
43+
}
44+
},
45+
46+
{
47+
files: [ "*.mjs" ],
48+
languageOptions: {
49+
sourceType: "module"
50+
}
51+
},
52+
53+
{
54+
files: [ "test/*.js" ],
55+
languageOptions: {
56+
globals: {
57+
...globals.es2021,
58+
...globals.node,
59+
...globals.mocha
60+
}
61+
}
62+
},
63+
64+
{
65+
files: [ "app/src/**/*.js" ],
66+
languageOptions: {
67+
// No need to keep IE support, so we could bump it to ES2022 as well,
68+
// but we need to switch the minifier to something other than UglifJS
69+
// which is ES5-only.
70+
ecmaVersion: 5,
71+
sourceType: "script",
72+
parserOptions: {
73+
globalReturn: false
74+
},
75+
globals: {
76+
...globals.es2021,
77+
...globals.browser,
78+
jQuery: false
79+
}
80+
},
81+
rules: {
82+
"strict": [ "error", "function" ]
83+
}
84+
}
85+
];

0 commit comments

Comments
 (0)