-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.yml
129 lines (104 loc) · 3.47 KB
/
.eslintrc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
root: true
parser: babel-eslint
extends:
# https://github.com/yannickcr/eslint-plugin-react
- plugin:react/recommended
# https://github.com/gajus/eslint-plugin-flowtype
- plugin:flowtype/recommended
# https://www.npmjs.com/package/eslint-plugin-jest
- plugin:jest/recommended
# https://www.npmjs.com/package/eslint-config-airbnb-base
- airbnb
# https://github.com/prettier/eslint-config-prettier
- prettier
- prettier/flowtype
- prettier/react
plugins:
- react
- import
- jest
- flowtype
# https://github.com/prettier/eslint-plugin-prettier
- prettier
settings:
flowtype:
# with this option you do not have to add @flow in files
onlyFilesWithFlowAnnotation: false
env:
es6: true
browser: true
node: true
jasmine: true
jest: true
jest/globals: true
globals:
fetch: true
navigator: true
__DEV__: true
XMLHttpRequest: true
React$Element: true
Generator: true
parserOptions:
ecmaVersion: 2017
sourceType: module
ecmaFeatures:
jsx: true
rules:
prettier/prettier:
- error
-
trailingComma: all
bracketSpacing: false
### Different from airbnb config
### Styling ###
# Prefer new line before return
# http://eslint.org/docs/rules/newline-before-return
newline-before-return: error # airbnb default: off
### Variables ###
# Functions and classes can be used before declaration
# http://eslint.org/docs/rules/no-use-before-define
no-use-before-define: # airbnb default: ['error', { functions: true, classes: true, variables: true }]
- error
-
functions: false
classes: false
variables: true
### From error to warning ###
# was not working when used with flow prop types
no-unused-vars: warn
react/no-unused-prop-types: warn
### ES6 ###
### Best practices ###
# require or disallow Yoda conditions
# https://eslint.org/docs/rules/yoda
yoda: [error, never, { exceptRange: true }] # airbnb default: 'error'
# add culry braces all the time
# https://eslint.org/docs/rules/curly
curly: [error, all] # airbnb default: [error, multi-line]
### Import ###
# Require modules with a single export to use a default export
# https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
import/prefer-default-export: off # airbnb default: 'error'
# https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
import/first: off # airbnb default: ['error', 'absolute-first']
### Debugging is allowed but not allowed to commit ###
no-console: warn # airbnb default: 'error'
no-debugger: warn # airbnb default: 'error'
### React ###
# do not force jsx use js
# https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
react/jsx-filename-extension: off
# Require stateless functions when not using lifecycle methods, setState or ref
# https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
react/prefer-stateless-function: warn # airbnb default: 'error'
# Enforce a defaultProps definition for every prop that is not a required prop
# reason: function composition over default props
# https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
react/require-default-props: off # airbnb default: 'error'
### Removed rules
# no longer defined
jsx-a11y/href-no-hash: off
# was complaining about inline snapshots
no-irregular-whitespace:
- off