[英]ESLint checks files inside a folder but doesn't check the folders inside the folder. How can I fix it?
I have installed eslint to clean up my code. 我已经安装了eslint来清理我的代码。 I cd to the project folder and launch eslint with npm run pretest, which is
我进入项目文件夹并使用npm run pretest启动eslint
"pretest": "eslint --ignore-path .gitignore ." “ pretest”:“ eslint --ignore-path .gitignore”。
it checks only webpack.config.js, that's in the project folder root, but omits the src folder, where the all the code is located. 它仅检查位于项目文件夹根目录中的webpack.config.js,但省略了所有代码所在的src文件夹。
When I cd to the folder src and launch eslint, nothing happens, it just prints out 当我CD到文件夹src并启动eslint时,什么也没发生,它只是打印出来
frontend@1.0.0 pretest /media/domanski/Domanski/9_Sandbox/react/itunes_search_api/frontend eslint --ignore-path .gitignore .
frontend@1.0.0 pretest / media / domanski / Domanski / 9_Sandbox / react / itunes_search_api / frontend eslint --ignore-path .gitignore。
and gets back to previous line. 然后回到上一行。
Here's my code eslintrc.js for reference: 这是我的代码eslintrc.js供参考:
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": [
"eslint:recommended",
'plugin:react/recommended',
'airbnb'
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"allowImportExportEverywhere": false,
"codeFrame": true
},
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules": {
"indent": ["error", 4, {
"ignoredNodes": ['JSXElement', 'JSXElement > *',
'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName',
'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer',
'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression',
'JSXSpreadChild'
]
}],
"jsx-a11y/label-has-for": [2, {
"components": ["Label"],
"required": {
"every": ["nesting", "id"]
},
"allowChildren": false
}],
"react/jsx-indent": ['error', 4],
"react/jsx-one-expression-per-line": 0,
"object-curly-newline": ["error", {
"ObjectExpression": "always",
"ObjectPattern": { "multiline": true }
}],
"react/jsx-indent-props": ['error', 4],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"react/jsx-filename-extension": [1, {
"extensions": [".js", ".jsx"]
}],
},
"parser": "babel-eslint"
};
Thanks! 谢谢!
managed to launch checking by using command eslint '**/*.jsx'. 设法通过使用命令eslint'** / *。jsx'启动检查。
Interesting, how can i do it in a more elegant way. 有趣的是,我该如何以更优雅的方式做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.