@truenine/eslint9-config
Version:
ESLint 9 configuration package for Compose Client projects with TypeScript, Vue, and modern JavaScript support
35 lines (34 loc) • 863 B
JavaScript
//#region src/rules/code-style/no-task-comment.ts
const rule = {
meta: {
type: "layout",
docs: {
description: "Remove comments containing task markers (TODO, FIXME, etc.)",
recommended: false
},
messages: { noTaskComment: "Task comments (TODO, FIXME) should be addressed and removed." },
schema: []
},
create(context) {
const { sourceCode } = context;
const taskPattern = new RegExp(`^\\s*(?:\\*\\s*)?(?:${[
"TODO",
"FIXME",
"todo",
"fixme"
].join("|")})`, "m");
return { Program() {
const comments = sourceCode.getAllComments();
for (const comment of comments) {
const content = comment.value;
if (taskPattern.test(content)) context.report({
loc: comment.loc,
messageId: "noTaskComment"
});
}
} };
}
};
//#endregion
export { rule as default };
//# sourceMappingURL=no-task-comment.mjs.map