zl程序教程

您现在的位置是:首页 >  Javascript

当前栏目

vue 里 使用 eslint 报错 error:Mixed spaces and tabs (no-mixed-spaces-and-tabs)

2023-03-14 22:50:06 时间

问题


报错如下:

c9ee97619f76475ca2511b7ed0299be7.png



解决


第一种:就是在 .eslintrc.js 那里关闭 no-mixed-spaces-and-tabs 规则

"no-mixed-spaces-and-tabs": "off"



第二种:就是解决这种问题:不要使用空格 和 tab 混合就行。


官网的描述:禁止使用空格 和 tab 混合缩进 (no-mixed-spaces-and-tabs),配置文件中的 "extends": "eslint:recommended" 属性启用了此规则。


大多数代码约定要求使用空格或 tab 进行缩进。因此,一行代码同时混有 tab 缩进和空格缩进,通常是错误的。


https://eslint.bootcss.com/docs/rules/no-mixed-spaces-and-tabs