I'm using ESLint with the Airbnb plugin (eslint-config-airbnb
) and Babel parser. I've just added the extra rule of using Tab characters for indentation instead of spaces.
我正在使用ESLint和Airbnb插件(eslint-config-airbnb)和Babel解析器。我刚刚添加了使用Tab字符代替空格的额外规则。
Here is my .eslintrc
:
这是我的.eslintrc:
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules":{
"indent": [2, "tab"]
}
}
Now I get this error at every indentation:
现在我在每个缩进处都会收到此错误:
Error: Unexpected tab character
Just in case it helps, I'm using Atom IDE with the autolinter plugins linter
and linter-eslint
.
为了防万一,我使用Atom IDE和autolinter插件linter和linter-eslint。
1 个解决方案
#1
38
I answer myself, it was because Airbnb has set the rule no-tabs
to 2 or error, I just disabled it.
我回答自己,这是因为Airbnb已将规则no-tabs设置为2或错误,我只是禁用它。
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules":{
"indent": [2, "tab"],
"no-tabs": 0
}
}
#1
38
I answer myself, it was because Airbnb has set the rule no-tabs
to 2 or error, I just disabled it.
我回答自己,这是因为Airbnb已将规则no-tabs设置为2或错误,我只是禁用它。
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules":{
"indent": [2, "tab"],
"no-tabs": 0
}
}