From bb2de0f56789f19be92dda03c458d9573832b092 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 4 Feb 2025 14:13:26 +0200 Subject: [PATCH] migrate to eslint 9 --- .eslintignore | 2 -- .eslintrc.js | 27 --------------------------- eslint.config.mjs | 37 +++++++++++++++++++++++++++++++++++++ package.json | 5 +++-- yarn.lock | 5 +++++ 5 files changed, 45 insertions(+), 31 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 34af3774f..000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -build/*.js -config/*.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 361cff5f2..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - parser: '@babel/eslint-parser', - sourceType: 'module' - }, - // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style - extends: [ - 'standard', - 'plugin:vue/recommended' - ], - // required to lint *.vue files - plugins: [ - 'vue' - ], - // add your custom rules here - rules: { - // allow paren-less arrow functions - 'arrow-parens': 0, - // allow async-await - 'generator-star-spacing': 0, - // allow debugger during development - 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, - 'vue/require-prop-types': 0, - 'vue/multi-word-component-names': 0 - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..c103904aa --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +import vue from "eslint-plugin-vue"; +import js from "@eslint/js"; +import globals from "globals"; + + +export default [ + ...vue.configs['flat/recommended'], + js.configs.recommended, + { + files: ["**/*.js", "**/*.mjs", "**/*.vue"], + ignores: ["build/*.js", "config/*.js"], + + languageOptions: { + ecmaVersion: 2024, + sourceType: "module", + + parserOptions: { + parser: "@babel/eslint-parser", + }, + globals: { + ...globals.browser, + ...globals.mocha, + ...globals.chai, + ...globals.commonjs, + ...globals.serviceworker + } + }, + + rules: { + 'arrow-parens': 0, + 'generator-star-spacing': 0, + 'no-debugger': 0, + 'vue/require-prop-types': 0, + 'vue/multi-word-component-names': 0, + } + } +] diff --git a/package.json b/package.json index 6383e35d6..006683da9 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "e2e": "node test/e2e/runner.js", "test": "yarn run unit && yarn run e2e", "stylelint": "yarn exec stylelint '**/*.scss' '**/*.vue'", - "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", - "lint-fix": "eslint --fix --ext .js,.vue src test/unit/specs test/e2e/specs" + "lint": "eslint src test/unit/specs test/e2e/specs", + "lint-fix": "eslint --fix src test/unit/specs test/e2e/specs" }, "dependencies": { "@babel/runtime": "7.26.7", @@ -32,6 +32,7 @@ "click-outside-vue3": "4.0.1", "cropperjs": "1.6.2", "escape-html": "1.0.3", + "globals": "^15.14.0", "hash-sum": "^2.0.0", "js-cookie": "3.0.5", "localforage": "1.10.0", diff --git a/yarn.lock b/yarn.lock index 02516e921..0be868afc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4337,6 +4337,11 @@ globals@^14.0.0: resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== +globals@^15.14.0: + version "15.14.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.14.0.tgz#b8fd3a8941ff3b4d38f3319d433b61bbb482e73f" + integrity sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig== + globalthis@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236"