From 1933ecbd952d02567a2465dd6fb612b22bf7dc74 Mon Sep 17 00:00:00 2001 From: Emmanuel Chambon Date: Mon, 27 Dec 2021 11:29:25 +0100 Subject: [PATCH 1/2] feat(eslint-config): enable prefer-object-has-own --- packages/eslint-config-react/package.json | 4 ++-- packages/eslint-config-react/shared.js | 5 +++++ yarn.lock | 14 +++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/eslint-config-react/package.json b/packages/eslint-config-react/package.json index 5cb820883..521aa9946 100644 --- a/packages/eslint-config-react/package.json +++ b/packages/eslint-config-react/package.json @@ -19,7 +19,7 @@ "dependencies": { "@typescript-eslint/eslint-plugin": "5.8.1", "@typescript-eslint/parser": "5.8.1", - "eslint-config-airbnb": "19.0.2", + "eslint-config-airbnb": "19.0.4", "eslint-config-airbnb-typescript": "16.1.0", "eslint-config-prettier": "8.3.0", "eslint-plugin-eslint-comments": "3.2.0", @@ -29,6 +29,6 @@ "eslint-plugin-react-hooks": "4.3.0" }, "peerDependencies": { - "eslint": "7.x || 8.x" + "eslint": ">= 8.5" } } diff --git a/packages/eslint-config-react/shared.js b/packages/eslint-config-react/shared.js index 7bb5a30f7..7723d3002 100644 --- a/packages/eslint-config-react/shared.js +++ b/packages/eslint-config-react/shared.js @@ -1,3 +1,5 @@ +/* eslint-disable sort-keys */ + module.exports = { extends: ['airbnb/hooks', 'prettier', 'plugin:eslint-comments/recommended'], rules: { @@ -57,6 +59,7 @@ module.exports = { // These are rules soon to be enabled by airbnb react config // We're getting a head start 'react/no-adjacent-inline-elements': 'error', // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md + 'prefer-object-has-own': 'off', // https://eslint.org/docs/rules/prefer-object-has-own // To have consistent ordering in proptypes 'react/sort-prop-types': [ @@ -76,3 +79,5 @@ module.exports = { 'sort-keys': ['error', 'asc', { caseSensitive: false, natural: true }], }, } + +/* eslint-enable sort-keys */ diff --git a/yarn.lock b/yarn.lock index 820fab2db..26aa71edc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3151,7 +3151,7 @@ __metadata: dependencies: "@typescript-eslint/eslint-plugin": 5.8.1 "@typescript-eslint/parser": 5.8.1 - eslint-config-airbnb: 19.0.2 + eslint-config-airbnb: 19.0.4 eslint-config-airbnb-typescript: 16.1.0 eslint-config-prettier: 8.3.0 eslint-plugin-eslint-comments: 3.2.0 @@ -3160,7 +3160,7 @@ __metadata: eslint-plugin-react: 7.28.0 eslint-plugin-react-hooks: 4.3.0 peerDependencies: - eslint: 7.x || 8.x + eslint: ">= 8.5" languageName: unknown linkType: soft @@ -5493,9 +5493,9 @@ __metadata: languageName: node linkType: hard -"eslint-config-airbnb@npm:19.0.2": - version: 19.0.2 - resolution: "eslint-config-airbnb@npm:19.0.2" +"eslint-config-airbnb@npm:19.0.4": + version: 19.0.4 + resolution: "eslint-config-airbnb@npm:19.0.4" dependencies: eslint-config-airbnb-base: ^15.0.0 object.assign: ^4.1.2 @@ -5504,9 +5504,9 @@ __metadata: eslint: ^7.32.0 || ^8.2.0 eslint-plugin-import: ^2.25.3 eslint-plugin-jsx-a11y: ^6.5.1 - eslint-plugin-react: ^7.27.1 + eslint-plugin-react: ^7.28.0 eslint-plugin-react-hooks: ^4.3.0 - checksum: 668d91fee4d8e1b7ecefc3844caed6bb77a72b29521dd9595a14abaebb8651439b831da792614b51e7913bbe3b6d20df03e76f52287ccf511dee1982460d3f71 + checksum: 253178689c3c80eef2567e3aaf0612e18973bc9cf51d9be36074b5dd58210e8b6942200a424bcccbb81ac884e41303479ab09f251a2a97addc2de61efdc9576c languageName: node linkType: hard From 0315e919633c05e3f68b64d23cf26ca8d55f5664 Mon Sep 17 00:00:00 2001 From: Emmanuel Chambon Date: Mon, 27 Dec 2021 13:44:07 +0100 Subject: [PATCH 2/2] fix: enable rule --- packages/eslint-config-react/shared.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-react/shared.js b/packages/eslint-config-react/shared.js index 7723d3002..837f05304 100644 --- a/packages/eslint-config-react/shared.js +++ b/packages/eslint-config-react/shared.js @@ -59,7 +59,7 @@ module.exports = { // These are rules soon to be enabled by airbnb react config // We're getting a head start 'react/no-adjacent-inline-elements': 'error', // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md - 'prefer-object-has-own': 'off', // https://eslint.org/docs/rules/prefer-object-has-own + 'prefer-object-has-own': 'error', // https://eslint.org/docs/rules/prefer-object-has-own // To have consistent ordering in proptypes 'react/sort-prop-types': [