]> git.openstreetmap.org Git - rails.git/blobdiff - config/eslint.js
Merge remote-tracking branch 'upstream/pull/5651'
[rails.git] / config / eslint.js
index f51a1dc474b674a6282dd17ee787361d449892b4..c968d9e9a568efabe1539ac70af6a5e63901bdd0 100644 (file)
@@ -1,3 +1,5 @@
+/* eslint sort-keys: ["error", "asc", {minKeys: 5}] */
+
 const globals = require("globals");
 const js = require("@eslint/js");
 const erb = require("eslint-plugin-erb");
@@ -6,6 +8,14 @@ const stylisticJs = require("@stylistic/eslint-plugin-js");
 module.exports = [
   js.configs.recommended,
   erb.configs.recommended,
+  {
+    ignores: [
+      "app/assets/javascripts/i18n/",
+      "coverage/assets/",
+      "public/assets/",
+      "vendor/"
+    ]
+  },
   {
     plugins: {
       "@stylistic": stylisticJs
@@ -19,8 +29,8 @@ module.exports = [
         Cookies: "readonly",
         I18n: "readonly",
         L: "readonly",
-        OSM: "writable",
         Matomo: "readonly",
+        OSM: "writable",
         Turbo: "readonly",
         updateLinks: "readonly"
       }
@@ -35,7 +45,6 @@ module.exports = [
       reportUnusedDisableDirectives: "off"
     },
     rules: {
-      /* eslint sort-keys: ["warn"] */
       "@stylistic/array-bracket-newline": ["error", "consistent"],
       "@stylistic/array-bracket-spacing": "error",
       "@stylistic/block-spacing": "error",
@@ -56,6 +65,7 @@ module.exports = [
       }],
       "@stylistic/key-spacing": "error",
       "@stylistic/keyword-spacing": "error",
+      "@stylistic/max-statements-per-line": "error",
       "@stylistic/no-floating-decimal": "error",
       "@stylistic/no-mixed-operators": "error",
       "@stylistic/no-multi-spaces": "error",
@@ -65,6 +75,7 @@ module.exports = [
       "@stylistic/object-curly-newline": ["error", { consistent: true }],
       "@stylistic/object-curly-spacing": ["error", "always"],
       "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
+      "@stylistic/one-var-declaration-per-line": "error",
       "@stylistic/operator-linebreak": ["error", "after"],
       "@stylistic/padded-blocks": ["error", "never"],
       "@stylistic/quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
@@ -92,6 +103,7 @@ module.exports = [
       "no-caller": "error",
       "no-console": "warn",
       "no-div-regex": "error",
+      "no-else-return": ["error", { allowElseIf: false }],
       "no-eq-null": "error",
       "no-eval": "error",
       "no-extend-native": "error",
@@ -133,6 +145,8 @@ module.exports = [
       "no-useless-return": "error",
       "no-void": "error",
       "no-warning-comments": "warn",
+      "operator-assignment": "error",
+      "prefer-object-spread": "error",
       "radix": ["error", "always"],
       "yoda": "error"
     }