]> git.openstreetmap.org Git - rails.git/commitdiff
Move deprecated eslint rules to stylistic plugin
authorHolger Jeromin <mailgithub@katur.de>
Sun, 26 Jan 2025 17:29:14 +0000 (18:29 +0100)
committerHolger Jeromin <h.jeromin@beckhoff.com>
Wed, 5 Feb 2025 14:47:11 +0000 (15:47 +0100)
config/eslint.js
package.json
yarn.lock

index b4d0429e4ae8417db3fbfe4b3324fe721e20fc39..b2c527b7511fffbdb0086274b63ef927c14ec600 100644 (file)
@@ -1,9 +1,13 @@
 const globals = require("globals");
 const js = require("@eslint/js");
+const stylisticJs = require("@stylistic/eslint-plugin-js");
 
 module.exports = [
   js.configs.recommended,
   {
+    plugins: {
+      "@stylistic": stylisticJs
+    },
     languageOptions: {
       ecmaVersion: 2021,
       sourceType: "script",
@@ -21,32 +25,57 @@ module.exports = [
       }
     },
     rules: {
-      "accessor-pairs": "error",
-      "array-bracket-newline": ["error", "consistent"],
-      "array-bracket-spacing": "error",
-      "array-callback-return": "error",
-      "block-scoped-var": "error",
-      "block-spacing": "error",
-      "brace-style": ["error", "1tbs", { allowSingleLine: true }],
-      "comma-dangle": "error",
-      "comma-spacing": "error",
-      "comma-style": "error",
-      "computed-property-spacing": "error",
-      "curly": ["error", "multi-line", "consistent"],
-      "dot-location": ["error", "property"],
-      "dot-notation": "error",
-      "eol-last": "error",
-      "eqeqeq": ["error", "smart"],
-      "func-call-spacing": "error",
-      "indent": ["error", 2, {
+      "@stylistic/array-bracket-newline": ["error", "consistent"],
+      "@stylistic/array-bracket-spacing": "error",
+      "@stylistic/block-spacing": "error",
+      "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
+      "@stylistic/comma-dangle": "error",
+      "@stylistic/comma-spacing": "error",
+      "@stylistic/comma-style": "error",
+      "@stylistic/computed-property-spacing": "error",
+      "@stylistic/dot-location": ["error", "property"],
+      "@stylistic/eol-last": "error",
+      "@stylistic/func-call-spacing": "error",
+      "@stylistic/indent": ["error", 2, {
         SwitchCase: 1,
         VariableDeclarator: "first",
         FunctionDeclaration: { parameters: "first" },
         FunctionExpression: { parameters: "first" },
         CallExpression: { arguments: "first" }
       }],
-      "key-spacing": "error",
-      "keyword-spacing": "error",
+      "@stylistic/key-spacing": "error",
+      "@stylistic/keyword-spacing": "error",
+      "@stylistic/no-floating-decimal": "error",
+      "@stylistic/no-mixed-operators": "error",
+      "@stylistic/no-multiple-empty-lines": "error",
+      "@stylistic/no-multi-spaces": "error",
+      "@stylistic/no-trailing-spaces": "error",
+      "@stylistic/no-whitespace-before-property": "error",
+      "@stylistic/object-curly-newline": ["error", { consistent: true }],
+      "@stylistic/object-curly-spacing": ["error", "always"],
+      "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
+      "@stylistic/operator-linebreak": ["error", "after"],
+      "@stylistic/padded-blocks": ["error", "never"],
+      "@stylistic/quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
+      "@stylistic/quotes": ["error", "double"],
+      "@stylistic/semi": ["error", "always"],
+      "@stylistic/semi-spacing": "error",
+      "@stylistic/semi-style": "error",
+      "@stylistic/space-before-blocks": "error",
+      "@stylistic/space-before-function-paren": ["error", { named: "never" }],
+      "@stylistic/space-in-parens": "error",
+      "@stylistic/space-infix-ops": "error",
+      "@stylistic/space-unary-ops": "error",
+      "@stylistic/switch-colon-spacing": "error",
+      "@stylistic/wrap-iife": "error",
+      "@stylistic/wrap-regex": "error",
+
+      "accessor-pairs": "error",
+      "array-callback-return": "error",
+      "block-scoped-var": "error",
+      "curly": ["error", "multi-line", "consistent"],
+      "dot-notation": "error",
+      "eqeqeq": ["error", "smart"],
       "no-alert": "warn",
       "no-array-constructor": "error",
       "no-caller": "error",
@@ -57,7 +86,6 @@ module.exports = [
       "no-extend-native": "error",
       "no-extra-bind": "error",
       "no-extra-label": "error",
-      "no-floating-decimal": "error",
       "no-implicit-coercion": "warn",
       "no-implicit-globals": "warn",
       "no-implied-eval": "error",
@@ -68,9 +96,6 @@ module.exports = [
       "no-lone-blocks": "error",
       "no-lonely-if": "error",
       "no-loop-func": "error",
-      "no-mixed-operators": "error",
-      "no-multiple-empty-lines": "error",
-      "no-multi-spaces": "error",
       "no-multi-str": "error",
       "no-negated-condition": "error",
       "no-nested-ternary": "error",
@@ -86,7 +111,6 @@ module.exports = [
       "no-self-compare": "error",
       "no-sequences": "error",
       "no-throw-literal": "error",
-      "no-trailing-spaces": "error",
       "no-undef-init": "error",
       "no-undefined": "error",
       "no-unmodified-loop-condition": "error",
@@ -99,26 +123,7 @@ module.exports = [
       "no-use-before-define": ["error", { functions: false }],
       "no-void": "error",
       "no-warning-comments": "warn",
-      "no-whitespace-before-property": "error",
-      "object-curly-newline": ["error", { consistent: true }],
-      "object-curly-spacing": ["error", "always"],
-      "object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
-      "operator-linebreak": ["error", "after"],
-      "padded-blocks": ["error", "never"],
-      "quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
-      "quotes": ["error", "double"],
       "radix": ["error", "always"],
-      "semi": ["error", "always"],
-      "semi-spacing": "error",
-      "semi-style": "error",
-      "space-before-blocks": "error",
-      "space-before-function-paren": ["error", { named: "never" }],
-      "space-in-parens": "error",
-      "space-infix-ops": "error",
-      "space-unary-ops": "error",
-      "switch-colon-spacing": "error",
-      "wrap-iife": "error",
-      "wrap-regex": "error",
       "yoda": "error"
     }
   },
index 82cae94e55435fe5817b3c9e6ea1c6effa72545c..1b331ec96390b42142baeb0e53ca102a3fc0579b 100644 (file)
@@ -10,6 +10,7 @@
   },
   "devDependencies": {
     "eslint": "^9.0.0",
+    "@stylistic/eslint-plugin-js": "^3.0.0",
     "eslint-formatter-compact": "^8.40.0"
   }
 }
index c9bf043b1f19ad2c806c758e5c4e83f6df3af434..fc144d73436325ec27365ee840a60bc83388edea 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
   resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.1.tgz#9a96ce501bc62df46c4031fbd970e3cc6b10f07b"
   integrity sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==
 
+"@stylistic/eslint-plugin-js@^3.0.0":
+  version "3.0.1"
+  resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-3.0.1.tgz#15638c55a9adab2c110243a9f0d812264b067aab"
+  integrity sha512-hjp6BKXSUdlY4l20pDb0EjIB5PtQDGihk2EUKCjJ5gaRVfcmMMkaIyVd/yK3oH7OLxWWBxJ8qSSo+zEdkmpnYA==
+  dependencies:
+    eslint-visitor-keys "^4.2.0"
+    espree "^10.3.0"
+
 "@types/estree@^1.0.6":
   version "1.0.6"
   resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50"