Skip to content

Use keyword warn in eslint config #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 27, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 104 additions & 106 deletions config/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
// Inspired by https://github.com/airbnb/javascript but less opinionated.

// We use eslint-loader so even warnings are very visibile.
// This is why we only use "WARNING" level for potential errors,
// This is why we only use "WARNING'" level for potential errors,
Copy link
Contributor

@gaearon gaearon Jul 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra apostrophe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no. 😢

// and we don't use "ERROR" level at all.

// 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,

Expand Down Expand Up @@ -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: [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
Expand All @@ -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/

Expand All @@ -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'
}
};