Skip to content

Instantly share code, notes, and snippets.

@icflorescu
Last active May 9, 2017 15:03
Show Gist options
  • Select an option

  • Save icflorescu/bc0de0aa2cbb17f0ad15582e8f68a192 to your computer and use it in GitHub Desktop.

Select an option

Save icflorescu/bc0de0aa2cbb17f0ad15582e8f68a192 to your computer and use it in GitHub Desktop.
Set-up Linting for React Native
/*
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