From bdf11e562fc8012d25b2d61cc3bc619d7f0ea59d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Fri, 7 Aug 2020 05:48:46 -0400 Subject: [PATCH] chore: tweak eslint rules for react/ts --- .eslintrc.js | 14 +++++++++++--- package-lock.json | 48 +++++++++++++++++------------------------------ package.json | 1 + 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 625bea8..2fbdbf2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,7 +12,12 @@ https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FA Happy linting! 💖 */ module.exports = { - extends: ["prettier", "prettier/@typescript-eslint"], + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "prettier", + "prettier/@typescript-eslint", + ], parser: "@typescript-eslint/parser", parserOptions: { project: "tsconfig.json", @@ -90,8 +95,10 @@ module.exports = { "no-param-reassign": "error", "@typescript-eslint/no-parameter-properties": "off", "@typescript-eslint/no-this-alias": "error", - "@typescript-eslint/no-unused-expressions": "error", - "@typescript-eslint/no-unused-vars": "error", + "no-unused-expressions": "error", + "@typescript-eslint/no-unused-expressions": ["error"], + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error"], "@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-var-requires": "error", "@typescript-eslint/prefer-for-of": "error", @@ -183,6 +190,7 @@ module.exports = { "prefer-object-spread": "error", "quote-props": "off", radix: "error", + "react/prop-types": "off", "react/jsx-curly-spacing": "off", "react/jsx-equals-spacing": "off", "space-before-function-paren": "off", diff --git a/package-lock.json b/package-lock.json index 2dd8742..133b953 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,15 +1163,6 @@ "regenerator-runtime": "^0.13.4" } }, - "@babel/runtime-corejs3": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.10.0.tgz", - "integrity": "sha512-PB3yRdxniprLsntC6Rm7qIGDb368LWCTNicBXMcTHvrx8MjroYIWkWHng4b7Scbfmn0fDTxiRjiepzw5rDKTFQ==", - "requires": { - "core-js-pure": "^3.0.0", - "regenerator-runtime": "^0.13.4" - } - }, "@babel/standalone": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/@babel/standalone/-/standalone-7.10.0.tgz", @@ -4518,7 +4509,6 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz", "integrity": "sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg==", - "dev": true, "requires": { "define-properties": "^1.1.3", "es-abstract": "^1.17.0-next.1", @@ -6813,11 +6803,6 @@ } } }, - "core-js-pure": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz", - "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==" - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -8807,21 +8792,21 @@ "dev": true }, "eslint-plugin-react": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.0.tgz", - "integrity": "sha512-rqe1abd0vxMjmbPngo4NaYxTcR3Y4Hrmc/jg4T+sYz63yqlmJRknpEQfmWY+eDWPuMmix6iUIK+mv0zExjeLgA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.5.tgz", + "integrity": "sha512-ajbJfHuFnpVNJjhyrfq+pH1C0gLc2y94OiCbAXT5O0J0YCKaFEHDV8+3+mDOr+w8WguRX+vSs1bM2BDG0VLvCw==", "requires": { "array-includes": "^3.1.1", + "array.prototype.flatmap": "^1.2.3", "doctrine": "^2.1.0", "has": "^1.0.3", - "jsx-ast-utils": "^2.2.3", - "object.entries": "^1.1.1", + "jsx-ast-utils": "^2.4.1", + "object.entries": "^1.1.2", "object.fromentries": "^2.0.2", "object.values": "^1.1.1", "prop-types": "^15.7.2", - "resolve": "^1.15.1", - "string.prototype.matchall": "^4.0.2", - "xregexp": "^4.3.0" + "resolve": "^1.17.0", + "string.prototype.matchall": "^4.0.2" }, "dependencies": { "doctrine": { @@ -8831,6 +8816,15 @@ "requires": { "esutils": "^2.0.2" } + }, + "jsx-ast-utils": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz", + "integrity": "sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w==", + "requires": { + "array-includes": "^3.1.1", + "object.assign": "^4.1.0" + } } } }, @@ -22381,14 +22375,6 @@ "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" }, - "xregexp": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.3.0.tgz", - "integrity": "sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==", - "requires": { - "@babel/runtime-corejs3": "^7.8.3" - } - }, "xstate": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.9.1.tgz", diff --git a/package.json b/package.json index 2166f4e..8aa979e 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsdoc": "^30.2.1", "eslint-plugin-prefer-arrow": "^1.2.2", + "eslint-plugin-react": "^7.20.5", "gatsby-plugin-remove-trailing-slashes": "^2.3.3", "prettier": "^2.0.5", "tslint": "^6.1.2",