]> git.openstreetmap.org Git - rails.git/blobdiff - config/eslint.js
Move eslint ignore rules to the configuration file
[rails.git] / config / eslint.js
index b2c527b7511fffbdb0086274b63ef927c14ec600..1bf65695b6e24473fc10d250c9ef6356c07794f7 100644 (file)
@@ -1,9 +1,19 @@
 const globals = require("globals");
 const js = require("@eslint/js");
+const erb = require("eslint-plugin-erb");
 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,11 +29,19 @@ module.exports = [
         L: "readonly",
         OSM: "writable",
         Matomo: "readonly",
-        Qs: "readonly",
         Turbo: "readonly",
         updateLinks: "readonly"
       }
     },
+    linterOptions: {
+      // The "unused disable directive" is set to "warn" by default.
+      // For the ERB plugin to work correctly, you must disable
+      // this directive to avoid issues described here
+      // https://github.com/eslint/eslint/discussions/18114
+      // If you're using the CLI, you might also use the following flag:
+      // --report-unused-disable-directives-severity=off
+      reportUnusedDisableDirectives: "off"
+    },
     rules: {
       "@stylistic/array-bracket-newline": ["error", "consistent"],
       "@stylistic/array-bracket-spacing": "error",
@@ -76,7 +94,7 @@ module.exports = [
       "curly": ["error", "multi-line", "consistent"],
       "dot-notation": "error",
       "eqeqeq": ["error", "smart"],
-      "no-alert": "warn",
+      "no-alert": "error",
       "no-array-constructor": "error",
       "no-caller": "error",
       "no-console": "warn",
@@ -87,7 +105,7 @@ module.exports = [
       "no-extra-bind": "error",
       "no-extra-label": "error",
       "no-implicit-coercion": "warn",
-      "no-implicit-globals": "warn",
+      "no-implicit-globals": "error",
       "no-implied-eval": "error",
       "no-invalid-this": "error",
       "no-iterator": "error",
@@ -101,11 +119,10 @@ module.exports = [
       "no-nested-ternary": "error",
       "no-new": "error",
       "no-new-func": "error",
-      "no-new-object": "error",
       "no-new-wrappers": "error",
+      "no-object-constructor": "error",
       "no-octal-escape": "error",
       "no-param-reassign": "error",
-      "no-process-env": "error",
       "no-proto": "error",
       "no-script-url": "error",
       "no-self-compare": "error",