diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 6714fd420..000000000 --- a/.eslintrc +++ /dev/null @@ -1,57 +0,0 @@ -{ - "parser": "@babel/eslint-parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "requireConfigFile": false, - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "env": { - "browser": true, - "commonjs": true, - "es6": true, - "jquery": true, - "jest/globals": true - }, - "extends": [ - "standard", - "standard-jsx", - "plugin:jsx-a11y/recommended", - "plugin:react/recommended", - "plugin:import/recommended", - "plugin:n/recommended", - "plugin:react-hooks/recommended", - "plugin:promise/recommended" - ], - "rules": { - "jsx-quotes": [2, "prefer-double"], - "jsx-a11y/no-onchange": "off", - "react/prop-types": "off", - "n/no-missing-require": "off", - "n/no-unsupported-features/es-syntax": "off", - "n/no-missing-import": "off", - "n/no-unpublished-import": "off", - "n/no-extraneous-import": "off", - "no-restricted-syntax": ["error", "TemplateLiteral"] - }, - "plugins": [ - "jsx-a11y", - "jest", - "promise" - ], - "ignorePatterns": [ - "node_modules/", - "venv/" - ], - "settings": { - "import/core-modules": [ django ], - "import/resolver": { - "node": { - "extensions": [".js", ".jsx"] - } - } - } -} - diff --git a/adhocracy4/comments_async/static/comments_async/comment.jsx b/adhocracy4/comments_async/static/comments_async/comment.jsx index 55c800828..8e0382f17 100644 --- a/adhocracy4/comments_async/static/comments_async/comment.jsx +++ b/adhocracy4/comments_async/static/comments_async/comment.jsx @@ -207,20 +207,24 @@ export default class Comment extends React.Component { comment = (
{this.props.is_moderator_marked - ? + ? ( + + + {content} + + + ) + : ( {content} - // eslint-disable-line react/jsx-closing-tag-location - : - {content} - /* eslint-disable-line react/jsx-closing-tag-location */} + )}
) } diff --git a/adhocracy4/comments_async/static/comments_async/filter_category.jsx b/adhocracy4/comments_async/static/comments_async/filter_category.jsx index 435d90a03..2d4803d4a 100644 --- a/adhocracy4/comments_async/static/comments_async/filter_category.jsx +++ b/adhocracy4/comments_async/static/comments_async/filter_category.jsx @@ -40,6 +40,6 @@ export const FilterCategory = ({ })} - // eslint-disable-line react/jsx-closing-tag-location + ) } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..54f3c4533 --- /dev/null +++ b/eslint.config.mjs @@ -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"], + }, + }, + }, + }, +]; diff --git a/package.json b/package.json index 06ae87f5a..8f5bd4fe8 100644 --- a/package.json +++ b/package.json @@ -36,34 +36,32 @@ "@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.6.3", "@testing-library/react": "15.0.7", - "eslint": "8.57.1", - "eslint-config-standard": "17.1.0", - "eslint-config-standard-jsx": "11.0.0", + "eslint": "9.15.0", "eslint-plugin-import": "2.31.0", - "eslint-plugin-jest": "27.9.0", + "eslint-plugin-jest": "28.9.0", "eslint-plugin-jsx-a11y": "6.10.2", - "eslint-plugin-n": "16.6.2", - "eslint-plugin-promise": "6.6.0", - "eslint-plugin-react": "7.37.2", - "eslint-plugin-react-hooks": "4.6.2", + "eslint-plugin-react-hooks": "5.0.0", "esquery": "1.6.0", + "globals": "15.12.0", "husky": "9.1.7", "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 .", + "lint-fix": "eslint --fix adhocracy4", "prepare": "husky", "test": "jest", "testDebug": "jest -o --coverage=false",