Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCHU-16881: Add eslint-plugin-react-compiler to @open-turo/eslint-plugin-react #295

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/breaking-changes/v13.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Breaking changes in v13

We are adding `eslint-plugin-react-compiler` to our React configuration. While there is much more work needed to support React Compiler in production, adding the ESLint rule in advance of the actual compiler (which is recommended by the React team: https://react.dev/learn/react-compiler#installing-eslint-plugin-react-compiler) will help us resolve (or suppress) violations as they come up. This addition requires a major version upgrade since it will raise errors in every repo.
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
plugins: ["react", "react-hooks", "jsx-a11y"],
plugins: ["react", "react-hooks", "jsx-a11y", "eslint-plugin-react-compiler"],
env: {
browser: true,
},
Expand Down Expand Up @@ -53,6 +53,20 @@ module.exports = {
"react/state-in-constructor": "off",
// This allows static properties to be placed within the class declaration
"react/static-property-placement": "off",
/** ESLint plugin for the React Compiler, to enforce rules that make adopting it easier/more effective */
"react-compiler/react-compiler": [
"error",
{
environment: {
/**
* At the time of writing, `eslint-plugin-react-compiler` errors on ref usages in render paths. This rule is noisy,
* since it currently reports false positives. We can remove this in the future when the rule is more accurate.
* {@link https://github.com/facebook/react/pull/30843 PR that disables this rule in the default config}
*/
validateRefAccessDuringRender: false,
},
},
],
/*
* Rules that significantly impact performance time of eslint, and are not
* necessarily relevant for react applications.
Expand Down
74 changes: 74 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 @@ -5,6 +5,7 @@
"@open-turo/eslint-config-typescript": "14.0.1",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"eslint-plugin-react-hooks": "5.1.0"
},
"devDependencies": {
Expand Down
Loading