Skip to content

Commit e839dff

Browse files
floriangossegaearon
authored andcommitted
Use keyword warn in eslint config (#234)
* Use keyword `warn` in eslint config We can use the keyword `warn` for rule configuration instead of a number. * Fix comment which where WARNING was replaced * Remove extra apostrophe
1 parent 6267992 commit e839dff

File tree

1 file changed

+103
-105
lines changed

1 file changed

+103
-105
lines changed

config/eslint.js

Lines changed: 103 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// In the future, we might create a separate list of rules for production.
1717
// It would probably be more strict.
1818

19-
var WARNING = 1;
20-
2119
module.exports = {
2220
root: true,
2321

@@ -57,40 +55,40 @@ module.exports = {
5755

5856
rules: {
5957
// http://eslint.org/docs/rules/
60-
'array-callback-return': WARNING,
61-
'default-case': [WARNING, { commentPattern: '^no default$' }],
62-
'dot-location': [WARNING, 'property'],
63-
eqeqeq: [WARNING, 'allow-null'],
64-
'guard-for-in': WARNING,
65-
'new-cap': [WARNING, { newIsCap: true }],
66-
'new-parens': WARNING,
67-
'no-array-constructor': WARNING,
68-
'no-caller': WARNING,
69-
'no-cond-assign': [WARNING, 'always'],
70-
'no-const-assign': WARNING,
71-
'no-control-regex': WARNING,
72-
'no-delete-var': WARNING,
73-
'no-dupe-args': WARNING,
74-
'no-dupe-class-members': WARNING,
75-
'no-dupe-keys': WARNING,
76-
'no-duplicate-case': WARNING,
77-
'no-empty-character-class': WARNING,
78-
'no-empty-pattern': WARNING,
79-
'no-eval': WARNING,
80-
'no-ex-assign': WARNING,
81-
'no-extend-native': WARNING,
82-
'no-extra-bind': WARNING,
83-
'no-extra-label': WARNING,
84-
'no-fallthrough': WARNING,
85-
'no-func-assign': WARNING,
86-
'no-implied-eval': WARNING,
87-
'no-invalid-regexp': WARNING,
88-
'no-iterator': WARNING,
89-
'no-label-var': WARNING,
90-
'no-labels': [WARNING, { allowLoop: false, allowSwitch: false }],
91-
'no-lone-blocks': WARNING,
92-
'no-loop-func': WARNING,
93-
'no-mixed-operators': [WARNING, {
58+
'array-callback-return': 'warn',
59+
'default-case': ['warn', { commentPattern: '^no default$' }],
60+
'dot-location': ['warn', 'property'],
61+
eqeqeq: ['warn', 'allow-null'],
62+
'guard-for-in': 'warn',
63+
'new-cap': ['warn', { newIsCap: true }],
64+
'new-parens': 'warn',
65+
'no-array-constructor': 'warn',
66+
'no-caller': 'warn',
67+
'no-cond-assign': ['warn', 'always'],
68+
'no-const-assign': 'warn',
69+
'no-control-regex': 'warn',
70+
'no-delete-var': 'warn',
71+
'no-dupe-args': 'warn',
72+
'no-dupe-class-members': 'warn',
73+
'no-dupe-keys': 'warn',
74+
'no-duplicate-case': 'warn',
75+
'no-empty-character-class': 'warn',
76+
'no-empty-pattern': 'warn',
77+
'no-eval': 'warn',
78+
'no-ex-assign': 'warn',
79+
'no-extend-native': 'warn',
80+
'no-extra-bind': 'warn',
81+
'no-extra-label': 'warn',
82+
'no-fallthrough': 'warn',
83+
'no-func-assign': 'warn',
84+
'no-implied-eval': 'warn',
85+
'no-invalid-regexp': 'warn',
86+
'no-iterator': 'warn',
87+
'no-label-var': 'warn',
88+
'no-labels': ['warn', { allowLoop: false, allowSwitch: false }],
89+
'no-lone-blocks': 'warn',
90+
'no-loop-func': 'warn',
91+
'no-mixed-operators': ['warn', {
9492
groups: [
9593
['&', '|', '^', '~', '<<', '>>', '>>>'],
9694
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
@@ -99,58 +97,58 @@ module.exports = {
9997
],
10098
allowSamePrecedence: false
10199
}],
102-
'no-multi-str': WARNING,
103-
'no-native-reassign': WARNING,
104-
'no-negated-in-lhs': WARNING,
105-
'no-new-func': WARNING,
106-
'no-new-object': WARNING,
107-
'no-new-symbol': WARNING,
108-
'no-new-wrappers': WARNING,
109-
'no-obj-calls': WARNING,
110-
'no-octal': WARNING,
111-
'no-octal-escape': WARNING,
112-
'no-redeclare': WARNING,
113-
'no-regex-spaces': WARNING,
100+
'no-multi-str': 'warn',
101+
'no-native-reassign': 'warn',
102+
'no-negated-in-lhs': 'warn',
103+
'no-new-func': 'warn',
104+
'no-new-object': 'warn',
105+
'no-new-symbol': 'warn',
106+
'no-new-wrappers': 'warn',
107+
'no-obj-calls': 'warn',
108+
'no-octal': 'warn',
109+
'no-octal-escape': 'warn',
110+
'no-redeclare': 'warn',
111+
'no-regex-spaces': 'warn',
114112
'no-restricted-syntax': [
115-
WARNING,
113+
'warn',
116114
'LabeledStatement',
117115
'WithStatement',
118116
],
119-
'no-return-assign': WARNING,
120-
'no-script-url': WARNING,
121-
'no-self-assign': WARNING,
122-
'no-self-compare': WARNING,
123-
'no-sequences': WARNING,
124-
'no-shadow-restricted-names': WARNING,
125-
'no-sparse-arrays': WARNING,
126-
'no-this-before-super': WARNING,
127-
'no-throw-literal': WARNING,
128-
'no-undef': WARNING,
129-
'no-unexpected-multiline': WARNING,
130-
'no-unreachable': WARNING,
131-
'no-unused-expressions': WARNING,
132-
'no-unused-labels': WARNING,
133-
'no-unused-vars': [WARNING, { vars: 'local', args: 'none' }],
134-
'no-use-before-define': [WARNING, 'nofunc'],
135-
'no-useless-computed-key': WARNING,
136-
'no-useless-concat': WARNING,
137-
'no-useless-constructor': WARNING,
138-
'no-useless-escape': WARNING,
139-
'no-useless-rename': [WARNING, {
117+
'no-return-assign': 'warn',
118+
'no-script-url': 'warn',
119+
'no-self-assign': 'warn',
120+
'no-self-compare': 'warn',
121+
'no-sequences': 'warn',
122+
'no-shadow-restricted-names': 'warn',
123+
'no-sparse-arrays': 'warn',
124+
'no-this-before-super': 'warn',
125+
'no-throw-literal': 'warn',
126+
'no-undef': 'warn',
127+
'no-unexpected-multiline': 'warn',
128+
'no-unreachable': 'warn',
129+
'no-unused-expressions': 'warn',
130+
'no-unused-labels': 'warn',
131+
'no-unused-vars': ['warn', { vars: 'local', args: 'none' }],
132+
'no-use-before-define': ['warn', 'nofunc'],
133+
'no-useless-computed-key': 'warn',
134+
'no-useless-concat': 'warn',
135+
'no-useless-constructor': 'warn',
136+
'no-useless-escape': 'warn',
137+
'no-useless-rename': ['warn', {
140138
ignoreDestructuring: false,
141139
ignoreImport: false,
142140
ignoreExport: false,
143141
}],
144-
'no-with': WARNING,
145-
'no-whitespace-before-property': WARNING,
146-
'operator-assignment': [WARNING, 'always'],
147-
radix: WARNING,
148-
'require-yield': WARNING,
149-
'rest-spread-spacing': [WARNING, 'never'],
150-
strict: [WARNING, 'never'],
151-
'unicode-bom': [WARNING, 'never'],
152-
'use-isnan': WARNING,
153-
'valid-typeof': WARNING,
142+
'no-with': 'warn',
143+
'no-whitespace-before-property': 'warn',
144+
'operator-assignment': ['warn', 'always'],
145+
radix: 'warn',
146+
'require-yield': 'warn',
147+
'rest-spread-spacing': ['warn', 'never'],
148+
strict: ['warn', 'never'],
149+
'unicode-bom': ['warn', 'never'],
150+
'use-isnan': 'warn',
151+
'valid-typeof': 'warn',
154152

155153
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/
156154

@@ -165,37 +163,37 @@ module.exports = {
165163
// When file A is saved, we want to invalidate all files that import it
166164
// *and* that currently have lint errors. This should fix the problem.
167165

168-
// 'import/default': WARNING,
169-
// 'import/export': WARNING,
170-
// 'import/named': WARNING,
171-
// 'import/namespace': WARNING,
172-
// 'import/no-amd': WARNING,
173-
// 'import/no-duplicates': WARNING,
174-
// 'import/no-extraneous-dependencies': WARNING,
175-
// 'import/no-named-as-default': WARNING,
176-
// 'import/no-named-as-default-member': WARNING,
177-
// 'import/no-unresolved': [WARNING, { commonjs: true }],
166+
// 'import/default': 'warn',
167+
// 'import/export': 'warn',
168+
// 'import/named': 'warn',
169+
// 'import/namespace': 'warn',
170+
// 'import/no-amd': 'warn',
171+
// 'import/no-duplicates': 'warn',
172+
// 'import/no-extraneous-dependencies': 'warn',
173+
// 'import/no-named-as-default': 'warn',
174+
// 'import/no-named-as-default-member': 'warn',
175+
// 'import/no-unresolved': ['warn', { commonjs: true }],
178176

179177
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
180-
'react/jsx-equals-spacing': [WARNING, 'never'],
181-
'react/jsx-no-duplicate-props': [WARNING, { ignoreCase: true }],
182-
'react/jsx-no-undef': WARNING,
183-
'react/jsx-pascal-case': [WARNING, {
178+
'react/jsx-equals-spacing': ['warn', 'never'],
179+
'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }],
180+
'react/jsx-no-undef': 'warn',
181+
'react/jsx-pascal-case': ['warn', {
184182
allowAllCaps: true,
185183
ignore: [],
186184
}],
187-
'react/jsx-uses-react': WARNING,
188-
'react/jsx-uses-vars': WARNING,
189-
'react/no-deprecated': WARNING,
190-
'react/no-direct-mutation-state': WARNING,
191-
'react/no-is-mounted': WARNING,
192-
'react/react-in-jsx-scope': WARNING,
193-
'react/require-render-return': WARNING,
185+
'react/jsx-uses-react': 'warn',
186+
'react/jsx-uses-vars': 'warn',
187+
'react/no-deprecated': 'warn',
188+
'react/no-direct-mutation-state': 'warn',
189+
'react/no-is-mounted': 'warn',
190+
'react/react-in-jsx-scope': 'warn',
191+
'react/require-render-return': 'warn',
194192

195193
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
196-
'jsx-a11y/aria-role': WARNING,
197-
'jsx-a11y/img-has-alt': WARNING,
198-
'jsx-a11y/img-redundant-alt': WARNING,
199-
'jsx-a11y/no-access-key': WARNING
194+
'jsx-a11y/aria-role': 'warn',
195+
'jsx-a11y/img-has-alt': 'warn',
196+
'jsx-a11y/img-redundant-alt': 'warn',
197+
'jsx-a11y/no-access-key': 'warn'
200198
}
201199
};

0 commit comments

Comments
 (0)