Validates configuration of gating mode.
Rule Details
Section titled “Rule Details”Gating mode lets you gradually adopt React Compiler by marking specific components for optimization. This rule ensures your gating configuration is valid so the compiler knows which components to process.
Invalid
Section titled “Invalid”Examples of incorrect code for this rule:
// ❌ Missing required fieldsmodule.exports = { plugins: [ ['babel-plugin-react-compiler', { gating: { importSpecifierName: '__experimental_useCompiler' // Missing 'source' field } }] ]};
// ❌ Invalid gating typemodule.exports = { plugins: [ ['babel-plugin-react-compiler', { gating: '__experimental_useCompiler' // Should be object }] ]};Examples of correct code for this rule:
// ✅ Complete gating configurationmodule.exports = { plugins: [ ['babel-plugin-react-compiler', { gating: { importSpecifierName: 'isCompilerEnabled', // exported function name source: 'featureFlags' // module name } }] ]};
// featureFlags.jsexport function isCompilerEnabled() { // ...}
// ✅ No gating (compile everything)module.exports = { plugins: [ ['babel-plugin-react-compiler', { // No gating field - compiles all components }] ]};