From 67dfc02e4cbb608fedfb4b1e67acb6c47db52404 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sun, 22 Jul 2018 01:51:22 +0800 Subject: [PATCH] Update rules for eslint 5 --- rules/base.js | 7 +++++++ rules/import.js | 1 + rules/jsx-a11y.js | 5 ++++- rules/react.js | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rules/base.js b/rules/base.js index c5d58a2..a5c8358 100644 --- a/rules/base.js +++ b/rules/base.js @@ -33,6 +33,7 @@ module.exports = { 'beforeColon': false, 'afterColon': true }], + 'max-classes-per-file': [2, 1], 'max-len': [1, 160, 4, { 'ignoreComments': true, 'ignoreUrls': true, @@ -40,6 +41,11 @@ module.exports = { 'ignoreTemplateLiterals': true, 'ignoreRegExpLiterals': true }], + 'max-lines-per-function': [1, { + 'max': 200, + 'skipBlankLines': true, + 'skipComments': true + }], 'new-cap': [2, { 'newIsCap': true, 'capIsNew': false }], 'new-parens': 2, 'no-alert': 2, @@ -83,6 +89,7 @@ module.exports = { 'one-var-declaration-per-line': 0, 'prefer-const': 0, 'prefer-destructuring': 0, + 'prefer-object-spread': 0, 'prefer-promise-reject-errors': [1, { 'allowEmptyReject': true }], diff --git a/rules/import.js b/rules/import.js index 6a83f7a..0cefabd 100644 --- a/rules/import.js +++ b/rules/import.js @@ -4,6 +4,7 @@ module.exports = { 'import/newline-after-import': 2, 'import/no-extraneous-dependencies': 0, 'import/no-named-as-default': 2, + 'import/no-relative-parent-imports': 0, 'import/no-webpack-loader-syntax': 0, 'import/prefer-default-export': 0 } diff --git a/rules/jsx-a11y.js b/rules/jsx-a11y.js index 9d95d55..c1104b3 100644 --- a/rules/jsx-a11y.js +++ b/rules/jsx-a11y.js @@ -60,7 +60,10 @@ module.exports = { // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md 'jsx-a11y/interactive-supports-focus': 'error', - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md + 'jsx-a11y/label-has-associated-control': 'off', + + // [deprecated] https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md 'jsx-a11y/label-has-for': ['off', { components: ['label'] }], // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md diff --git a/rules/react.js b/rules/react.js index 7311197..8529716 100644 --- a/rules/react.js +++ b/rules/react.js @@ -39,6 +39,7 @@ module.exports = { 'react/no-string-refs': 1, 'react/no-typos': 1, 'react/no-unknown-property': 1, + 'react/no-unsafe': 1, 'react/no-unused-prop-types': 0, 'react/no-unused-state': 0, 'react/prefer-stateless-function': 1,