验证编译器的配置选项。
🌐 Validates the compiler configuration options.
规则详情
🌐 Rule Details
React 编译器接受各种 配置选项 来控制其行为。此规则用于验证你的配置是否使用了正确的选项名称和数值类型,从而防止由于拼写错误或设置不正确而导致的无声失败。
🌐 React Compiler accepts various configuration options to control its behavior. This rule validates that your configuration uses correct option names and value types, preventing silent failures from typos or incorrect settings.
无效
🌐 Invalid
此规则的错误代码示例:
🌐 Examples of incorrect code for this rule:
// ❌ Unknown option name
module.exports = {
plugins: [
['babel-plugin-react-compiler', {
compileMode: 'all' // Typo: should be compilationMode
}]
]
};
// ❌ Invalid option value
module.exports = {
plugins: [
['babel-plugin-react-compiler', {
compilationMode: 'everything' // Invalid: use 'all' or 'infer'
}]
]
};有效
🌐 Valid
此规则的正确代码示例:
🌐 Examples of correct code for this rule:
// ✅ Valid compiler configuration
module.exports = {
plugins: [
['babel-plugin-react-compiler', {
compilationMode: 'infer',
panicThreshold: 'critical_errors'
}]
]
};故障排除
🌐 Troubleshooting
配置未按预期工作
🌐 Configuration not working as expected
你的编译器配置可能有拼写错误或值不正确:
🌐 Your compiler configuration might have typos or incorrect values:
// ❌ Wrong: Common configuration mistakes
module.exports = {
plugins: [
['babel-plugin-react-compiler', {
// Typo in option name
compilationMod: 'all',
// Wrong value type
panicThreshold: true,
// Unknown option
optimizationLevel: 'max'
}]
]
};请查看配置文档以获取有效选项:
🌐 Check the configuration documentation for valid options:
// ✅ Better: Valid configuration
module.exports = {
plugins: [
['babel-plugin-react-compiler', {
compilationMode: 'all', // or 'infer'
panicThreshold: 'none', // or 'critical_errors', 'all_errors'
// Only use documented options
}]
]
};