我正在处理一个有eslintrc文件的项目,当我在我的Intellij项目中运行npm run test时。我收到错误
Expected indentation of 1 tab character but found 0
我尝试选中启用ESlint搜索.eslintrc的复选框 档案>其他设置>默认设置>语言与框架> javascript>代码质量工具> ESLint
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"plugin:import/errors",
"plugin:import/warnings"
],
"plugins": [
"react",
"flow-vars"
],
"settings": {
"import/ignore": [
"node_modules",
"\\.(html|json|properties)$",
"DevTools"
],
"import/resolver": {
"webpack": {
"config": "./src/js/webpack/webpack.base.config.js"
}
}
},
"rules": {
"eqeqeq": [2, "allow-null"],
"flow-vars/define-flow-type": 1,
"flow-vars/use-flow-type": 1,
"func-names": 0,
"import/no-named-as-default": 0,
"indent": [2, "tab", {"SwitchCase": 1}],
"new-cap": 0,
"no-multi-spaces": [2, {"exceptions": {"VariableDeclarator": true}}],
"no-param-reassign": [2, {"props": false}],
"no-script-url": 0,
"no-unused-vars": [2, {"args": "after-used", "argsIgnorePattern": "^_"}],
"no-use-before-define": [2, "nofunc"],
"quote-props": [2, "consistent-as-needed"],
"react/jsx-indent-props": [2, "tab"],
"react/jsx-no-bind": [2, {
"ignoreRefs": false,
"allowArrowFunctions": false,
"allowBind": false
}],
"space-before-function-paren": 0,
"spaced-comment": 0
},
"globals": {
"__ENV__": false,
"__DEV__": false,
"__TEST__": false
}
}
我甚至尝试在设置中将标签号从4更改为2,但得到错误。任何帮助赞赏。
答案 0 :(得分:0)
通常,掉毛错误应指示文件&它起源的行号。
在这种情况下,您可以尝试运行以下命令:eslint --fix
&允许eslint为你修复缩进错误。
答案 1 :(得分:0)
对于遇到此问题的任何人,解决问题的唯一方法是取消选中intellij中的启用EditorConfig支持选项。
preferences > Code Style > EditorConfig