Convert to .eslintrc.js
Paul O’Shannessy committed
Mar 1, 2016 at 15:40 UTC
b271efb7d3d8972bf872fed40d5450a001e2c0d0
2 files changed
+73
-66
.eslintrc
deleted
-66
@@ -1,66 +0,0 @@
1
----
2
-parser: babel-eslint
3
-
4
-extends:
5
- - ./node_modules/fbjs-scripts/eslint/.eslintrc.js
6
-
7
-plugins:
8
- - react
9
- - react-internal
10
-
11
-ecmaFeatures:
12
- modules: false
13
-
14
-# We're stricter than the default config, mostly. We'll override a few rules and
15
-# then enable some React specific ones.
16
-rules:
17
- accessor-pairs: 0
18
- brace-style: [2, 1tbs]
19
- comma-dangle: [2, always-multiline]
20
- consistent-return: 2
21
- dot-location: [2, property]
22
- dot-notation: 2
23
- eol-last: 2
24
- eqeqeq: [2, allow-null]
25
- indent: [2, 2, {SwitchCase: 1}]
26
- jsx-quotes: [2, prefer-double]
27
- no-bitwise: 0
28
- no-dupe-class-members: 2
29
- no-multi-spaces: 2
30
- no-restricted-syntax: [2, WithStatement]
31
- no-shadow: 2
32
- no-unused-expressions: 2
33
- no-unused-vars: [2, {args: none}]
34
- quotes: [2, single, avoid-escape]
35
- space-after-keywords: 2
36
- space-before-blocks: 2
37
- space-before-keywords: 2
38
- strict: [2, global]
39
-
40
- # JSX
41
- # Our transforms set this automatically
42
- react/display-name: 0
43
- react/jsx-boolean-value: [2, always]
44
- react/jsx-no-undef: 2
45
- # We don't care to do this
46
- react/jsx-sort-prop-types: 0
47
- react/jsx-sort-props: 0
48
- react/jsx-uses-react: 2
49
- react/jsx-uses-vars: 2
50
- # It's easier to test some things this way
51
- react/no-did-mount-set-state: 0
52
- react/no-did-update-set-state: 0
53
- # We define multiple components in test files
54
- react/no-multi-comp: 0
55
- react/no-unknown-property: 2
56
- # This isn't useful in our test code
57
- react/prop-types: 0
58
- react/react-in-jsx-scope: 2
59
- react/self-closing-comp: 2
60
- # We don't care to do this
61
- react/sort-comp: 0
62
- react/wrap-multilines: [2, {declaration: false, assignment: false}]
63
-
64
- # CUSTOM RULES
65
- # the second argument of warning/invariant should be a literal string
66
- react-internal/warning-and-invariant-args: 2
.eslintrc.js
new
+73
@@ -0,0 +1,73 @@
1
+const OFF = 0;
2
+const WARNING = 1;
3
+const ERROR = 2;
4
+
5
+module.exports = {
6
+ parser: 'babel-eslint',
7
+
8
+ extends: './node_modules/fbjs-scripts/eslint/.eslintrc.js',
9
+
10
+ plugins: [
11
+ 'react',
12
+ 'react-internal',
13
+ ],
14
+
15
+ ecmaFeatures: {
16
+ modules: false
17
+ },
18
+
19
+ // We're stricter than the default config, mostly. We'll override a few rules
20
+ // and then enable some React specific ones.
21
+ rules: {
22
+ 'accessor-pairs': OFF,
23
+ 'brace-style': [ERROR, '1tbs'],
24
+ 'comma-dangle': [ERROR, 'always-multiline'],
25
+ 'consistent-return': ERROR,
26
+ 'dot-location': [ERROR, 'property'],
27
+ 'dot-notation': ERROR,
28
+ 'eol-last': ERROR,
29
+ 'eqeqeq': [ERROR, 'allow-null'],
30
+ 'indent': [ERROR, 2, {SwitchCase: 1}],
31
+ 'jsx-quotes': [ERROR, 'prefer-double'],
32
+ 'no-bitwise': OFF,
33
+ 'no-dupe-class-members': ERROR,
34
+ 'no-multi-spaces': ERROR,
35
+ 'no-restricted-syntax': [ERROR, 'WithStatement'],
36
+ 'no-shadow': ERROR,
37
+ 'no-unused-expressions': ERROR,
38
+ 'no-unused-vars': [ERROR, {args: 'none'}],
39
+ 'quotes': [ERROR, 'single', 'avoid-escape'],
40
+ 'space-after-keywords': ERROR,
41
+ 'space-before-blocks': ERROR,
42
+ 'space-before-keywords': ERROR,
43
+ 'strict': [ERROR, 'global'],
44
+
45
+ // React & JSX
46
+ // Our transforms set this automatically
47
+ 'react/display-name': OFF,
48
+ 'react/jsx-boolean-value': [ERROR, 'always'],
49
+ 'react/jsx-no-undef': ERROR,
50
+ // We don't care to do this
51
+ 'react/jsx-sort-prop-types': OFF,
52
+ 'react/jsx-sort-props': OFF,
53
+ 'react/jsx-uses-react': ERROR,
54
+ 'react/jsx-uses-vars': ERROR,
55
+ // It's easier to test some things this way
56
+ 'react/no-did-mount-set-state': OFF,
57
+ 'react/no-did-update-set-state': OFF,
58
+ // We define multiple components in test files
59
+ 'react/no-multi-comp': OFF,
60
+ 'react/no-unknown-property': ERROR,
61
+ // This isn't useful in our test code
62
+ 'react/prop-types': OFF,
63
+ 'react/react-in-jsx-scope': ERROR,
64
+ 'react/self-closing-comp': ERROR,
65
+ // We don't care to do this
66
+ 'react/sort-comp': OFF,
67
+ 'react/wrap-multilines': [ERROR, {declaration: false, assignment: false}],
68
+
69
+ // CUSTOM RULES
70
+ // the second argument of warning/invariant should be a literal string
71
+ 'react-internal/warning-and-invariant-args': ERROR,
72
+ }
73
+};