Skip to content
← Back to rules

vitest/warn-todo Correctness

作用

此规则会警告在 describeittest 函数中使用 .todo

为什么这不好?

你提交的测试应该是完整的。任何未完成的/TODO 代码都不应被提交。

示例

以下是此规则的错误代码示例:

js
describe.todo("foo", () => {});
it.todo("foo", () => {});
test.todo("foo", () => {});

以下是此规则的正确代码示例:

js
describe([])("foo", () => {});
it([])("foo", () => {});
test([])("foo", () => {});

如何使用

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["vitest"],
  "rules": {
    "vitest/warn-todo": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["vitest"],
  rules: {
    "vitest/warn-todo": "error",
  },
});
bash
oxlint --deny vitest/warn-todo --vitest-plugin

版本

此规则于 v1.37.0 中添加。

参考资料