diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e7d8c9b1..1680f9b0 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -45,7 +45,7 @@ module.exports = { }, }, ], - plugins: ['@deities'], + plugins: ['@deities', 'react-compiler'], rules: { '@typescript-eslint/no-restricted-imports': [ 2, @@ -103,5 +103,6 @@ module.exports = { ], 'no-extra-parens': 0, 'no-restricted-globals': [2, 'alert', 'confirm'], + 'react-compiler/react-compiler': 2, }, }; diff --git a/hera/types/babel-plugin-react-compiler.d.ts b/hera/types/babel-plugin-react-compiler.d.ts new file mode 100644 index 00000000..fdbc7008 --- /dev/null +++ b/hera/types/babel-plugin-react-compiler.d.ts @@ -0,0 +1 @@ +declare module 'babel-plugin-react-compiler'; diff --git a/infra/babelPlugins.tsx b/infra/babelPlugins.tsx index bef6ff55..af624bff 100644 --- a/infra/babelPlugins.tsx +++ b/infra/babelPlugins.tsx @@ -2,6 +2,7 @@ import { join } from 'node:path'; import babelPluginFbt from 'babel-plugin-fbt'; import babelPluginFbtImport from 'babel-plugin-fbt-import'; import babelPluginFbtRuntime from 'babel-plugin-fbt-runtime'; +import babelPluginReactCompiler from 'babel-plugin-react-compiler'; import isOpenSource from './isOpenSource.tsx'; import root from './root.ts'; @@ -17,6 +18,7 @@ const enumManifest = (() => { })(); export default [ + babelPluginReactCompiler, babelPluginFbtImport, [ babelPluginFbt, diff --git a/package.json b/package.json index b01b6b11..08d22814 100644 --- a/package.json +++ b/package.json @@ -65,9 +65,11 @@ "babel-plugin-fbt": "^1.0.0", "babel-plugin-fbt-import": "^0.1.0", "babel-plugin-fbt-runtime": "^1.0.0", + "babel-plugin-react-compiler": "0.0.0-experimental-4690415-20240515", "chalk": "^5.3.0", "dotenv": "^16.4.5", "eslint": "^8.57.0", + "eslint-plugin-react-compiler": "0.0.0-experimental-e04a001-20240515", "nodemon": "^3.1.0", "npm-run-all2": "^6.1.2", "prettier": "4.0.0-alpha.8", @@ -109,6 +111,7 @@ "patchedDependencies": { "@remix-run/router@1.16.1": "patches/@remix-run__router@1.16.1.patch", "eslint-plugin-import@2.29.1": "patches/eslint-plugin-import@2.29.1.patch", + "eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515": "patches/eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515.patch", "fbt@1.0.2": "patches/fbt@1.0.2.patch", "graphql-helix@1.13.0": "patches/graphql-helix@1.13.0.patch", "howler@2.2.4": "patches/howler@2.2.4.patch", diff --git a/patches/eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515.patch b/patches/eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515.patch new file mode 100644 index 00000000..9171db88 --- /dev/null +++ b/patches/eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515.patch @@ -0,0 +1,12 @@ +diff --git a/package.json b/package.json +index dfc570d017042b9066863054d40200c28c5e8947..219b6071176714448fc018063643a301e0d59a7c 100644 +--- a/package.json ++++ b/package.json +@@ -2,6 +2,7 @@ + "name": "eslint-plugin-react-compiler", + "version": "0.0.0-experimental-e04a001-20240515", + "description": "ESLint plugin to display errors found by the React compiler.", ++ "main": "dist/index.js", + "scripts": { + "build": "rimraf dist && rollup --config --bundleConfigAsCjs", + "test": "tsc && jest" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6c6e9f2b..40af9101 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ patchedDependencies: eslint-plugin-import@2.29.1: hash: gqi3hqavyg4p4tnm2gmk4olmpe path: patches/eslint-plugin-import@2.29.1.patch + eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515: + hash: b4ow6yp4hyljoyffrcdskcen2u + path: patches/eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515.patch fbt@1.0.2: hash: 3a6vicbqxcrxvjkaykcxc7x24a path: patches/fbt@1.0.2.patch @@ -71,6 +74,9 @@ importers: babel-plugin-fbt-runtime: specifier: ^1.0.0 version: 1.0.0(babel-plugin-fbt@1.0.0) + babel-plugin-react-compiler: + specifier: 0.0.0-experimental-4690415-20240515 + version: 0.0.0-experimental-4690415-20240515 chalk: specifier: ^5.3.0 version: 5.3.0 @@ -80,6 +86,9 @@ importers: eslint: specifier: ^8.57.0 version: 8.57.0 + eslint-plugin-react-compiler: + specifier: 0.0.0-experimental-e04a001-20240515 + version: 0.0.0-experimental-e04a001-20240515(patch_hash=b4ow6yp4hyljoyffrcdskcen2u)(eslint@8.57.0) nodemon: specifier: ^3.1.0 version: 3.1.0 @@ -1094,6 +1103,9 @@ packages: resolution: {integrity: sha512-tVQRucExLQ02Boi4vdPp49svNGcfL2GhdTCT9aldhXgCJVAI21EtRfBettiuLUwce/7r6bFdgs6JFkcdTiFttA==} engines: {node: '>=6.9.0'} + '@babel/generator@7.2.0': + resolution: {integrity: sha512-BA75MVfRlFQG2EZgFYIwyT1r6xSkwfP2bdkY/kLZusEYWiJs4xCowab/alaEaT0wSvmVuXGqiefeBlP+7V1yKg==} + '@babel/generator@7.24.5': resolution: {integrity: sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==} engines: {node: '>=6.9.0'} @@ -1238,6 +1250,13 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + '@babel/plugin-proposal-private-methods@7.18.6': + resolution: {integrity: sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==} + engines: {node: '>=6.9.0'} + deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead. + peerDependencies: + '@babel/core': ^7.0.0-0 + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2': resolution: {integrity: sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==} engines: {node: '>=6.9.0'} @@ -2153,6 +2172,10 @@ packages: resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + '@jest/types@24.9.0': + resolution: {integrity: sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==} + engines: {node: '>= 6'} + '@jest/types@29.6.3': resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -3333,6 +3356,9 @@ packages: '@types/istanbul-lib-report@3.0.3': resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} + '@types/istanbul-reports@1.1.2': + resolution: {integrity: sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==} + '@types/istanbul-reports@3.0.4': resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} @@ -3459,6 +3485,9 @@ packages: '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + '@types/yargs@13.0.12': + resolution: {integrity: sha512-qCxJE1qgz2y0hA4pIxjBR+PelCH0U5CK1XJXFwCNqfmliatKp47UCXXE9Dyk1OXBDLvsCF57TqQEJaeLfDYEOQ==} + '@types/yargs@17.0.32': resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==} @@ -3671,6 +3700,10 @@ packages: ansi-purge@1.0.0: resolution: {integrity: sha512-kbm4dtp1jcI8ZWhttEPzmga9fwbhGMinIDghOcBng5q9dOsnM6PYV3ih+5TO4D7inGXU9zBmVi7x1Z4dluY85Q==} + ansi-regex@4.1.1: + resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==} + engines: {node: '>=6'} + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} @@ -3848,6 +3881,9 @@ packages: peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + babel-plugin-react-compiler@0.0.0-experimental-4690415-20240515: + resolution: {integrity: sha512-unBK0w2vxrFa3CAeeEGXfMTdBHM9vWZpItUXea4L4FDrD4QpqcAVMtR4Zu0GC0PvXRwj6KuPzzBkVmgGGPFxnw==} + babel-plugin-relay@16.2.0: resolution: {integrity: sha512-+3n7kSFH5MelySnO5MLXl2S+Bq4nAGcdWylXeqNXZODbzgYtqak194Z4u5KElLAHGhsyKIMTW7qazBPvMbxhFQ==} @@ -4577,6 +4613,12 @@ packages: resolution: {integrity: sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==} engines: {node: '>=5.0.0'} + eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515: + resolution: {integrity: sha512-Cwj07NvHezC8wFaFf7nQ2N2ILfs9IuhT2z07PurZb7WxQ5DOZTaX5yaOTCKaMdxoL/7l7wMgbo8+hkgMhpmM8g==} + engines: {node: ^14.17.0 || ^16.0.0 || >= 18.0.0} + peerDependencies: + eslint: '>=7' + eslint-plugin-react-hooks@4.6.2: resolution: {integrity: sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==} engines: {node: '>=10'} @@ -5117,6 +5159,12 @@ packages: heap@0.2.7: resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==} + hermes-estree@0.20.1: + resolution: {integrity: sha512-SQpZK4BzR48kuOg0v4pb3EAGNclzIlqMj3Opu/mu7bbAoFw6oig6cEt/RAi0zTFW/iW6Iz9X9ggGuZTAZ/yZHg==} + + hermes-parser@0.20.1: + resolution: {integrity: sha512-BL5P83cwCogI8D7rrDCgsFY0tdYUtmFP9XaXtl2IQjC+2Xo+4okjfXintlTxcIwl4qeGddEl28Z11kbVIw0aNA==} + hono@3.12.12: resolution: {integrity: sha512-5IAMJOXfpA5nT+K0MNjClchzz0IhBHs2Szl7WFAhrFOsbtQsYmNynFyJRg/a3IPsmCfxcrf8txUGiNShXpK5Rg==} engines: {node: '>=16.0.0'} @@ -6419,6 +6467,10 @@ packages: resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} engines: {node: ^14.13.1 || >=16.0.0} + pretty-format@24.9.0: + resolution: {integrity: sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==} + engines: {node: '>= 6'} + pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -7247,6 +7299,10 @@ packages: trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + trim-right@1.0.1: + resolution: {integrity: sha512-WZGXGstmCWgeevgTL54hrCuw1dyMQIzWy7ZfqRJfSmJZBwklI15egmQytFP6bPidmw3M8d5yEowl1niq4vmqZw==} + engines: {node: '>=0.10.0'} + trough@2.2.0: resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==} @@ -7849,6 +7905,21 @@ packages: zeptomatch@1.2.2: resolution: {integrity: sha512-0ETdzEO0hdYmT8aXHHf5aMjpX+FHFE61sG4qKFAoJD2Umt3TWdCmH7ADxn2oUiWTlqBGC+SGr8sYMfr+37J8pQ==} + zod-validation-error@2.1.0: + resolution: {integrity: sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==} + engines: {node: '>=18.0.0'} + peerDependencies: + zod: ^3.18.0 + + zod-validation-error@3.3.0: + resolution: {integrity: sha512-Syib9oumw1NTqEv4LT0e6U83Td9aVRk9iTXPUQr1otyV1PuXQKOvOwhMNqZIq5hluzHP2pMgnOmHEo7kPdI2mw==} + engines: {node: '>=18.0.0'} + peerDependencies: + zod: ^3.18.0 + + zod@3.23.8: + resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -8422,6 +8493,14 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/generator@7.2.0': + dependencies: + '@babel/types': 7.24.5 + jsesc: 2.5.2 + lodash: 4.17.21 + source-map: 0.5.7 + trim-right: 1.0.1 + '@babel/generator@7.24.5': dependencies: '@babel/types': 7.24.5 @@ -8591,6 +8670,12 @@ snapshots: '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-plugin-utils': 7.24.5 + '@babel/plugin-proposal-private-methods@7.18.6(@babel/core@7.24.5)': + dependencies: + '@babel/core': 7.24.5 + '@babel/helper-create-class-features-plugin': 7.24.5(@babel/core@7.24.5) + '@babel/helper-plugin-utils': 7.24.5 + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.5)': dependencies: '@babel/core': 7.24.5 @@ -9517,6 +9602,12 @@ snapshots: dependencies: '@sinclair/typebox': 0.27.8 + '@jest/types@24.9.0': + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 1.1.2 + '@types/yargs': 13.0.12 + '@jest/types@29.6.3': dependencies: '@jest/schemas': 29.6.3 @@ -10909,6 +11000,11 @@ snapshots: dependencies: '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports@1.1.2': + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-lib-report': 3.0.3 + '@types/istanbul-reports@3.0.4': dependencies: '@types/istanbul-lib-report': 3.0.3 @@ -11045,6 +11141,10 @@ snapshots: '@types/yargs-parser@21.0.3': {} + '@types/yargs@13.0.12': + dependencies: + '@types/yargs-parser': 21.0.3 + '@types/yargs@17.0.32': dependencies: '@types/yargs-parser': 21.0.3 @@ -11380,6 +11480,8 @@ snapshots: ansi-purge@1.0.0: {} + ansi-regex@4.1.1: {} + ansi-regex@5.0.1: {} ansi-regex@6.0.1: {} @@ -11611,6 +11713,16 @@ snapshots: transitivePeerDependencies: - supports-color + babel-plugin-react-compiler@0.0.0-experimental-4690415-20240515: + dependencies: + '@babel/generator': 7.2.0 + '@babel/types': 7.24.5 + chalk: 4.1.2 + invariant: 2.2.4 + pretty-format: 24.9.0 + zod: 3.23.8 + zod-validation-error: 2.1.0(zod@3.23.8) + babel-plugin-relay@16.2.0: dependencies: babel-plugin-macros: 2.8.0 @@ -12449,6 +12561,18 @@ snapshots: eslint-plugin-no-only-tests@3.1.0: {} + eslint-plugin-react-compiler@0.0.0-experimental-e04a001-20240515(patch_hash=b4ow6yp4hyljoyffrcdskcen2u)(eslint@8.57.0): + dependencies: + '@babel/core': 7.24.5 + '@babel/parser': 7.24.5 + '@babel/plugin-proposal-private-methods': 7.18.6(@babel/core@7.24.5) + eslint: 8.57.0 + hermes-parser: 0.20.1 + zod: 3.23.8 + zod-validation-error: 3.3.0(zod@3.23.8) + transitivePeerDependencies: + - supports-color + eslint-plugin-react-hooks@4.6.2(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -13205,6 +13329,12 @@ snapshots: heap@0.2.7: {} + hermes-estree@0.20.1: {} + + hermes-parser@0.20.1: + dependencies: + hermes-estree: 0.20.1 + hono@3.12.12: {} hosted-git-info@2.8.9: {} @@ -14754,6 +14884,13 @@ snapshots: pretty-bytes@6.1.1: {} + pretty-format@24.9.0: + dependencies: + '@jest/types': 24.9.0 + ansi-regex: 4.1.1 + ansi-styles: 3.2.1 + react-is: 16.13.1 + pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 @@ -15751,6 +15888,8 @@ snapshots: trim-lines@3.0.1: {} + trim-right@1.0.1: {} + trough@2.2.0: {} ts-api-utils@1.3.0(typescript@5.4.5): @@ -16519,4 +16658,14 @@ snapshots: dependencies: grammex: 3.1.3 + zod-validation-error@2.1.0(zod@3.23.8): + dependencies: + zod: 3.23.8 + + zod-validation-error@3.3.0(zod@3.23.8): + dependencies: + zod: 3.23.8 + + zod@3.23.8: {} + zwitch@2.0.4: {}