Skip to content

Instantly share code, notes, and snippets.

@meain
Last active February 18, 2018 14:43
Show Gist options
  • Save meain/d7169e2cc6b5faf50d556f91e625af1b to your computer and use it in GitHub Desktop.
Save meain/d7169e2cc6b5faf50d556f91e625af1b to your computer and use it in GitHub Desktop.
React + flow eslint config
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
es6: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended'],
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true,
},
sourceType: 'module',
},
plugins: ['react', 'flowtype'],
rules: {
'react/jsx-uses-vars': 2,
'no-console': 1,
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never'],
'flowtype/boolean-style': [2, 'boolean'],
'flowtype/define-flow-type': 1,
'flowtype/generic-spacing': [2, 'never'],
'flowtype/no-primitive-constructor-types': 2,
'flowtype/no-types-missing-file-annotation': 2,
'flowtype/no-weak-types': 2,
'flowtype/object-type-delimiter': [2, 'comma'],
'flowtype/require-parameter-type': 2,
'flowtype/require-return-type': [
2,
'always',
{
annotateUndefined: 'never',
},
],
'flowtype/require-valid-file-annotation': 2,
'flowtype/space-after-type-colon': [2, 'always'],
'flowtype/space-before-generic-bracket': [2, 'never'],
'flowtype/space-before-type-colon': [2, 'never'],
'flowtype/type-id-match': [2, '^([A-Z][a-z0-9]+)+Type$'],
'flowtype/union-intersection-spacing': [2, 'always'],
'flowtype/use-flow-type': 1,
'flowtype/valid-syntax': 1,
},
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true,
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment