eslint中的缩进错误,es6

时间:2016-04-07 18:14:45

标签: ecmascript-6 webpack webpack-dev-server eslint

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
}],
你能帮我找错吗???

1 个答案:

答案 0 :(得分:0)

Switchcase位于单引号之间,它应该在double之间,因为这是一个JSON文件。