]> git.openstreetmap.org Git - rails.git/commitdiff
Migrate eslint config to esmodules
authorHolger Jeromin <h.jeromin@beckhoff.com>
Wed, 19 Feb 2025 08:44:40 +0000 (09:44 +0100)
committerHolger Jeromin <h.jeromin@beckhoff.com>
Wed, 19 Feb 2025 08:54:07 +0000 (09:54 +0100)
And upgrade `@stylistic/eslint-plugin-js` to `4.0.x`

closes #5704

.overcommit.yml
.vscode/settings.json
config/eslint.config.mjs [moved from config/eslint.js with 94% similarity]
lib/tasks/eslint.rake
package.json
yarn.lock

index eab8eb2ae90e02dff71964c8710457473be82439..18bd5851f4526d8850cd736180fd80c027cfcdaa 100644 (file)
@@ -22,7 +22,7 @@ PreCommit:
     enabled: true
   EsLint:
     enabled: true
-    command: ["bin/yarn", "eslint", "-c", "config/eslint.js"]
+    command: ["bin/yarn", "eslint", "-c", "config/eslint.config.mjs"]
     exclude:
       - vendor/**/*.js
   RailsSchemaUpToDate:
index 8a3d341d48ce67d2541e9255b90bc5d7b6c18729..3545f07279b2b802c2be21b034336862152aa504 100644 (file)
@@ -1,5 +1,5 @@
 {
   "eslint.options": {
-    "overrideConfigFile": "config/eslint.js"
+    "overrideConfigFile": "config/eslint.config.mjs"
   }
 }
similarity index 94%
rename from config/eslint.js
rename to config/eslint.config.mjs
index 6055634aa5a7ef6afab684f4adbb8d988f2a12a6..d695f0131db7b1f916cf42c64514ce64806f1dbe 100644 (file)
@@ -1,9 +1,9 @@
-const globals = require("globals");
-const js = require("@eslint/js");
-const erb = require("eslint-plugin-erb");
-const stylisticJs = require("@stylistic/eslint-plugin-js");
+import globals from "globals";
+import js from "@eslint/js";
+import erb from "eslint-plugin-erb";
+import stylisticJs from "@stylistic/eslint-plugin-js";
 
-module.exports = [
+export default [
   js.configs.recommended,
   erb.configs.recommended,
   {
@@ -164,13 +164,9 @@ module.exports = [
     }
   },
   {
-    files: ["config/eslint.js"],
+    files: ["config/eslint.config.mjs"],
     languageOptions: {
-      ecmaVersion: 2019,
-      sourceType: "commonjs",
-      globals: {
-        ...globals.commonjs
-      }
+      sourceType: "module"
     },
     rules: {
       "sort-keys": ["error", "asc", { minKeys: 5 }]
index 17f28a4e9cb4ef134a4ac205690159499ff3b9ad..8a8d7c8a44cf65da918491d5f187c39a535a316a 100644 (file)
@@ -5,7 +5,7 @@ def yarn_path
 end
 
 def config_file
-  Rails.root.join("config/eslint.js").to_s
+  Rails.root.join("config/eslint.config.mjs").to_s
 end
 
 namespace "eslint" do
index f4eacf962b456f837bcc8d4c50157786533a0d86..f8eac3db914233eda8262f34e18f2a05cd80be97 100644 (file)
@@ -9,11 +9,11 @@
     "osm-community-index": "^5.2.0"
   },
   "devDependencies": {
-    "@types/jquery": "^3.5.32",
-    "@types/leaflet": "^1.9.16",
+    "@types/jquery": "^3.5.0",
+    "@types/leaflet": "^1.9.0",
     "eslint": "^9.0.0",
     "eslint-plugin-erb": "^2.1.0",
-    "@stylistic/eslint-plugin-js": "^3.0.0",
+    "@stylistic/eslint-plugin-js": "^4.0.0",
     "eslint-formatter-compact": "^8.40.0"
   }
 }
index 10dff40232e92f9b02027b6cf7ec8fa631574f81..71a706e4590dd048c5a612aa0eeb4454abe80f96 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.1.0"
-  resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-3.1.0.tgz#b36292b09bd810ea1b34e0720512f137335ef745"
-  integrity sha512-lQktsOiCr8S6StG29C5fzXYxLOD6ID1rp4j6TRS+E/qY1xd59Fm7dy5qm9UauJIEoSTlYx6yGsCHYh5UkgXPyg==
+"@stylistic/eslint-plugin-js@^4.0.0":
+  version "4.0.1"
+  resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-4.0.1.tgz#c55e59ad2f00914f9eb103ba9e7be00aff7715dd"
+  integrity sha512-2EGKM6WHnZSidWKCu6ePJCqdpgWiEU1Bt26ktWEfTpCmRP+2vRQ6ViK8X6DLwu4+F0zPLy/Txe2HhI3qJFUvqA==
   dependencies:
     eslint-visitor-keys "^4.2.0"
     espree "^10.3.0"
   resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.16.tgz#8ebe53d69efada7044454e3305c19017d97ced2a"
   integrity sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==
 
-"@types/jquery@^3.5.32":
+"@types/jquery@^3.5.0":
   version "3.5.32"
   resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.5.32.tgz#3eb0da20611b92c7c49ebed6163b52a4fdc57def"
   integrity sha512-b9Xbf4CkMqS02YH8zACqN1xzdxc3cO735Qe5AbSUFmyOiaWAbcpqh9Wna+Uk0vgACvoQHpWDg2rGdHkYPLmCiQ==
   resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
   integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
 
-"@types/leaflet@^1.9.16":
+"@types/leaflet@^1.9.0":
   version "1.9.16"
   resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.9.16.tgz#3e3abc103e106523cde01625057e2294f332ec3b"
   integrity sha512-wzZoyySUxkgMZ0ihJ7IaUIblG8Rdc8AbbZKLneyn+QjYsj5q1QU7TEKYqwTr10BGSzY5LI7tJk9Ifo+mEjdFRw==