Last active
May 9, 2017 15:03
-
-
Save icflorescu/bc0de0aa2cbb17f0ad15582e8f68a192 to your computer and use it in GitHub Desktop.
Set-up Linting for React Native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Install deps: | |
| ( | |
| export PKG=eslint-config-airbnb; | |
| npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest" | |
| ) | |
| yarn add -D babel-eslint eslint-plugin-react-native | |
| */ | |
| module.exports = { | |
| parser: 'babel-eslint', | |
| extends: ['airbnb', 'plugin:react-native/all'], | |
| plugins: ['react-native'], | |
| rules: { | |
| 'class-methods-use-this': 'warn', | |
| 'no-use-before-define': 'warn', | |
| 'comma-dangle': ['warn', 'never'], | |
| 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }], | |
| // React-Native HMR doesn't work well with stateless functions yet, so don't enforce this | |
| 'react/prefer-stateless-function': 'off', | |
| 'react/no-unescaped-entities': 'off', | |
| 'react/sort-comp': ['warn', { order: [ | |
| 'static-methods', | |
| 'lifecycle', | |
| 'everything-else', | |
| 'render' | |
| ] }], | |
| 'react-native/no-color-literals': 'warn' | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment