react/todo 限制
功能
报告 React Compiler 尚无法分析的代码,因为这些代码使用了编译器尚未实现的功能。这些代码属于被跳过的优化(提前退出),而不是违反规则。
由 React Compiler 提供支持,该编译器每个文件只运行一次,并与其他 React Compiler 规则共享。移植自 react-hooks/todo。
为什么这很糟糕?
受影响的组件或 hook 将无法进行优化。仅当你希望了解编译器跳过了哪些内容时才启用此规则;上游默认将其关闭,并将其作为提示提供。
如何使用
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["react"],
"rules": {
"react/todo": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["react"],
rules: {
"react/todo": "error",
},
});bash
oxlint --deny react/todo --react-plugin版本
此规则在 vnext 中添加。
