From d95b0c8228465fc762782111d6153cd89f37f414 Mon Sep 17 00:00:00 2001 From: Michael Altamirano Date: Mon, 16 Dec 2024 20:30:13 +0000 Subject: [PATCH] feat: add react-compiler/react-compiler to ESLint config with ref false positive disable BREAKING CHANGE: This ESLint plugin will raise new errors in repos, and so we need to cut it as a major --- index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.js b/index.js index 60428ab..d68402c 100644 --- a/index.js +++ b/index.js @@ -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.