From b5b6716c9ccb1748b83df8879eb4d60b165a47a0 Mon Sep 17 00:00:00 2001 From: WuMingDao <146366930+WuMingDao@users.noreply.github.com> Date: Sun, 28 Dec 2025 21:11:23 +0800 Subject: [PATCH] docs(cn): translate lints/config.md into Chinese --- .../eslint-plugin-react-hooks/lints/config.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/config.md b/src/content/reference/eslint-plugin-react-hooks/lints/config.md index 719e08412e..5ba7fd2392 100644 --- a/src/content/reference/eslint-plugin-react-hooks/lints/config.md +++ b/src/content/reference/eslint-plugin-react-hooks/lints/config.md @@ -4,44 +4,44 @@ title: config -Validates the compiler [configuration options](/reference/react-compiler/configuration). +验证编译器 [配置选项](/reference/react-compiler/configuration)。 -## Rule Details {/*rule-details*/} +## 规则详情 {/*rule-details*/} -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. +React 编译器接受各种 [配置选项](/reference/react-compiler/configuration) 来控制其行为。此规则验证你的配置使用了正确的选项名称和值类型,防止因拼写错误或错误设置而导致的静默失败。 -### Invalid {/*invalid*/} +### 无效的 {/*invalid*/} -Examples of incorrect code for this rule: +此规则的错误代码示例: ```js -// ❌ Unknown option name +// ❌ 未知的选项名称 module.exports = { plugins: [ ['babel-plugin-react-compiler', { - compileMode: 'all' // Typo: should be compilationMode + compileMode: 'all' // 拼写错误:应该是 compilationMode }] ] }; -// ❌ Invalid option value +// ❌ 无效的选项值 module.exports = { plugins: [ ['babel-plugin-react-compiler', { - compilationMode: 'everything' // Invalid: use 'all' or 'infer' + compilationMode: 'everything' // 无效:使用 'all' 或 'infer' }] ] }; ``` -### Valid {/*valid*/} +### 有效的 {/*valid*/} -Examples of correct code for this rule: +此规则的正确代码示例: ```js -// ✅ Valid compiler configuration +// ✅ 有效的编译器配置 module.exports = { plugins: [ ['babel-plugin-react-compiler', { @@ -52,38 +52,38 @@ module.exports = { }; ``` -## Troubleshooting {/*troubleshooting*/} +## 故障排除 {/*troubleshooting*/} -### Configuration not working as expected {/*config-not-working*/} +### 配置未按预期工作 {/*config-not-working*/} -Your compiler configuration might have typos or incorrect values: +你的编译器配置可能有拼写错误或错误的值: ```js -// ❌ 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](/reference/react-compiler/configuration) for valid options: +查看 [配置文档](/reference/react-compiler/configuration) 了解有效选项: ```js -// ✅ 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 + compilationMode: 'all', // 或 'infer' + panicThreshold: 'none', // 或 'critical_errors'、'all_errors' + // 只使用文档中记录的选项 }] ] };