]> git.openstreetmap.org Git - rails.git/blobdiff - config/eslint.js
Create relation version redaction resource
[rails.git] / config / eslint.js
index f21c87938eeaa995b415e003ce07cc0498abb031..6055634aa5a7ef6afab684f4adbb8d988f2a12a6 100644 (file)
@@ -6,6 +6,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 +27,8 @@ module.exports = [
         Cookies: "readonly",
         I18n: "readonly",
         L: "readonly",
-        OSM: "writable",
         Matomo: "readonly",
+        OSM: "writable",
         Turbo: "readonly",
         updateLinks: "readonly"
       }
@@ -35,7 +43,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",
@@ -134,9 +141,11 @@ module.exports = [
       "no-useless-call": "error",
       "no-useless-concat": "error",
       "no-useless-return": "error",
+      "no-var": "error",
       "no-void": "error",
       "no-warning-comments": "warn",
       "operator-assignment": "error",
+      "prefer-const": "error",
       "prefer-object-spread": "error",
       "radix": ["error", "always"],
       "yoda": "error"
@@ -162,6 +171,9 @@ module.exports = [
       globals: {
         ...globals.commonjs
       }
+    },
+    rules: {
+      "sort-keys": ["error", "asc", { minKeys: 5 }]
     }
   }
 ];