From 12d08b38dc1351df120008b1e3f1f4192b91e81d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 17 Apr 2016 13:05:01 -0700 Subject: [PATCH] [eslint config] Add missing disabled rules. --- .../rules/best-practices.js | 8 +++++ packages/eslint-config-airbnb/rules/errors.js | 1 + packages/eslint-config-airbnb/rules/es6.js | 32 ++++++++++++++++++- .../eslint-config-airbnb/rules/react-a11y.js | 23 +++++++++++++ packages/eslint-config-airbnb/rules/react.js | 2 ++ packages/eslint-config-airbnb/rules/style.js | 9 ++++++ 6 files changed, 74 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb/rules/best-practices.js b/packages/eslint-config-airbnb/rules/best-practices.js index adda7f6e..4543fe9e 100644 --- a/packages/eslint-config-airbnb/rules/best-practices.js +++ b/packages/eslint-config-airbnb/rules/best-practices.js @@ -77,6 +77,14 @@ module.exports = { 'no-lone-blocks': 2, // disallow creation of functions within loops 'no-loop-func': 2, + // disallow magic numbers + // http://eslint.org/docs/rules/no-magic-numbers + 'no-magic-numbers': [0, { + 'ignore': [], + 'ignoreArrayIndexes': true, + 'enforceConst': true, + 'detectObjects': false, + }], // disallow use of multiple spaces 'no-multi-spaces': 2, // disallow use of multiline strings diff --git a/packages/eslint-config-airbnb/rules/errors.js b/packages/eslint-config-airbnb/rules/errors.js index 62594e0c..73fd7d4f 100644 --- a/packages/eslint-config-airbnb/rules/errors.js +++ b/packages/eslint-config-airbnb/rules/errors.js @@ -49,6 +49,7 @@ module.exports = { // disallow comparisons with the value NaN 'use-isnan': 2, // ensure JSDoc comments are valid + // http://eslint.org/docs/rules/valid-jsdoc 'valid-jsdoc': 0, // ensure that the results of typeof are compared against a valid string 'valid-typeof': 2, diff --git a/packages/eslint-config-airbnb/rules/es6.js b/packages/eslint-config-airbnb/rules/es6.js index 7ac09522..0f5900e4 100644 --- a/packages/eslint-config-airbnb/rules/es6.js +++ b/packages/eslint-config-airbnb/rules/es6.js @@ -92,7 +92,37 @@ module.exports = { 'import/export': 2, // ensure imports point to files/modules that can be resolved // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md - 'import/no-unresolved': [2, { 'commonjs': true }] + 'import/no-unresolved': [2, { 'commonjs': true }], + // ensure default import coupled with default export + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it + 'import/default': 0, + // ensure named imports coupled with named exports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it + 'import/named': 0, + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md + 'import/namespace': 0, + // do not allow a default import name to match a named export + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md + // TODO: enable + 'import/no-named-as-default': 0, + // disallow require() + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md + 'import/no-commonjs': 0, + // disallow AMD require/define + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md + // TODO: enable + 'import/no-amd': 0, + // disallow non-import statements appearing before import statements + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md + // TODO: enable? + 'import/imports-first': [0, 'absolute-first'], + // disallow duplicate imports + // TODO: enable + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md + 'import/no-duplicates': 0, + // disallow use of jsdoc-marked-deprecated imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md + 'import/no-deprecated': 0, }, 'settings': { 'import/resolver': { diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index d9663119..86475656 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -22,5 +22,28 @@ module.exports = { // Require ARIA roles to be valid and non-abstract // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/valid-aria-role.md 'jsx-a11y/valid-aria-role': 2, + + // require that JSX labels use "htmlFor" + // TODO: enable + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-uses-for.md + 'jsx-a11y/label-uses-for': 0, + + // require that mouseover/out come with focus/blur, for keyboard-only users + // TODO: enable? + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-map-to-key-events.md + 'jsx-a11y/mouse-events-map-to-key-events': 0, + + // disallow href "#" + // TODO: enable + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-hash-href.md + 'jsx-a11y/no-hash-href': 0, + + // require things with onClick to have an aria role + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/onclick-uses-role.md + 'jsx-a11y/onclick-uses-role': 0, + + // require onBlur instead of onChange + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/use-onblur-not-onchange.md + 'jsx-a11y/use-onblur-not-onchange': 0, }, }; diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index c483b3b8..521508c5 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -63,6 +63,8 @@ module.exports = { 'ignoreCase': false, 'callbacksLast': false, }], + // deprecated in favor of react/jsx-sort-props + 'react/jsx-sort-prop-types': 0, // Enforce props alphabetical sorting // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md 'react/jsx-sort-props': [0, { diff --git a/packages/eslint-config-airbnb/rules/style.js b/packages/eslint-config-airbnb/rules/style.js index df35c3cf..d10ee7fb 100644 --- a/packages/eslint-config-airbnb/rules/style.js +++ b/packages/eslint-config-airbnb/rules/style.js @@ -56,6 +56,9 @@ module.exports = { }], // specify the maximum depth callbacks can be nested 'max-nested-callbacks': 0, + // restrict the number of statements per line + // http://eslint.org/docs/rules/max-statements-per-line + 'max-statements-per-line': [0, { 'max': 1 }], // require a capital letter for constructors 'new-cap': [2, { 'newIsCap': true }], // disallow the omission of parentheses when invoking a constructor with no arguments @@ -80,6 +83,9 @@ module.exports = { 'no-mixed-spaces-and-tabs': 2, // disallow multiple empty lines and only one newline at the end 'no-multiple-empty-lines': [2, { 'max': 2, 'maxEOF': 1 }], + // disallow negated conditions + // http://eslint.org/docs/rules/no-negated-condition + 'no-negated-condition': 0, // disallow nested ternary expressions 'no-nested-ternary': 2, // disallow use of the Object constructor @@ -119,6 +125,9 @@ module.exports = { 'quotes': [2, 'single', 'avoid-escape'], // require identifiers to match the provided regular expression 'id-match': 0, + // do not require jsdoc + // http://eslint.org/docs/rules/require-jsdoc + 'require-jsdoc': 0, // enforce spacing before and after semicolons 'semi-spacing': [2, { 'before': false, 'after': true }], // require or disallow use of semicolons instead of ASI