From 6ad34051618cd0261bc70b37dfdf43fadc76bd49 Mon Sep 17 00:00:00 2001 From: Uku Pattak Date: Thu, 10 Nov 2016 15:31:21 +0200 Subject: [PATCH 1/3] Remove recommended react rules extending and add rules that were extended before --- index.js | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index c63c639..46bd69d 100644 --- a/index.js +++ b/index.js @@ -68,25 +68,34 @@ const es6Rules = { }; const reactRules = { - "display-name": 0, - "prop-types": 0, + "no-deprecated": 2, - "no-find-dom-node": 0, + "no-direct-mutation-state": 2, - "jsx-closing-bracket-location": [2, "line-aligned"], + "no-find-dom-node": 2, - "jsx-indent": [2, 4], + "no-is-mounted": 2, - "jsx-indent-props": [2, 4], + "no-render-return-value": 2, - "style-prop-object": 2, + "no-string-refs": 2, - "self-closing-comp": 2, + "no-unknown-property": 2, "prefer-es6-class": 2, - "no-string-refs": 2, + "react-in-jsx-scope": 2, + + "self-closing-comp": 2, + + "style-prop-object": 2, + + "jsx-closing-bracket-location": [2, "line-aligned"], + + "jsx-indent": [2, 4], + + "jsx-indent-props": [2, 4], "jsx-space-before-closing": 2, @@ -96,15 +105,22 @@ const reactRules = { "jsx-pascal-case": 2, - "jsx-max-props-per-line": [2, { maximum: 5 }], + "jsx-max-props-per-line": [2, { maximum: 3 }], + + "jsx-no-duplicate-props": 2, + + "jsx-no-undef": 2, + + "jsx-uses-react": 2, + + "jsx-uses-vars": 2, "jsx-wrap-multilines": 2, }; module.exports = { extends: [ - "eslint:recommended", - "plugin:react/recommended" + "eslint:recommended" ], env: { @@ -129,4 +145,4 @@ module.exports = { es6Rules, Object.keys(reactRules).reduce((result, key) => (result[`react/${key}`] = reactRules[key], result), {}) ), -}; \ No newline at end of file +}; From e8b1b08c2c530fafffc3b29cd390b97d3218aab8 Mon Sep 17 00:00:00 2001 From: Uku Pattak Date: Thu, 10 Nov 2016 16:01:29 +0200 Subject: [PATCH 2/3] Remove recommended eslint rules extending and add rules that were extended before --- index.js | 129 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 109 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index 46bd69d..db56d02 100644 --- a/index.js +++ b/index.js @@ -1,59 +1,151 @@ const never = "never"; const always = "always"; -const bestPractices = { +const possibleErrorRules = { + "no-cond-assign": 2, + + "no-console": 2, + + "no-constant-condition": 2, + + "no-control-regex": 2, + + "no-debugger": 2, + + "no-dupe-args": 2, + + "no-dupe-keys": 2, + + "no-duplicate-case": 2, + + "no-empty": 2, + + "no-empty-character-class": 2, + + "no-ex-assign": 2, + + "no-extra-boolean-cast": 2, + + "no-extra-semi": 2, + + "no-func-assign": 2, + + "no-inner-declarations": 2, + + "no-invalid-regexp": 2, + + "no-irregular-whitespace": 2, + + "no-obj-calls": 2, + + "no-regex-spaces": 2, + + "no-sparse-arrays": 2, + + "no-unexpected-multiline": 2, + + "no-unreachable": 2, + + "no-unsafe-finally": 2, + + "no-unsafe-negation": 2, + + "use-isnan": 2, + + "valid-typeof": 2, +}; + +const bestPracticeRules = { "curly": 2, "guard-for-in": 2, - "no-void": 2, + "no-alert": 2, - "radix": 2, + "no-bitwise": 2, - "no-alert": 2, + "no-case-declarations": 2, - "eol-last": 2, + "no-empty-pattern": 2, - "no-bitwise": 2, + "no-fallthrough": 2, + + "no-multi-spaces": 2, + + "no-octal": 2, + + "no-redeclare": 2, + + "no-self-assign": 2, + + "no-unused-labels": 2, + + "no-void": 2, + + "radix": 2, +}; + +const strictModeRules = { + "strict": 2, }; const variablesRules = { + "no-delete-var": 2, + + "no-undef": 2, + + "no-unused-vars": 2, + "no-use-before-define": [2, "nofunc"], }; const styleRules = { "brace-style": [2, "stroustrup", { allowSingleLine: true }], + "eol-last": 2, + "indent": [2, 4, { SwitchCase: 1 }], + "keyword-spacing": 2, + "linebreak-style": [2, "unix"], - "space-infix-ops": 2, + "max-len": [2, 205, 4], + + "no-mixed-spaces-and-tabs": 2, "no-multiple-empty-lines": [2, { max: 1 }], "one-var": [2, never], - "no-multi-spaces": 2, - "operator-linebreak": [2, "after"], - "keyword-spacing": 2, - "space-before-blocks": 2, "space-before-function-paren": [2, never], "spaced-comment": 2, - "max-len": [2, 205, 4], + "space-infix-ops": 2, }; const es6Rules = { "arrow-spacing": 2, + "constructor-super": 2, + + "no-class-assign": 2, + + "no-const-assign": 2, + + "no-dupe-class-members": 2, + "no-duplicate-imports": 2, + "no-new-symbol": 2, + + "no-this-before-super": 2, + "no-useless-constructor": 2, "no-var": 2, @@ -64,11 +156,10 @@ const es6Rules = { "prefer-spread": 2, - "arrow-parens": [2, "as-needed"], + "require-yield": 2, }; const reactRules = { - "no-deprecated": 2, "no-direct-mutation-state": 2, @@ -105,7 +196,7 @@ const reactRules = { "jsx-pascal-case": 2, - "jsx-max-props-per-line": [2, { maximum: 3 }], + "jsx-max-props-per-line": [2, { maximum: 5 }], "jsx-no-duplicate-props": 2, @@ -119,10 +210,6 @@ const reactRules = { }; module.exports = { - extends: [ - "eslint:recommended" - ], - env: { browser: true, node: true, @@ -139,7 +226,9 @@ module.exports = { rules: Object.assign( {}, - bestPractices, + possibleErrorRules, + bestPracticeRules, + strictModeRules, variablesRules, styleRules, es6Rules, From a0dd08e6e28bfb04ba5414d92ebe1d87d3ce8339 Mon Sep 17 00:00:00 2001 From: Uku Pattak Date: Thu, 10 Nov 2016 16:33:01 +0200 Subject: [PATCH 3/3] Remove strict mode rule --- index.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/index.js b/index.js index db56d02..a5de72c 100644 --- a/index.js +++ b/index.js @@ -85,10 +85,6 @@ const bestPracticeRules = { "radix": 2, }; -const strictModeRules = { - "strict": 2, -}; - const variablesRules = { "no-delete-var": 2, @@ -228,7 +224,6 @@ module.exports = { {}, possibleErrorRules, bestPracticeRules, - strictModeRules, variablesRules, styleRules, es6Rules,