vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.41k stars 659 forks source link

vue plugin was conflicted #2500

Closed OnlyFlyer closed 6 days ago

OnlyFlyer commented 1 week ago

Checklist

Tell us about your environment

Please show your full configuration:

const { defineConfig } = require('eslint-define-config');
// const ESLintPluginVue = require('eslint-plugin-vue');

module.exports = defineConfig({
  root: true,
  env: {
    browser: true,
    node: true,
    commonjs: true
    // es6: true
  },
  parser: 'vue-eslint-parser',
  extends: ['eslint:recommended', 'plugin:vue/recommended'],
  parserOptions: {
    ecmaVersion: 'latest', 
    sourceType: 'module',
    parser: '@typescript-eslint/parser'
  },
  plugins: ['vue', '@typescript-eslint'],
  globals: {
    Taro: 'readonly',
  },
});

{
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^7.13.1",
    "@typescript-eslint/parser": "^7.13.1",
    "cross-env": "^7.0.3",
    "dotenv": "^16.0.3",
    "eslint": "^8.57.0",
    "eslint-define-config": "^1.5.1",
    "eslint-plugin-vue": "^8.7.1",
    "vue-eslint-parser": "^8.3.0"
  },
  "dependencies": {
    "axios": "^1.6.8",
    "dayjs": "^1.11.10",
    "echarts": "5.4.3",
    "vue-router": "^4.3.2"
  }
}

What did you do?

// .eslintrc.js
const { defineConfig } = require('eslint-define-config');
// const ESLintPluginVue = require('eslint-plugin-vue');

module.exports = defineConfig({
  // use eslint-plugin-vue plugin and recommended
  extends: ['eslint:recommended', 'plugin:vue/recommended'],
  plugins: ['vue', '@typescript-eslint'],
  // other cnfig
});

What did you expect to happen?

eslint-plugin-vue plugin can be work well

What actually happened?

In my windows,have two versions eslint-plugin-vue modules, it leads to use Plugin error,how to assigned eslint-plugin-vue path or version in .eslintrc.js,Hope to reply as soon as possible

Repository to reproduce this issue

[Error - 11:29:11 AM] Error: Plugin "vue" was conflicted between "--config » plugin:vue/recommended » C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\@workplace\eslint-config-wpconfig\node_modules\eslint-plugin-vue\lib\configs\strongly-recommended.js » C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\@workplace\eslint-config-wpconfig\node_modules\eslint-plugin-vue\lib\configs\essential.js » C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\@workplace\eslint-config-wpconfig\node_modules\eslint-plugin-vue\lib\configs\base.js" and ".eslintrc.js » plugin:vue/recommended » D:\my\miniapp\node_modules\eslint-plugin-vue\lib\configs\strongly-recommended.js » D:\my\miniapp\node_modules\eslint-plugin-vue\lib\configs\essential.js » D:\my\miniapp\node_modules\eslint-plugin-vue\lib\configs\base.js".
    at mergePlugins (C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\eslint\lib\cli-engine\config-array\config-array.js:214:19)
    at createConfig (C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\eslint\lib\cli-engine\config-array\config-array.js:317:9)
    at ConfigArray.extractConfig (C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\eslint\lib\cli-engine\config-array\config-array.js:493:33)
    at CLIEngine.isPathIgnored (C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\eslint\lib\cli-engine\cli-engine.js:954:18)
    at CLIEngine.executeOnText (C:\Users\---\AppData\Roaming\nvm\v20.13.1\node_modules\@workplace\cli\node_modules\eslint\lib\cli-engine\cli-engine.js:864:38)
    at q.lintText (c:\Users\---\.vscode\extensions\dbaeumer.vscode-eslint-3.0.10\server\out\eslintServer.js:1:12736)
    at c:\Users\---\.vscode\extensions\dbaeumer.vscode-eslint-3.0.10\server\out\eslintServer.js:1:26989
    at M (c:\Users\---\.vscode\extensions\dbaeumer.vscode-eslint-3.0.10\server\out\eslintServer.js:1:19813)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
FloEdelmann commented 1 week ago

Can you please try without defineConfig? Also, your error stacktrace mentions eslint-config-wpconfig which is not mentioned in your ESLint config or package.json. Do you know where that comes from?

In any case, please upload the whole code to a Stackblitz or GitHub repo, to give us the opportunity to look at everything and debug your issue. But I suspect that it is not caused by eslint-config-vue.

OnlyFlyer commented 1 week ago

Thank you for your reply, i try to without defineConfig,but still not work,my question,if windows exist two version eslint-plugin-vue version plugin,how to specify a vesion ?

OnlyFlyer commented 1 week ago

my project is enormous,so not give demo

FloEdelmann commented 1 week ago

Without further information or (preferably) a minimal production repository, it's impossible for us to find the issue. I already told you anything I can deduce from your description alone.