Skip to content

Commit f970ed7

Browse files
committed
Migrate eslint config
1 parent 5d89bd3 commit f970ed7

File tree

4 files changed

+57
-25
lines changed

4 files changed

+57
-25
lines changed

assets/.eslintrc.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

assets/eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {
2+
defineConfig,
3+
} = require("eslint/config");
4+
5+
const babelParser = require("@babel/eslint-parser");
6+
7+
const {
8+
fixupConfigRules,
9+
fixupPluginRules,
10+
} = require("@eslint/compat");
11+
12+
const globals = require("globals");
13+
const _import = require("eslint-plugin-import");
14+
const js = require("@eslint/js");
15+
16+
const {
17+
FlatCompat,
18+
} = require("@eslint/eslintrc");
19+
20+
const compat = new FlatCompat({
21+
baseDirectory: __dirname,
22+
recommendedConfig: js.configs.recommended,
23+
allConfig: js.configs.all
24+
});
25+
26+
module.exports = defineConfig([{
27+
languageOptions: {
28+
parser: babelParser,
29+
30+
globals: {
31+
...globals.browser,
32+
},
33+
},
34+
35+
extends: fixupConfigRules(compat.extends("eslint:recommended", "plugin:import/warnings", "prettier")),
36+
37+
plugins: {
38+
import: fixupPluginRules(_import),
39+
},
40+
}, {
41+
files: ["test/*.js"],
42+
extends: compat.extends("plugin:jest/recommended"),
43+
}]);

assets/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@babel/plugin-proposal-class-properties": "^7.16.7",
3939
"@babel/plugin-transform-runtime": "^7.18.2",
4040
"@babel/preset-env": "^7.18.2",
41+
"@eslint/compat": "^1.4.0",
4142
"@hotwired/stimulus": "^3.0.1",
4243
"@size-limit/esbuild": "^11.1.4",
4344
"@size-limit/preset-small-lib": "^11.1.4",
@@ -46,6 +47,7 @@
4647
"eslint-config-prettier": "^10.0.0",
4748
"eslint-plugin-import": "^2.27.5",
4849
"eslint-plugin-jest": "^28.0.0",
50+
"globals": "^15.15.0",
4951
"prettier": "^3.0.0",
5052
"sass": "^1.57.1",
5153
"sass-loader": "^16.0.0",

assets/yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,13 @@
11621162
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0"
11631163
integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==
11641164

1165+
"@eslint/compat@^1.4.0":
1166+
version "1.4.0"
1167+
resolved "https://registry.yarnpkg.com/@eslint/compat/-/compat-1.4.0.tgz#6d6b2f198ddfecda3d4cbd5a6e9324fca54f2dfb"
1168+
integrity sha512-DEzm5dKeDBPm3r08Ixli/0cmxr8LkRdwxMRUIJBlSCpAwSrvFEJpVBzV+66JhDxiaqKxnRzCXhtiMiczF7Hglg==
1169+
dependencies:
1170+
"@eslint/core" "^0.16.0"
1171+
11651172
"@eslint/config-array@^0.21.0":
11661173
version "0.21.0"
11671174
resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.21.0.tgz#abdbcbd16b124c638081766392a4d6b509f72636"
@@ -3371,6 +3378,11 @@ globals@^14.0.0:
33713378
resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e"
33723379
integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==
33733380

3381+
globals@^15.15.0:
3382+
version "15.15.0"
3383+
resolved "https://registry.yarnpkg.com/globals/-/globals-15.15.0.tgz#7c4761299d41c32b075715a4ce1ede7897ff72a8"
3384+
integrity sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==
3385+
33743386
globalthis@^1.0.3:
33753387
version "1.0.4"
33763388
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236"

0 commit comments

Comments
 (0)