我使用以下套餐:
"eslint-config-standard": "^6.2.0",
"eslint-config-standard-react": "^4.2.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-promise": "^3.0.0",
"eslint-plugin-react": "^6.4.0",
"eslint-plugin-standard": "^2.0.1",
使用以下.eslintrc` config:
{
"parser" : "babel-eslint",
"extends" : [
"standard",
"standard-react"
],
"plugins": [
"babel",
"react",
"promise"
],
"env" : {
"browser" : true
},
"globals" : {
"__DEV__" : false,
"__PROD__" : false,
"__DEBUG__" : false,
"__COVERAGE__" : false,
"__BASENAME__" : false
},
"rules": {
"key-spacing" : [2, {
"singleLine" : {
"beforeColon" : false,
"afterColon" : true
},
"multiLine" : {
"mode" : "strict",
"beforeColon" : false,
"afterColon" : true
}
}],
"babel/generator-star-spacing" : 1,
"generator-star-spacing" : 0,
"jsx-quotes" : [2, "prefer-single"],
"max-len" : [2, 120, 2],
"object-curly-spacing" : [2, "always"],
"comma-dangle" : [2, "always-multiline"]
}
}
这个配置在某种程度上忽略了JSX文件中的分号:它从JSX中的行末端运行lint修复时不会删除它们,但是它在JS中。我究竟做错了什么?