From e839dff82c9737aaa84959b5f786731a7822e19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Go=C3=9Fe?= <flo@essog.de> Date: Wed, 27 Jul 2016 12:30:20 +0200 Subject: [PATCH] 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 --- config/eslint.js | 208 +++++++++++++++++++++++------------------------ 1 file changed, 103 insertions(+), 105 deletions(-) diff --git a/config/eslint.js b/config/eslint.js index c61d51e06..f1e9ef1a7 100644 --- a/config/eslint.js +++ b/config/eslint.js @@ -16,8 +16,6 @@ // In the future, we might create a separate list of rules for production. // It would probably be more strict. -var WARNING = 1; - module.exports = { root: true, @@ -57,40 +55,40 @@ module.exports = { rules: { // http://eslint.org/docs/rules/ - 'array-callback-return': WARNING, - 'default-case': [WARNING, { commentPattern: '^no default$' }], - 'dot-location': [WARNING, 'property'], - eqeqeq: [WARNING, 'allow-null'], - 'guard-for-in': WARNING, - 'new-cap': [WARNING, { newIsCap: true }], - 'new-parens': WARNING, - 'no-array-constructor': WARNING, - 'no-caller': WARNING, - 'no-cond-assign': [WARNING, 'always'], - 'no-const-assign': WARNING, - 'no-control-regex': WARNING, - 'no-delete-var': WARNING, - 'no-dupe-args': WARNING, - 'no-dupe-class-members': WARNING, - 'no-dupe-keys': WARNING, - 'no-duplicate-case': WARNING, - 'no-empty-character-class': WARNING, - 'no-empty-pattern': WARNING, - 'no-eval': WARNING, - 'no-ex-assign': WARNING, - 'no-extend-native': WARNING, - 'no-extra-bind': WARNING, - 'no-extra-label': WARNING, - 'no-fallthrough': WARNING, - 'no-func-assign': WARNING, - 'no-implied-eval': WARNING, - 'no-invalid-regexp': WARNING, - 'no-iterator': WARNING, - 'no-label-var': WARNING, - 'no-labels': [WARNING, { allowLoop: false, allowSwitch: false }], - 'no-lone-blocks': WARNING, - 'no-loop-func': WARNING, - 'no-mixed-operators': [WARNING, { + 'array-callback-return': 'warn', + 'default-case': ['warn', { commentPattern: '^no default$' }], + 'dot-location': ['warn', 'property'], + eqeqeq: ['warn', 'allow-null'], + 'guard-for-in': 'warn', + 'new-cap': ['warn', { newIsCap: true }], + 'new-parens': 'warn', + 'no-array-constructor': 'warn', + 'no-caller': 'warn', + 'no-cond-assign': ['warn', 'always'], + 'no-const-assign': 'warn', + 'no-control-regex': 'warn', + 'no-delete-var': 'warn', + 'no-dupe-args': 'warn', + 'no-dupe-class-members': 'warn', + 'no-dupe-keys': 'warn', + 'no-duplicate-case': 'warn', + 'no-empty-character-class': 'warn', + 'no-empty-pattern': 'warn', + 'no-eval': 'warn', + 'no-ex-assign': 'warn', + 'no-extend-native': 'warn', + 'no-extra-bind': 'warn', + 'no-extra-label': 'warn', + 'no-fallthrough': 'warn', + 'no-func-assign': 'warn', + 'no-implied-eval': 'warn', + 'no-invalid-regexp': 'warn', + 'no-iterator': 'warn', + 'no-label-var': 'warn', + 'no-labels': ['warn', { allowLoop: false, allowSwitch: false }], + 'no-lone-blocks': 'warn', + 'no-loop-func': 'warn', + 'no-mixed-operators': ['warn', { groups: [ ['&', '|', '^', '~', '<<', '>>', '>>>'], ['==', '!=', '===', '!==', '>', '>=', '<', '<='], @@ -99,58 +97,58 @@ module.exports = { ], allowSamePrecedence: false }], - 'no-multi-str': WARNING, - 'no-native-reassign': WARNING, - 'no-negated-in-lhs': WARNING, - 'no-new-func': WARNING, - 'no-new-object': WARNING, - 'no-new-symbol': WARNING, - 'no-new-wrappers': WARNING, - 'no-obj-calls': WARNING, - 'no-octal': WARNING, - 'no-octal-escape': WARNING, - 'no-redeclare': WARNING, - 'no-regex-spaces': WARNING, + 'no-multi-str': 'warn', + 'no-native-reassign': 'warn', + 'no-negated-in-lhs': 'warn', + 'no-new-func': 'warn', + 'no-new-object': 'warn', + 'no-new-symbol': 'warn', + 'no-new-wrappers': 'warn', + 'no-obj-calls': 'warn', + 'no-octal': 'warn', + 'no-octal-escape': 'warn', + 'no-redeclare': 'warn', + 'no-regex-spaces': 'warn', 'no-restricted-syntax': [ - WARNING, + 'warn', 'LabeledStatement', 'WithStatement', ], - 'no-return-assign': WARNING, - 'no-script-url': WARNING, - 'no-self-assign': WARNING, - 'no-self-compare': WARNING, - 'no-sequences': WARNING, - 'no-shadow-restricted-names': WARNING, - 'no-sparse-arrays': WARNING, - 'no-this-before-super': WARNING, - 'no-throw-literal': WARNING, - 'no-undef': WARNING, - 'no-unexpected-multiline': WARNING, - 'no-unreachable': WARNING, - 'no-unused-expressions': WARNING, - 'no-unused-labels': WARNING, - 'no-unused-vars': [WARNING, { vars: 'local', args: 'none' }], - 'no-use-before-define': [WARNING, 'nofunc'], - 'no-useless-computed-key': WARNING, - 'no-useless-concat': WARNING, - 'no-useless-constructor': WARNING, - 'no-useless-escape': WARNING, - 'no-useless-rename': [WARNING, { + 'no-return-assign': 'warn', + 'no-script-url': 'warn', + 'no-self-assign': 'warn', + 'no-self-compare': 'warn', + 'no-sequences': 'warn', + 'no-shadow-restricted-names': 'warn', + 'no-sparse-arrays': 'warn', + 'no-this-before-super': 'warn', + 'no-throw-literal': 'warn', + 'no-undef': 'warn', + 'no-unexpected-multiline': 'warn', + 'no-unreachable': 'warn', + 'no-unused-expressions': 'warn', + 'no-unused-labels': 'warn', + 'no-unused-vars': ['warn', { vars: 'local', args: 'none' }], + 'no-use-before-define': ['warn', 'nofunc'], + 'no-useless-computed-key': 'warn', + 'no-useless-concat': 'warn', + 'no-useless-constructor': 'warn', + 'no-useless-escape': 'warn', + 'no-useless-rename': ['warn', { ignoreDestructuring: false, ignoreImport: false, ignoreExport: false, }], - 'no-with': WARNING, - 'no-whitespace-before-property': WARNING, - 'operator-assignment': [WARNING, 'always'], - radix: WARNING, - 'require-yield': WARNING, - 'rest-spread-spacing': [WARNING, 'never'], - strict: [WARNING, 'never'], - 'unicode-bom': [WARNING, 'never'], - 'use-isnan': WARNING, - 'valid-typeof': WARNING, + 'no-with': 'warn', + 'no-whitespace-before-property': 'warn', + 'operator-assignment': ['warn', 'always'], + radix: 'warn', + 'require-yield': 'warn', + 'rest-spread-spacing': ['warn', 'never'], + strict: ['warn', 'never'], + 'unicode-bom': ['warn', 'never'], + 'use-isnan': 'warn', + 'valid-typeof': 'warn', // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/ @@ -165,37 +163,37 @@ module.exports = { // When file A is saved, we want to invalidate all files that import it // *and* that currently have lint errors. This should fix the problem. - // 'import/default': WARNING, - // 'import/export': WARNING, - // 'import/named': WARNING, - // 'import/namespace': WARNING, - // 'import/no-amd': WARNING, - // 'import/no-duplicates': WARNING, - // 'import/no-extraneous-dependencies': WARNING, - // 'import/no-named-as-default': WARNING, - // 'import/no-named-as-default-member': WARNING, - // 'import/no-unresolved': [WARNING, { commonjs: true }], + // 'import/default': 'warn', + // 'import/export': 'warn', + // 'import/named': 'warn', + // 'import/namespace': 'warn', + // 'import/no-amd': 'warn', + // 'import/no-duplicates': 'warn', + // 'import/no-extraneous-dependencies': 'warn', + // 'import/no-named-as-default': 'warn', + // 'import/no-named-as-default-member': 'warn', + // 'import/no-unresolved': ['warn', { commonjs: true }], // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules - 'react/jsx-equals-spacing': [WARNING, 'never'], - 'react/jsx-no-duplicate-props': [WARNING, { ignoreCase: true }], - 'react/jsx-no-undef': WARNING, - 'react/jsx-pascal-case': [WARNING, { + 'react/jsx-equals-spacing': ['warn', 'never'], + 'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }], + 'react/jsx-no-undef': 'warn', + 'react/jsx-pascal-case': ['warn', { allowAllCaps: true, ignore: [], }], - 'react/jsx-uses-react': WARNING, - 'react/jsx-uses-vars': WARNING, - 'react/no-deprecated': WARNING, - 'react/no-direct-mutation-state': WARNING, - 'react/no-is-mounted': WARNING, - 'react/react-in-jsx-scope': WARNING, - 'react/require-render-return': WARNING, + 'react/jsx-uses-react': 'warn', + 'react/jsx-uses-vars': 'warn', + 'react/no-deprecated': 'warn', + 'react/no-direct-mutation-state': 'warn', + 'react/no-is-mounted': 'warn', + 'react/react-in-jsx-scope': 'warn', + 'react/require-render-return': 'warn', // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules - 'jsx-a11y/aria-role': WARNING, - 'jsx-a11y/img-has-alt': WARNING, - 'jsx-a11y/img-redundant-alt': WARNING, - 'jsx-a11y/no-access-key': WARNING + 'jsx-a11y/aria-role': 'warn', + 'jsx-a11y/img-has-alt': 'warn', + 'jsx-a11y/img-redundant-alt': 'warn', + 'jsx-a11y/no-access-key': 'warn' } }; -- GitLab