react/no-namespace Suspicious
作用
强制 React 元素中不使用命名空间。
为什么这很糟糕?
React 不支持 React 元素中的命名空间,例如 svg:circle。
示例
此规则的错误代码示例:
jsx
<ns:TestComponent />
<Ns:TestComponent />此规则的正确代码示例:
jsx
<TestComponent />
<testComponent />如何使用
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["react"],
"rules": {
"react/no-namespace": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["react"],
rules: {
"react/no-namespace": "error",
},
});bash
oxlint --deny react/no-namespace --react-plugin版本
此规则在 v0.15.13 中添加。
