[英]ESLint doesn't lint ALL errors in command-line
I'm using eslint in my project, .eslintrc
looks like:我在我的项目中使用 eslint,
.eslintrc
看起来像:
// http://eslint.org/docs/rules
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"plugins": [
"react"
],
"rules": {
"strict": 0,
"quotes": [2, "single"],
"indent": [2, 4, {SwitchCase: 1}],
"semi": [2, "always"],
"no-underscore-dangle": 0,
"no-unused-vars": 1,
"no-unused-expressions": 0,
"react/jsx-no-undef": 2,
"react/jsx-boolean-value": 1,
"react/jsx-sort-props": 0,
"react/jsx-sort-prop-types": 0,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 0,
"react/no-unknown-property": 1,
"react/prop-types": 0,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1,
"new-cap": 0,
"no-extra-boolean-cast": 0,
"yoda": 0,
"no-empty": 0,
"no-use-before-define": 0,
"camelcase": 0
},
"globals": {
"expect": true,
"should": true,
"FB": true,
"gapi": true,
"google": true,
"customGoogleUtils": true,
"encodeURIComonent": true,
"decodeURIComonent": true
}
}
I'm using Sublime Text 3 and with necessary plugins it lints code successfully:我正在使用 Sublime Text 3 和必要的插件,它成功地 lints 代码:
However when I'm running eslint ./src
in command-line it doesn't show any errors!但是,当我在命令行中运行
eslint ./src
,它没有显示任何错误! . . Even if I point it to specific file with errors in folder
eslint ./src/path/to/file/with/errors
.即使我将它指向文件夹
eslint ./src/path/to/file/with/errors
有错误的特定文件。
I'm using the latest versions in node_modules
:我在
node_modules
使用最新版本:
"babel-eslint": "^5.0.0"
"eslint": "^2.4.0"
"eslint-plugin-react": "^4.2.3"
UPDATE更新
The project folder structure is as follows (I'm linting only /src
fodler):项目文件夹结构如下(我只检查
/src
fodler):
What is the problem?问题是什么?
I found a problem - lint errors were present in .jsx
files and eslint ./src
validated only .js
by default.我发现了一个问题 -
.jsx
文件中存在 lint 错误,默认情况下eslint ./src
仅验证.js
。
In order to fix I've changed the cli command as follows - eslint --ext .js --ext .jsx ./src
.为了修复,我更改了 cli 命令,如下所示 -
eslint --ext .js --ext .jsx ./src
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.