@@ -4,44 +4,44 @@ title: config
44
55<Intro >
66
7- Validates the compiler [ configuration options ] ( /reference/react-compiler/configuration ) .
7+ 验证编译器 [ 配置选项 ] ( /reference/react-compiler/configuration ) 。
88
99</Intro >
1010
11- ## Rule Details {/* rule-details* /}
11+ ## 规则详情 {/* rule-details* /}
1212
13- React Compiler accepts various [ configuration options ] ( /reference/react-compiler/configuration ) 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.
13+ React 编译器接受各种 [ 配置选项 ] ( /reference/react-compiler/configuration ) 来控制其行为。此规则验证你的配置使用了正确的选项名称和值类型,防止因拼写错误或错误设置而导致的静默失败。
1414
15- ### Invalid {/* invalid* /}
15+ ### 无效的 {/* invalid* /}
1616
17- Examples of incorrect code for this rule:
17+ 此规则的错误代码示例:
1818
1919``` js
20- // ❌ Unknown option name
20+ // ❌ 未知的选项名称
2121module .exports = {
2222 plugins: [
2323 [' babel-plugin-react-compiler' , {
24- compileMode: ' all' // Typo: should be compilationMode
24+ compileMode: ' all' // 拼写错误:应该是 compilationMode
2525 }]
2626 ]
2727};
2828
29- // ❌ Invalid option value
29+ // ❌ 无效的选项值
3030module .exports = {
3131 plugins: [
3232 [' babel-plugin-react-compiler' , {
33- compilationMode: ' everything' // Invalid: use 'all' or 'infer'
33+ compilationMode: ' everything' // 无效:使用 'all' 或 'infer'
3434 }]
3535 ]
3636};
3737```
3838
39- ### Valid {/* valid* /}
39+ ### 有效的 {/* valid* /}
4040
41- Examples of correct code for this rule:
41+ 此规则的正确代码示例:
4242
4343``` js
44- // ✅ Valid compiler configuration
44+ // ✅ 有效的编译器配置
4545module .exports = {
4646 plugins: [
4747 [' babel-plugin-react-compiler' , {
@@ -52,38 +52,38 @@ module.exports = {
5252};
5353```
5454
55- ## Troubleshooting {/* troubleshooting* /}
55+ ## 故障排除 {/* troubleshooting* /}
5656
57- ### Configuration not working as expected {/* config-not-working* /}
57+ ### 配置未按预期工作 {/* config-not-working* /}
5858
59- Your compiler configuration might have typos or incorrect values:
59+ 你的编译器配置可能有拼写错误或错误的值:
6060
6161``` js
62- // ❌ Wrong: Common configuration mistakes
62+ // ❌ 错误:常见的配置错误
6363module .exports = {
6464 plugins: [
6565 [' babel-plugin-react-compiler' , {
66- // Typo in option name
66+ // 选项名称拼写错误
6767 compilationMod: ' all' ,
68- // Wrong value type
68+ // 错误的值类型
6969 panicThreshold: true ,
70- // Unknown option
70+ // 未知选项
7171 optimizationLevel: ' max'
7272 }]
7373 ]
7474};
7575```
7676
77- Check the [ configuration documentation ] ( /reference/react-compiler/configuration ) for valid options:
77+ 查看 [ 配置文档 ] ( /reference/react-compiler/configuration ) 了解有效选项:
7878
7979``` js
80- // ✅ Better: Valid configuration
80+ // ✅ 更好:有效的配置
8181module .exports = {
8282 plugins: [
8383 [' babel-plugin-react-compiler' , {
84- compilationMode: ' all' , // or 'infer'
85- panicThreshold: ' none' , // or 'critical_errors', 'all_errors'
86- // Only use documented options
84+ compilationMode: ' all' , // 或 'infer'
85+ panicThreshold: ' none' , // 或 'critical_errors'、 'all_errors'
86+ // 只使用文档中记录的选项
8787 }]
8888 ]
8989};
0 commit comments