【无标题】vue使用eslint报错 1:1 error Parsing error: Unexpected token < Parsing error: The keyword ‘impo
vue3使用eslint后每个组件/文件第一行都报错1:1 error Parsing error: Unexpected token <1:1 error Parsing error: The keyword 'import' is reserved之所以报错是因为eslint配置错了导致解析的时候出错这样的报错是因为自己手贱把eslintrc的配置文件写成了.eslintrc.ts这样e
·
vue3使用eslint后每个组件/文件第一行都报错
1:1 error Parsing error: Unexpected token <
1:1 error Parsing error: The keyword 'import' is reserved
之所以报错是因为eslint配置错了导致解析的时候出错这样的报错是因为自己手贱把eslintrc的配置文件写成了.eslintrc.ts
这样eslint就会报这样的错应该是.eslintrc.js
2.使用vue3要用
'plugin:vue/vue3-essential'
解析
如果还是用了ts那么还要设置
parser: '@typescript-eslint/parser',
下面是我的一些配置
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'plugin:vue/vue3-essential', //这里是个坑
'airbnb-base',
'plugin:prettier/recommended',
'plugin:jest/recommended'
],
parserOptions: {
ecmaVersion: 12,
parser: '@typescript-eslint/parser',
sourceType: 'module'
},
plugins: ['vue', '@typescript-eslint'],
rules: {
'import/no-unresolved': 'off',
'import/extensions': 'off',
'import/no-absolute-path': 'off',
'import/no-extraneous-dependencies': 'off',
'vue/no-multiple-template-root': 'off',
'no-param-reassign': [
'error',
{
props: true,
ignorePropertyModificationsFor: ['state', 'config']
}
]
},
settings: {}
}
更多推荐
已为社区贡献2条内容
所有评论(0)