From 6ff8b5fa5efad9fbc4fea7fab726a1537d7c24b3 Mon Sep 17 00:00:00 2001 From: Julian Dehm Date: Wed, 30 Oct 2024 15:41:22 +0100 Subject: [PATCH] migrate eslint config to new format, replace broken standard library with neostandard --- .eslintrc | 44 -------------------------------------------- eslint.config.mjs | 25 +++++++++++++++++++++++++ package.json | 14 +++++++++----- 3 files changed, 34 insertions(+), 49 deletions(-) delete mode 100644 .eslintrc create mode 100644 eslint.config.mjs diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 58273aa4..00000000 --- a/.eslintrc +++ /dev/null @@ -1,44 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "requireConfigFile": false, - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "env": { - "browser": true, - "es6": true - }, - "extends": [ - "standard", - "plugin:import/recommended", - "plugin:n/recommended" - ], - "rules": { - "jsx-quotes": [2, "prefer-double"], - "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": [ - "promise" - ], - "ignorePatterns": [ - "node_modules/", - "venv/", - "static/" - ], - "settings": { - "import/core-modules": [ django ], - "import/resolver": { - "node": { - "extensions": [".js", ".jsx"] - } - } - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..8527273a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; +import promise from "eslint-plugin-promise"; +import neostandard from 'neostandard' + +export default [ + ...neostandard(), + { + ignores: [ + "node_modules/", + "venv/", + "static/" + ], + languageOptions: { globals: globals.browser }, + plugins: { + promise: promise, + }, + rules: { + "no-restricted-syntax": ["error", "TemplateLiteral"], + }, + settings: { + "import/core-modules": ["django"], + }, + }, +]; diff --git a/package.json b/package.json index b51a5fd6..78df2f94 100644 --- a/package.json +++ b/package.json @@ -5,22 +5,23 @@ "type": "git", "url": "https://github.com/liqd/digitalstrategie.git" }, - "dependencies": { - }, "devDependencies": { "@babel/core": "7.26.0", "@babel/preset-env": "7.26.0", + "@eslint/js": "9.13.0", "autoprefixer": "10.4.20", "babel-loader": "9.2.1", "copy-webpack-plugin": "12.0.2", "css-loader": "7.1.2", "eslint": "9.13.0", - "eslint-config-standard": "17.1.0", "eslint-plugin-import": "2.31.0", "eslint-plugin-promise": "7.1.0", + "glob": "11.0.0", + "globals": "15.11.0", "husky": "9.1.6", "lint-staged": "15.2.10", "mini-css-extract-plugin": "2.9.1", + "neostandard": "0.11.7", "path-browserify": "1.0.1", "postcss": "8.4.47", "postcss-loader": "8.1.1", @@ -38,13 +39,16 @@ "build:prod": "webpack --config webpack.prod.js --mode production", "build": "webpack --config webpack.dev.js --mode development", "watch": "webpack --config webpack.dev.js --watch --mode development", - "lint": "stylelint 'digitalstrategie/assets/scss/**/*.scss'", - "lint-fix": "stylelint --fix 'digitalstrategie/assets/scss/**/*.scss'", + "lint": "eslint apps && stylelint 'digitalstrategie/assets/scss/**/*.scss'", + "lint-fix": "eslint --fix stylelint --fix 'digitalstrategie/assets/scss/**/*.scss'", "lint-staged": "lint-staged", "postinstall": "husky install" }, "browserslist": "defaults and not dead and >= 0.5%, ie >= 11", "lint-staged": { + "*.{js,jsx}": [ + "eslint" + ], "*.scss": [ "stylelint" ],