From 951be4a34e4a4290f26926b3141b95978ada0683 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 31 Oct 2024 16:40:18 +0100 Subject: [PATCH] feat: add react-compiler eslint plugin (#37139) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Added react-compiler eslint plugin as the first step in preparation for adding React Compiler https://react.dev/learn/react-compiler#installing-eslint-plugin-react-compiler Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 89b1e8f4e66fce7ed11d540b8f1e549d60f676d1 > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Thu, 31 Oct 2024 14:48:54 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced linting capabilities with the addition of the `eslint-plugin-react-compiler` for improved React code quality. - **Chores** - Updated ESLint configuration to include a new rule for the React compiler, issuing warnings to maintain coding standards. - Added `eslint-plugin-react-compiler` as a new development dependency. --- app/client/.eslintrc.base.json | 2 + app/client/package.json | 1 + app/client/yarn.lock | 81 ++++++++++++++++++++++------------ 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/app/client/.eslintrc.base.json b/app/client/.eslintrc.base.json index 14f56a137537..8b4f5036e02e 100644 --- a/app/client/.eslintrc.base.json +++ b/app/client/.eslintrc.base.json @@ -11,6 +11,7 @@ ], "plugins": [ "react", + "eslint-plugin-react-compiler", "@typescript-eslint", "prettier", "sort-destructure-keys", @@ -41,6 +42,7 @@ "project": "./tsconfig.json" }, "rules": { + "react-compiler/react-compiler": "warn", "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "*", "next": "return" }, diff --git a/app/client/package.json b/app/client/package.json index add895688c86..9b822e0f11ae 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -321,6 +321,7 @@ "eslint-plugin-jest": "^27.4.2", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-compiler": "beta", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-perf": "^3.3.2", "eslint-plugin-sort-destructure-keys": "^1.5.0", diff --git a/app/client/yarn.lock b/app/client/yarn.lock index da11c6eb1932..b0977ec08747 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -1263,17 +1263,17 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/helper-string-parser@npm:7.24.8" - checksum: 39b03c5119216883878655b149148dc4d2e284791e969b19467a9411fccaa33f7a713add98f4db5ed519535f70ad273cdadfd2eb54d47ebbdeac5083351328ce +"@babel/helper-string-parser@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-string-parser@npm:7.25.9" + checksum: 6435ee0849e101681c1849868278b5aee82686ba2c1e27280e5e8aca6233af6810d39f8e4e693d2f2a44a3728a6ccfd66f72d71826a94105b86b731697cdfa99 languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-validator-identifier@npm:7.24.7" - checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257 +"@babel/helper-validator-identifier@npm:^7.24.7, @babel/helper-validator-identifier@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-validator-identifier@npm:7.25.9" + checksum: 5b85918cb1a92a7f3f508ea02699e8d2422fe17ea8e82acd445006c0ef7520fbf48e3dbcdaf7b0a1d571fc3a2715a29719e5226636cb6042e15fe6ed2a590944 languageName: node linkType: hard @@ -1318,14 +1318,14 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.3": - version: 7.25.3 - resolution: "@babel/parser@npm:7.25.3" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.24.4, @babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.3": + version: 7.26.1 + resolution: "@babel/parser@npm:7.26.1" dependencies: - "@babel/types": ^7.25.2 + "@babel/types": ^7.26.0 bin: parser: ./bin/babel-parser.js - checksum: b55aba64214fa1d66ccd0d29f476d2e55a48586920d280f88c546f81cbbececc0e01c9d05a78d6bf206e8438b9c426caa344942c1a581eecc4d365beaab8a20e + checksum: 354320d1a0a7102b2f25620ceea1bbc809f5225432a73e8a8874009d2f82ed29e2b035fe68fb6d18bb7eafed78df1ec0fa12e8d8226b295d7a020f9b852de653 languageName: node linkType: hard @@ -1456,7 +1456,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-private-methods@npm:^7.16.0": +"@babel/plugin-proposal-private-methods@npm:^7.16.0, @babel/plugin-proposal-private-methods@npm:^7.18.6": version: 7.18.6 resolution: "@babel/plugin-proposal-private-methods@npm:7.18.6" dependencies: @@ -2670,14 +2670,13 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.0.0-beta.49, @babel/types@npm:^7.12.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.22.5, @babel/types@npm:^7.24.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": - version: 7.25.2 - resolution: "@babel/types@npm:7.25.2" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.0.0-beta.49, @babel/types@npm:^7.12.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.22.5, @babel/types@npm:^7.24.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.26.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": + version: 7.26.0 + resolution: "@babel/types@npm:7.26.0" dependencies: - "@babel/helper-string-parser": ^7.24.8 - "@babel/helper-validator-identifier": ^7.24.7 - to-fast-properties: ^2.0.0 - checksum: f73f66ba903c6f7e38f519a33d53a67d49c07e208e59ea65250362691dc546c6da7ab90ec66ee79651ef697329872f6f97eb19a6dfcacc026fd05e76a563c5d2 + "@babel/helper-string-parser": ^7.25.9 + "@babel/helper-validator-identifier": ^7.25.9 + checksum: a3dd37dabac693018872da96edb8c1843a605c1bfacde6c3f504fba79b972426a6f24df70aa646356c0c1b19bdd2c722c623c684a996c002381071680602280d languageName: node linkType: hard @@ -13009,6 +13008,7 @@ __metadata: eslint-plugin-jest: ^27.4.2 eslint-plugin-prettier: ^5.0.0 eslint-plugin-react: ^7.33.2 + eslint-plugin-react-compiler: beta eslint-plugin-react-hooks: ^4.6.0 eslint-plugin-react-perf: ^3.3.2 eslint-plugin-sort-destructure-keys: ^1.5.0 @@ -18171,6 +18171,22 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-react-compiler@npm:beta": + version: 19.0.0-beta-6fc168f-20241025 + resolution: "eslint-plugin-react-compiler@npm:19.0.0-beta-6fc168f-20241025" + dependencies: + "@babel/core": ^7.24.4 + "@babel/parser": ^7.24.4 + "@babel/plugin-proposal-private-methods": ^7.18.6 + hermes-parser: ^0.20.1 + zod: ^3.22.4 + zod-validation-error: ^3.0.3 + peerDependencies: + eslint: ">=7" + checksum: 9595934e48b75ea964bde98b479abd5b8554d33fcefade0cf419d2707602b1f64652b9dd4854d4bc71e21a1b186143293a4aed1ac144d8e1460396f4d9274934 + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^4.3.0, eslint-plugin-react-hooks@npm:^4.6.0": version: 4.6.0 resolution: "eslint-plugin-react-hooks@npm:4.6.0" @@ -20342,6 +20358,22 @@ __metadata: languageName: node linkType: hard +"hermes-estree@npm:0.20.1": + version: 0.20.1 + resolution: "hermes-estree@npm:0.20.1" + checksum: 226378c62e29a79f8e0935cc8bdefd987195c069b835a9ed1cae08109cd228f6e97a2e580d5de057e4437dc988c972b9fe7227a1d9353dc2abbe142dbd5260c6 + languageName: node + linkType: hard + +"hermes-parser@npm:^0.20.1": + version: 0.20.1 + resolution: "hermes-parser@npm:0.20.1" + dependencies: + hermes-estree: 0.20.1 + checksum: 2a0c17b5f8fbb0a377f42d480f577b5cc64eafe4d5ebc0a9cbce23b79a02042693134bef1b71163f771d67cd10a450138c8d24b9a431c487fa9ed57cba67e85c + languageName: node + linkType: hard + "hexoid@npm:^1.0.0": version: 1.0.0 resolution: "hexoid@npm:1.0.0" @@ -32432,13 +32464,6 @@ __metadata: languageName: node linkType: hard -"to-fast-properties@npm:^2.0.0": - version: 2.0.0 - resolution: "to-fast-properties@npm:2.0.0" - checksum: be2de62fe58ead94e3e592680052683b1ec986c72d589e7b21e5697f8744cdbf48c266fa72f6c15932894c10187b5f54573a3bcf7da0bfd964d5caf23d436168 - languageName: node - linkType: hard - "to-no-case@npm:^1.0.0": version: 1.0.2 resolution: "to-no-case@npm:1.0.2"