1

I just installed ESLint to React Native (create-react-native-app)

.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 ...

The linter working in the editor (Sublime), BUT not in the Command Line (iTerm2)

Istvan Orban
  • 1,607
  • 3
  • 18
  • 34

1 Answers1

0

Using eslint it is possible to do eslint ./src to validate whole folder.