eslint expected indentation of 0 spaces but found 2

4,315 阅读1分钟

解决办法:

1. 不校验缩进,在rule里增加如下规则:.eslintrc.js文件

'rules': {
    'indent': 'off'
}

2. 修改IDEA或webstorm配置,File => Setting => Editor => Code Style => HTML,找到 Do not indent children of: 的选项,添加 script 标签就完美解决缩进问题。

IDEA配置