关于Eslint语法检查报“Expected indentation of 6 spaces but found 12” 错误的解决办法
运行Vue项目时如果发生Eslint语法检查报错,输出报错内容举例:Expected indentation of 6 spaces but found 12,可能会是一堆,让人很头疼,如下图所示:这个问题的解决办法:在Vue项目文件夹里找到“.eslintrc.js”文件并打开,其内容如下:module.exports = {root: true,env: {node: true},extend
1、“Expected indentation of 6 spaces but found 12”错误
运行Vue项目时如果发生Eslint语法检查报错,输出报错内容举例:
Expected indentation of 6 spaces but found 12,可能会是一堆,让人很头疼,如下图所示:
2、这个问题的解决办法:
在Vue项目文件夹里找到“.eslintrc.js”文件并打开,其内容可能如下所示:
module.exports = { root: true, env: { node: true }, extends: [ 'plugin:vue/vue3-essential', '@vue/standard' ], parserOptions: { parser: '@babel/eslint-parser' }, rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' } } |
在其“rules”内增加新规则,首先在图上的输出报错信息的右侧灰色的部分会看见所有的命令,indent、comma-dangle、no-trailing-spaces和eol-last,将这些分别增加到 “rules”内,并设置为0,修改后的文件内容如下:
module.exports = { root: true, env: { node: true }, extends: [ 'plugin:vue/vue3-essential', '@vue/standard' ], parserOptions: { parser: '@babel/eslint-parser' }, rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'indent':0, 'comma-dangle':0, 'no-trailing-spaces':0, 'eol-last':0 } } |
修改后,保存,并且重新运行项目,问题应该就是解决了。
更多推荐
所有评论(0)