Skip to content

Commit

Permalink
ESLint: Enable eslint-plugin-react-compiler (#61788)
Browse files Browse the repository at this point in the history
* Add eslint-plugin-react-compiler beta as a dependency

* Enable eslint-plugin-react-compiler rule

* Top-level await breaks eslint-plugin-react-compiler

* Disable all dev files

* Separate interactivity packages

* Use shorter ESLint plugin name

Co-authored-by: Pascal Birchler <[email protected]>

* Reformat

* Disable react-compiler for native files

* Enable enableTreatRefLikeIdentifiersAsRefs babel env setting

* Disable validateRefAccessDuringRender

* Move ESLint config outside of the eslint-plugin package

---------

Co-authored-by: Pascal Birchler <[email protected]>

Co-authored-by: tyxla <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
6 people authored Nov 19, 2024
1 parent 327238a commit 034c1be
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module.exports = {
'plugin:eslint-comments/recommended',
'plugin:storybook/recommended',
],
plugins: [ 'react-compiler' ],
globals: {
wp: 'off',
globalThis: 'readonly',
Expand Down Expand Up @@ -222,6 +223,15 @@ module.exports = {
definedTags: [ 'jest-environment' ],
},
],
'react-compiler/react-compiler': [
'error',
{
environment: {
enableTreatRefLikeIdentifiersAsRefs: true,
validateRefAccessDuringRender: false,
},
},
],
},
overrides: [
{
Expand All @@ -236,6 +246,7 @@ module.exports = {
'import/no-unresolved': 'off',
'import/named': 'off',
'@wordpress/data-no-store-string-literals': 'off',
'react-compiler/react-compiler': 'off',
},
},
{
Expand Down Expand Up @@ -551,6 +562,7 @@ module.exports = {
{
files: [ 'packages/interactivity*/src/**' ],
rules: {
'react-compiler/react-compiler': 'off',
'react/react-in-jsx-scope': 'error',
},
},
Expand Down
65 changes: 65 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"eslint-plugin-jest": "27.2.3",
"eslint-plugin-jest-dom": "5.0.2",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
"eslint-plugin-ssr-friendly": "1.0.6",
"eslint-plugin-storybook": "0.6.13",
"eslint-plugin-testing-library": "6.0.2",
Expand Down

1 comment on commit 034c1be

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 034c1be.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11909750065
📝 Reported issues:

Please sign in to comment.