From 4971ba47221fdf28445b04cf6945f8b5cc6cec0a Mon Sep 17 00:00:00 2001 From: Peter deHaan Date: Fri, 8 Sep 2017 09:02:54 -0700 Subject: [PATCH] Add react/recommended ESLint rules --- .eslintrc.json | 133 ++++++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8ca153cbc..d7ed3908e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,63 +1,74 @@ { - "env": { - "es6": true, - "node": true - }, - "extends": [ - "eslint:recommended" - ], - "parserOptions": { - "ecmaVersion": 2017 - }, - "plugins": [ - "promise", - "json" - ], - "rules": { - "indent": ["error", 2], - "no-console": "off", - "linebreak-style": ["error", "unix"], - "quotes": ["error", "single"], - "semi": ["error", "always"], - "no-template-curly-in-string": "warn", - "no-unsafe-negation": "warn", - "array-callback-return": "warn", - "arrow-parens": ["warn", "always"], - "template-curly-spacing": "warn", - "eqeqeq": ["error", "smart"], - "no-eval": "error", - "no-global-assign": "error", - "no-implied-eval": "error", - "lines-around-comment": ["warn", {"beforeLineComment": true}], - "spaced-comment": ["warn", "always", {"line": {"exceptions": ["-", "="]}}], - "no-script-url": "error", - "no-throw-literal": "error", - "yoda": "warn", - "no-path-concat": "error", - "eol-last": "warn", - "no-nested-ternary": "warn", - "no-tabs": "error", - "no-unneeded-ternary": "warn", - "object-curly-spacing": "warn", - "space-infix-ops": ["error"], - "space-in-parens": ["error", "never"], - "space-unary-ops": ["error", {"words": true, "nonwords": false}], - "no-const-assign": "error", - "no-duplicate-imports": "error", - "prefer-template": "warn", - "comma-spacing": ["error", {"after": true}], - "no-var": "error", - "no-lonely-if": "error", - "curly": "error", - "no-unused-vars": ["error", {"argsIgnorePattern": "^_|next", "varsIgnorePattern": "^_"}], - "no-multiple-empty-lines": ["error", {"max": 1}], - "newline-per-chained-call": ["error", {"ignoreChainWithDepth": 2}], - "promise/no-return-wrap": "error", - "promise/param-names": "error", - "promise/catch-or-return": "warn", - "promise/no-native": "off", - "promise/no-nesting": "warn", - "promise/no-promise-in-callback": "warn", - "promise/no-callback-in-promise": "warn" - } + "env": { + "es6": true, + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "parserOptions": { + "ecmaVersion": 2017 + }, + "plugins": [ + "json", + "promise", + "react" + ], + "rules": { + "promise/no-return-wrap": "error", + "promise/param-names": "error", + "promise/catch-or-return": "warn", + "promise/no-native": "off", + "promise/no-nesting": "warn", + "promise/no-promise-in-callback": "warn", + "promise/no-callback-in-promise": "warn", + + // TODO: Change all these to "error", or remove and use defaults. + "react/display-name": "off", + "react/jsx-no-duplicate-props": "warn", + "react/jsx-no-target-blank": "warn", + "react/no-find-dom-node": "warn", + "react/no-unknown-property": "warn", + "react/prop-types": "off", + + "array-callback-return": "warn", + "arrow-parens": ["warn", "always"], + "comma-spacing": ["error", {"after": true}], + "curly": "error", + "eol-last": "warn", + "eqeqeq": ["error", "smart"], + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], + "lines-around-comment": ["warn", {"beforeLineComment": true}], + "newline-per-chained-call": ["error", {"ignoreChainWithDepth": 2}], + "no-console": "off", + "no-const-assign": "error", + "no-duplicate-imports": "error", + "no-eval": "error", + "no-global-assign": "error", + "no-implied-eval": "error", + "no-lonely-if": "error", + "no-multiple-empty-lines": ["error", {"max": 1}], + "no-nested-ternary": "warn", + "no-path-concat": "error", + "no-script-url": "error", + "no-tabs": "error", + "no-template-curly-in-string": "warn", + "no-throw-literal": "error", + "no-unneeded-ternary": "warn", + "no-unsafe-negation": "warn", + "no-unused-vars": ["error", {"argsIgnorePattern": "^_|next", "varsIgnorePattern": "^_"}], + "no-var": "error", + "object-curly-spacing": "warn", + "prefer-template": "warn", + "quotes": ["error", "single"], + "semi": ["error", "always"], + "space-in-parens": ["error", "never"], + "space-infix-ops": ["error"], + "space-unary-ops": ["error", {"words": true, "nonwords": false}], + "spaced-comment": ["warn", "always", {"line": {"exceptions": ["-", "="]}}], + "template-curly-spacing": "warn", + "yoda": "warn" + } }