From 0a0855967b6c3966f634aaedbcd2cb1eec5d23b5 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Thu, 3 Aug 2023 09:22:55 +0200 Subject: [PATCH] Fix vue config --- eslint.base.config.js | 30 ++++++++++++++++------------- package-lock.json | 3 ++- package.json | 3 ++- test-lint/{vue.vue => vue-file.vue} | 0 test/rules.test.js | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) rename test-lint/{vue.vue => vue-file.vue} (100%) diff --git a/eslint.base.config.js b/eslint.base.config.js index 8180315..33bc14c 100644 --- a/eslint.base.config.js +++ b/eslint.base.config.js @@ -19,6 +19,7 @@ const standard = require("eslint-plugin-standard"); const typescriptEslint = require("@typescript-eslint/eslint-plugin"); const unicorn = require("eslint-plugin-unicorn"); const vue = require("eslint-plugin-vue"); +const vueParser = require("vue-eslint-parser"); const eslintrcBase = require("./.eslintrc.base"); module.exports = [ @@ -61,19 +62,6 @@ module.exports = [ }, rules: unicorn.configs.recommended.rules, }, - { - files: ["**/*.vue"], - processor: vue.processors[".vue"], - plugins: { - vue, - }, - rules: { - ...vue.configs.base.rules, - ...vue.configs.essential.rules, - ...vue.configs["strongly-recommended"].rules, - ...vue.configs.recommended.rules, - }, - }, { languageOptions: { ecmaVersion: eslintrcBase.parserOptions.ecmaVersion, @@ -97,6 +85,22 @@ module.exports = [ rules: eslintrcBase.rules, settings: eslintrcBase.settings, }, + { + files: ["**/*.vue"], + processor: vue.processors[".vue"], + languageOptions: { + parser: vueParser, + }, + plugins: { + vue, + }, + rules: { + ...vue.configs.base.rules, + ...vue.configs.essential.rules, + ...vue.configs["strongly-recommended"].rules, + ...vue.configs.recommended.rules, + }, + }, ...eslintrcBase.overrides.map(({ parserOptions, ...override }) => ({ ...override, languageOptions: { parser: require(parserOptions.parser) }, diff --git a/package-lock.json b/package-lock.json index 434f58a..359e998 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "globals": "13.20.0", "jest": "29.6.2", "prettier": "3.0.0", - "typescript": "5.1.6" + "typescript": "5.1.6", + "vue-eslint-parser": "9.3.1" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 200d87a..002329a 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "globals": "13.20.0", "jest": "29.6.2", "prettier": "3.0.0", - "typescript": "5.1.6" + "typescript": "5.1.6", + "vue-eslint-parser": "9.3.1" } } diff --git a/test-lint/vue.vue b/test-lint/vue-file.vue similarity index 100% rename from test-lint/vue.vue rename to test-lint/vue-file.vue diff --git a/test/rules.test.js b/test/rules.test.js index e91b698..105c58c 100644 --- a/test/rules.test.js +++ b/test/rules.test.js @@ -91,7 +91,7 @@ describe("all plugins have tests in test-lint/", () => { test(plugin, () => { const testFileName = plugin === "vue" - ? "vue.vue" + ? "vue-file.vue" : plugin === "@typescript-eslint" ? `${plugin}.ts` : `${plugin}.js`;