From 7c142a03b27315ba3e10649819ff5d2d17a074d6 Mon Sep 17 00:00:00 2001 From: Daniil Suvorov Date: Mon, 2 Sep 2024 10:08:26 +0300 Subject: [PATCH] feat: add eslint-plugin-react-compiler (#6920) --- .eslintrc.json | 5 ++-- package.json | 1 + yarn.lock | 65 ++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index eb8fb72425..61c4f09011 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,7 @@ "node": true }, "parser": "@typescript-eslint/parser", - "plugins": ["import", "unicorn"], + "plugins": ["import", "unicorn", "eslint-plugin-react-compiler"], "parserOptions": { "project": "./tsconfig.json", "ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features @@ -81,6 +81,7 @@ "curly": "error", // Enforce consistent brace style "eqeqeq": "error", // Only type-safe equality operators "unicorn/expiring-todo-comments": ["error"], - "no-console": "error" + "no-console": "error", + "react-compiler/react-compiler": 2 } } diff --git a/package.json b/package.json index 5093901082..226c5f4f4d 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "eslint-plugin-jest": "^28.2.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-compiler": "0.0.0-experimental-17e519c-20240806", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-unicorn": "^55.0.0", "husky": "^9.1.5", diff --git a/yarn.lock b/yarn.lock index 5fd031e39b..e8d4287125 100644 --- a/yarn.lock +++ b/yarn.lock @@ -127,7 +127,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.24.7": +"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-create-class-features-plugin@npm:7.24.7" dependencies: @@ -362,7 +362,7 @@ __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.24.7, @babel/parser@npm:^7.25.0, @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.24.7, @babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.3": version: 7.25.3 resolution: "@babel/parser@npm:7.25.3" dependencies: @@ -421,6 +421,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-proposal-private-methods@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/plugin-proposal-private-methods@npm:7.18.6" + dependencies: + "@babel/helper-create-class-features-plugin": "npm:^7.18.6" + "@babel/helper-plugin-utils": "npm:^7.18.6" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10/22d8502ee96bca99ad2c8393e8493e2b8d4507576dd054490fd8201a36824373440106f5b098b6d821b026c7e72b0424ff4aeca69ed5f42e48f029d3a156d5ad + languageName: node + linkType: hard + "@babel/plugin-proposal-private-property-in-object@npm:7.21.0-placeholder-for-preset-env.2": version: 7.21.0-placeholder-for-preset-env.2 resolution: "@babel/plugin-proposal-private-property-in-object@npm:7.21.0-placeholder-for-preset-env.2" @@ -4619,6 +4631,7 @@ __metadata: eslint-plugin-jest: "npm:^28.2.0" eslint-plugin-prettier: "npm:^5.2.1" eslint-plugin-react: "npm:^7.33.2" + eslint-plugin-react-compiler: "npm:0.0.0-experimental-17e519c-20240806" eslint-plugin-react-hooks: "npm:^4.6.2" eslint-plugin-unicorn: "npm:^55.0.0" husky: "npm:^9.1.5" @@ -8138,6 +8151,22 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-react-compiler@npm:0.0.0-experimental-17e519c-20240806": + version: 0.0.0-experimental-17e519c-20240806 + resolution: "eslint-plugin-react-compiler@npm:0.0.0-experimental-17e519c-20240806" + dependencies: + "@babel/core": "npm:^7.24.4" + "@babel/parser": "npm:^7.24.4" + "@babel/plugin-proposal-private-methods": "npm:^7.18.6" + hermes-parser: "npm:^0.20.1" + zod: "npm:^3.22.4" + zod-validation-error: "npm:^3.0.3" + peerDependencies: + eslint: ">=7" + checksum: 10/2a74d9af6fdf3c0be7768f6fb8533b093d69b3df0fc0bd179f8a712f562d6ec9d41585c8611e1e51e3f8881910adc0062121455bcb96f9a6dd45957938ffaabf + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^4.6.2": version: 4.6.2 resolution: "eslint-plugin-react-hooks@npm:4.6.2" @@ -9590,6 +9619,22 @@ __metadata: languageName: node linkType: hard +"hermes-estree@npm:0.20.1": + version: 0.20.1 + resolution: "hermes-estree@npm:0.20.1" + checksum: 10/b98fc2943bd9fdd904c094e995f79cb7d5958393e221006af81d88f3aed52ddbf15138a6606766d5e6be7ba166576be65f577d0c72ae5eb0f3f56d4720b32baa + languageName: node + linkType: hard + +"hermes-parser@npm:^0.20.1": + version: 0.20.1 + resolution: "hermes-parser@npm:0.20.1" + dependencies: + hermes-estree: "npm:0.20.1" + checksum: 10/b1ae9e9f6b49234fcf2bd45eafde140a3c727b8bcb845ab398016a538f040d326291d1f8b75fd91793b8817f2c600a890e251984d55bdedea74a5143d29f0c81 + languageName: node + linkType: hard + "hosted-git-info@npm:^2.1.4": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" @@ -18057,6 +18102,22 @@ __metadata: languageName: node linkType: hard +"zod-validation-error@npm:^3.0.3": + version: 3.3.0 + resolution: "zod-validation-error@npm:3.3.0" + peerDependencies: + zod: ^3.18.0 + checksum: 10/19574cbc453c7a41105de572546e95191958f459dd93440f541a42c0ff209b56f1cd54e8f8ab1899430dd7c183e11cd16e8cace0bd4fc5d356ef772645210792 + languageName: node + linkType: hard + +"zod@npm:^3.22.4": + version: 3.23.8 + resolution: "zod@npm:3.23.8" + checksum: 10/846fd73e1af0def79c19d510ea9e4a795544a67d5b34b7e1c4d0425bf6bfd1c719446d94cdfa1721c1987d891321d61f779e8236fde517dc0e524aa851a6eff1 + languageName: node + linkType: hard + "zwitch@npm:^1.0.0": version: 1.0.5 resolution: "zwitch@npm:1.0.5"