@@ -2,6 +2,7 @@ module.exports = {
2
2
extends : [ 'airbnb/hooks' , 'prettier' ] ,
3
3
rules : {
4
4
'import/order' : [
5
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
5
6
'error' ,
6
7
{
7
8
alphabetize : {
@@ -18,23 +19,55 @@ module.exports = {
18
19
'newlines-between' : 'never' ,
19
20
} ,
20
21
] ,
22
+ // This allows us to reenable ForOfStatement.
23
+ // While this has been disabled in airbnb configuration it's native to the browsers we support
24
+ // so the original argument about weight is no up to date https://github.com/airbnb/javascript/issues/1271
25
+ 'no-restricted-syntax' : [
26
+ // https://eslint.org/docs/rules/no-restricted-syntax#disallow-specified-syntax-no-restricted-syntax
27
+ 'error' ,
28
+ {
29
+ message :
30
+ 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.' ,
31
+ selector : 'ForInStatement' ,
32
+ } ,
33
+ {
34
+ message :
35
+ 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.' ,
36
+ selector : 'LabeledStatement' ,
37
+ } ,
38
+ {
39
+ message :
40
+ '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.' ,
41
+ selector : 'WithStatement' ,
42
+ } ,
43
+ ] ,
44
+ // This is to have a more breathable codebase
21
45
'padding-line-between-statements' : [
46
+ // https://eslint.org/docs/rules/padding-line-between-statements
22
47
'error' ,
23
48
{
24
49
blankLine : 'always' ,
25
50
next : 'return' ,
26
51
prev : '*' ,
27
52
} ,
28
53
] ,
29
- 'react/jsx-no-constructed-context-values' : 'warn' ,
30
- 'react/jsx-no-script-url' : 'error' ,
31
- 'react/jsx-no-useless-fragment' : 'error' ,
32
- 'react/no-adjacent-inline-elements' : 'error' ,
54
+ // These are rules soon to be enabled by airbnb react config
55
+ // We're getting a head start
56
+ 'react/jsx-no-constructed-context-values' : 'warn' , // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
57
+ 'react/jsx-no-script-url' : 'error' , // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
58
+ 'react/jsx-no-useless-fragment' : 'error' , // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
59
+ 'react/no-adjacent-inline-elements' : 'error' , // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
60
+ 'react/no-unstable-nested-components' : 'error' , // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
61
+
62
+ // To have consistent ordering in proptypes
33
63
'react/sort-prop-types' : [
64
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
34
65
'error' ,
35
66
{ ignoreCase : true , requiredFirst : false , sortShapeProp : true } ,
36
67
] ,
68
+ // Same but for imports
37
69
'sort-imports' : [
70
+ // https://eslint.org/docs/rules/sort-imports
38
71
'error' ,
39
72
{
40
73
ignoreDeclarationSort : true ,
0 commit comments