vue中eslint导致的报错问题及解决
作者:飞得更高肥尾沙鼠
这篇文章主要介绍了vue中eslint导致的报错问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
报错信息
[plugin:vite-plugin-eslint] C:\git_project\xxxxxxxxx\src\views\station\info\InfoForm.vue
54:29 error Delete `⏎` prettier/prettier✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
解决方案
修改.eslintrc.js文件

// @ts-check
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
root: true,
env: {
browser: true,
node: true,
es6: true
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
jsxPragma: 'React',
ecmaFeatures: {
jsx: true
}
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'./.eslintrc-auto-import.json'
],
rules: {
'prettier/prettier': 'off',
"no-irregular-whitespace": "off",
'vue/script-setup-uses-vars': 'error',
'vue/no-reserved-component-names': 'off',
.......
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// 'no-unused-vars': 'error',
"no-unused-vars": 'off',
'space-before-function-paren': 'off',
.......
'vue/multi-word-component-names': 'off'
}
})
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
