简体   繁体   English

React Native中的ESLint在命令行中不掉毛

[英]ESLint in React Native not linting in command line

I just installed ESLint to React Native (create-react-native-app) 我刚刚将ESLint安装到React Native(create-react-native-app)

.eslintrc.json .eslintrc.json

{
    "env": {
        "browser": true,
        "es6": true,
        "react-native/react-native": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "parserOptions": {
        "ecmaVersion": 8,
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react",
        "react-native"
    ],
    "rules": {
        "no-var": "error",
        "react-native/no-unused-styles": 2,
        "react-native/split-platform-components": 2,
        "react-native/no-inline-styles": 2,
        "react-native/no-color-literals": 2,
        "indent": [
            "error",
            "tab"
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "never"
        ]
    }
}

It's lint everything properly, BUT not my components. 它正确地抹平了所有东西,但不是我的组件。 So my folder structure looks something like: 所以我的文件夹结构看起来像:

root: src components contants ... 根:src组件接触...

The linter working in the editor (Sublime), BUT not in the Command Line (iTerm2) linter在编辑器中工作(Sublime),但不在命令行中工作(iTerm2)

使用eslint可以执行eslint ./src来验证整个文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM