@@ -2,6 +2,7 @@ module.exports = {
22 extends : [ 'airbnb/hooks' , 'prettier' ] ,
33 rules : {
44 'import/order' : [
5+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
56 'error' ,
67 {
78 alphabetize : {
@@ -18,23 +19,55 @@ module.exports = {
1819 'newlines-between' : 'never' ,
1920 } ,
2021 ] ,
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
2145 'padding-line-between-statements' : [
46+ // https://eslint.org/docs/rules/padding-line-between-statements
2247 'error' ,
2348 {
2449 blankLine : 'always' ,
2550 next : 'return' ,
2651 prev : '*' ,
2752 } ,
2853 ] ,
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
3363 'react/sort-prop-types' : [
64+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
3465 'error' ,
3566 { ignoreCase : true , requiredFirst : false , sortShapeProp : true } ,
3667 ] ,
68+ // Same but for imports
3769 'sort-imports' : [
70+ // https://eslint.org/docs/rules/sort-imports
3871 'error' ,
3972 {
4073 ignoreDeclarationSort : true ,
0 commit comments