【发布时间】:2016-07-11 08:35:10
【问题描述】:
我不知道如何配置我的 .eslintrc 文件以正确“接受”JSX。换句话说,当在 Atom 中输入 JSX 时,它会崩溃。
我添加了"parser": "babel-eslint",因为这似乎是其他人一直在调整他们的 linter 的一部分......但后来我在 Atom 中收到了这个错误:
错误:无法从“/Users/josetello/.atom/packages/linter-eslint/node_modules”中找到模块“babel-eslint”
我已经全局安装了 babel-eslint 和 --save-dev。没有运气。不知道为什么它抱怨原子包......
有没有更好的方法来为 JSX 配置 .eslintrc?
我的 .eslintrc 文件:
{
"settings": {
"ecmascript": 6
},
"ecmaFeatures": {
"blockBindings": true,
"jsx": true
},
"parser": "babel-eslint",
"env": {
"browser": true,
"jquery": true,
"node": true,
"mocha": true,
"es6": true
},
"rules": {
"prefer-arrow-callback": 1,
"semi": 1,
"strict": 0,
"indent": [2, 2],
"quotes": [1, "single"],
"no-multi-spaces": [1, {
"exceptions": {
"VariableDeclarator": true,
"FunctionExpression": true
}
}],
"key-spacing": [0, {"align": "value"}],
"no-underscore-dangle": 0
},
{
"plugins": [
"react"
]
}
}
【问题讨论】:
-
你用的是哪个 eslint 版本?
标签: reactjs atom-editor eslint jsx