Skip to content

Commit

Permalink
replace deprecated .eslintrc with eslint.config.mjs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
goapunk committed Nov 27, 2024
1 parent 209b30f commit 95e5a22
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 64 deletions.
57 changes: 0 additions & 57 deletions .eslintrc

This file was deleted.

50 changes: 50 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import globals from "globals";
import hooksPlugin from "eslint-plugin-react-hooks";
import importPlugin from "eslint-plugin-import";
import jsxA11y from "eslint-plugin-jsx-a11y";
import pluginJest from "eslint-plugin-jest";
import pluginJs from "@eslint/js";
import neostandard, { plugins } from "neostandard";

export default [
...neostandard(),
jsxA11y.flatConfigs.recommended,
importPlugin.flatConfigs.recommended,
{
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx,jest.jsx,jest.js}"],
ignores: ["node_modules/", "venv/", "static/"],
languageOptions: {
...jsxA11y.flatConfigs.recommended.languageOptions,
globals: {
...globals.browser,
...pluginJest.environments.globals.globals,
...globals.jquery,
},
ecmaVersion: "latest",
parserOptions: {
ecmaFeatures: {
jsx: true,
"experimentalObjectRestSpread": true,
},
},
},
plugins: {
jest: pluginJest,
"react-hooks": hooksPlugin,
},
rules: {
"no-restricted-syntax": ["error", "TemplateLiteral"],
"jsx-a11y/no-onchange": "off",
"@stylistic/jsx-quotes": [2, "prefer-double"],
...hooksPlugin.configs.recommended.rules,
},
settings: {
"import/core-modules": ["django"],
"import/resolver": {
node: {
extensions: [".js", ".jsx"],
},
},
},
},
];
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,30 @@
"@babel/plugin-transform-runtime": "7.25.9",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.25.9",
"@eslint/js": "9.13.0",
"@maplibre/maplibre-gl-leaflet": "0.0.22",
"@react-leaflet/core": "^2.1.0",
"@testing-library/jest-dom": "6.4.8",
"@testing-library/react": "15.0.7",
"eslint": "9.15.0",
"eslint-config-standard": "17.1.0",
"eslint-config-standard-jsx": "11.0.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.9.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-n": "17.14.0",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.0.0",
"esquery": "1.6.0",
"globals": "15.12.0",
"husky": "9.0.11",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"lint-staged": "15.2.10"
"lint-staged": "15.2.10",
"neostandard": "0.11.7"
},
"repository": {
"type": "git",
"url": "git@github.com:liqd/adhocracy4.git"
},
"scripts": {
"lint": "eslint adhocracy4 --ext .js,.jsx",
"lint": "eslint adhocracy4",
"lint-staged": "lint-staged",
"lint-fix": "eslint --fix --ext .js,.jsx .",
"prepare": "husky",
Expand Down

0 comments on commit 95e5a22

Please sign in to comment.