Skip to content
← Back to rules

typescript/ban-tslint-comment Style

🛠️ An auto-fix is available for this rule.

作用

此规则不允许使用 tslint:<rule-flag> 注释。

为什么这不好?

在从 TSLint 迁移到 ESLint 时很有用。一旦 TSLint 已被移除,此规则有助于定位 TSLint 注释。

示例

此规则的错误代码示例:

ts
// tslint:disable-next-line
someCode();

此规则的正确代码示例:

ts
someCode();

如何使用

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

json
{
  "rules": {
    "typescript/ban-tslint-comment": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  rules: {
    "typescript/ban-tslint-comment": "error",
  },
});
bash
oxlint --deny typescript/ban-tslint-comment

版本

此规则在 v0.2.9 中添加。

参考资料