Skip to content

Instantly share code, notes, and snippets.

@Rob117
Last active September 18, 2020 18:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Rob117/118443a2610af3abcbb3d8ddb8a213d1 to your computer and use it in GitHub Desktop.
Save Rob117/118443a2610af3abcbb3d8ddb8a213d1 to your computer and use it in GitHub Desktop.
Eslint for React Native, sensible settings
module.exports = {
extends: 'universe/native',
plugins: ['react', 'react-native'],
rules: {
'react/jsx-closing-bracket-location': 2,
'brace-style': [2, '1tbs'],
'react/jsx-max-props-per-line': [
'error',
{ maximum: 1, when: 'multiline' }
],
'react/no-multi-comp': ['error', { ignoreStateless: true }],
'react/prefer-es6-class': ['error', 'always'],
'react/require-render-return': 'error',
'react/jsx-wrap-multilines': [
'error',
{
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line'
}
],
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-equals-spacing': ['error', 'never'],
'react/jsx-indent': ['error', 2],
'react/jsx-tag-spacing': [
'error',
{
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never'
}
],
'react-native/no-inline-styles': 2,
'react-native/no-unused-styles': 2,
'react/jsx-space-before-closing': ['off', 'always'],
'react/no-unused-state': 'error',
'no-unexpected-multiline': 'error'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment