【发布时间】:2016-07-28 19:17:36
【问题描述】:
es6代码语法如下,
import React from 'react';
const App = ({ children }) => {
let childrenData;
if (children) {
childrenData = (<div>{children}</div>);
}
return childrenData;
};
export default App;
eslint 出错
5:2 error Expected indentation of 4 space character but found 0 indent
6:2 error Expected indentation of 4 space character but found 0 indent
7:3 error Expected indentation of 4 space character but found 0 indent
9:2 error Expected indentation of 4 space character but found 0 indent
我的规则引擎看起来像这样,
"indent": [2, 4, {'SwitchCase': 1}],
"max-len": ["error", 200, 4],
"object-shorthand": ["error", "always", { "ignoreConstructors": true }],
"one-var": ["error", {
"var": "always", // Exactly one var declaration per function
"let": "always", // Exactly one let declaration per block
"const": "never" // Exactly one declarator per const declaration per block
}],
你能帮我看看我哪里错了吗???
【问题讨论】:
-
确定错误与该文件有关吗?
-
你是不是不小心使用了标签页?
-
是的,仅来自文件...没有标签 ..
-
你用的是什么版本的 eslint?您也可以在此处针对最新的 eslint 版本测试您的代码。 eslint.org/demo
-
你解决了吗?我也遇到了同样的问题
标签: ecmascript-6 webpack webpack-dev-server eslint