简体   繁体   English

ESLint检查文件夹内的文件,但不检查文件夹内的文件夹。 我该如何解决?

[英]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.

相关问题 防止从 pages 文件夹中的组件和公用文件夹创建路由。 并拒绝访问查看公用文件夹中的文件。 NextJs - Prevent the creation of routes from components and public folders in the pages folder. And deny access to see files in public folders. NextJs 如何将图像文件移动到文件夹? - How can I move image files to a folder? 如何从公用文件夹中导入组件的样式表。 和组件文件在src / components / files中,那么我的app.js看起来像 - how can import style sheet for components from public folder. and components files are in src/components/files then my app.js look like --fix 不使用 eslint 修复错误 - --fix doesn't fix the errors using eslint ReactJs 如何从 src 文件夹中的同级文件夹导入组件? - ReactJs how to import component from sibling folder inside src folder? 如何使用 reactjs 前端修复 multer 代码不添加到我在我的服务器中创建的文件夹中的 nodejs - How to fix multer code not adding to my created folder inside my server in nodejs with reactjs frontend GatsbyJs,文件夹内的页面 - GatsbyJs, page inside folder Eslint 无法识别函数内部定义的 FunctionComponent 并抱怨在其中使用钩子 - Eslint doesn't recognize a FunctionComponent defined inside a function and complains about using a hook inside it 如何导入文件夹内不同文件夹中的文件 - How to import a file present in a different folder inside a folder 为什么 useState 设置在 useEffect 中不起作用?我该如何解决这个问题? - Why useState set don't work inside useEffect in react?How can i fix this?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM