Skip to content

Commit 95e5a22

Browse files
committed
replace deprecated .eslintrc with eslint.config.mjs
I tried to include all the rules and plugins from the old config as far as they are compatible with eslint 9. eslint-config-standard and eslint-config-standard-react seem to be dead and have been forked into neoconfig.The promise and n plugin is included in neoconfig afaik and doesn't need to be added explicitly.
1 parent 209b30f commit 95e5a22

File tree

3 files changed

+55
-64
lines changed

3 files changed

+55
-64
lines changed

.eslintrc

-57
This file was deleted.

eslint.config.mjs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import globals from "globals";
2+
import hooksPlugin from "eslint-plugin-react-hooks";
3+
import importPlugin from "eslint-plugin-import";
4+
import jsxA11y from "eslint-plugin-jsx-a11y";
5+
import pluginJest from "eslint-plugin-jest";
6+
import pluginJs from "@eslint/js";
7+
import neostandard, { plugins } from "neostandard";
8+
9+
export default [
10+
...neostandard(),
11+
jsxA11y.flatConfigs.recommended,
12+
importPlugin.flatConfigs.recommended,
13+
{
14+
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx,jest.jsx,jest.js}"],
15+
ignores: ["node_modules/", "venv/", "static/"],
16+
languageOptions: {
17+
...jsxA11y.flatConfigs.recommended.languageOptions,
18+
globals: {
19+
...globals.browser,
20+
...pluginJest.environments.globals.globals,
21+
...globals.jquery,
22+
},
23+
ecmaVersion: "latest",
24+
parserOptions: {
25+
ecmaFeatures: {
26+
jsx: true,
27+
"experimentalObjectRestSpread": true,
28+
},
29+
},
30+
},
31+
plugins: {
32+
jest: pluginJest,
33+
"react-hooks": hooksPlugin,
34+
},
35+
rules: {
36+
"no-restricted-syntax": ["error", "TemplateLiteral"],
37+
"jsx-a11y/no-onchange": "off",
38+
"@stylistic/jsx-quotes": [2, "prefer-double"],
39+
...hooksPlugin.configs.recommended.rules,
40+
},
41+
settings: {
42+
"import/core-modules": ["django"],
43+
"import/resolver": {
44+
node: {
45+
extensions: [".js", ".jsx"],
46+
},
47+
},
48+
},
49+
},
50+
];

package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,30 @@
3636
"@babel/plugin-transform-runtime": "7.25.9",
3737
"@babel/preset-env": "7.26.0",
3838
"@babel/preset-react": "7.25.9",
39+
"@eslint/js": "9.13.0",
3940
"@maplibre/maplibre-gl-leaflet": "0.0.22",
4041
"@react-leaflet/core": "^2.1.0",
4142
"@testing-library/jest-dom": "6.4.8",
4243
"@testing-library/react": "15.0.7",
4344
"eslint": "9.15.0",
44-
"eslint-config-standard": "17.1.0",
45-
"eslint-config-standard-jsx": "11.0.0",
4645
"eslint-plugin-import": "2.31.0",
4746
"eslint-plugin-jest": "28.9.0",
4847
"eslint-plugin-jsx-a11y": "6.10.2",
49-
"eslint-plugin-n": "17.14.0",
50-
"eslint-plugin-promise": "7.2.1",
51-
"eslint-plugin-react": "7.37.2",
5248
"eslint-plugin-react-hooks": "5.0.0",
5349
"esquery": "1.6.0",
50+
"globals": "15.12.0",
5451
"husky": "9.0.11",
5552
"jest": "29.7.0",
5653
"jest-environment-jsdom": "29.7.0",
57-
"lint-staged": "15.2.10"
54+
"lint-staged": "15.2.10",
55+
"neostandard": "0.11.7"
5856
},
5957
"repository": {
6058
"type": "git",
6159
"url": "[email protected]:liqd/adhocracy4.git"
6260
},
6361
"scripts": {
64-
"lint": "eslint adhocracy4 --ext .js,.jsx",
62+
"lint": "eslint adhocracy4",
6563
"lint-staged": "lint-staged",
6664
"lint-fix": "eslint --fix --ext .js,.jsx .",
6765
"prepare": "husky",

0 commit comments

Comments
 (0)