chore(lint): add oxlint and configure rules, commands and CI (#2362)

This commit is contained in:
Alex
2026-10-16 14:11:03 +01:00
committed by GitHub
parent b74ec165ba
commit ad119b483a
38 changed files with 9221 additions and 42 deletions
@@ -0,0 +1,31 @@
import { defineRule } from "@oxlint/plugins";
const lintDisableDirective = /^\s*(?:oxlint|eslint)-disable(?:-line|-next-line)?\b/u;
const safetyExplanation = /(?:^|[^\p{L}\p{N}_])SAFETY\s*:\s*\S/u;
export const requireSafetyCommentForLintDisableRule = defineRule({
meta: {
type: "problem",
docs: {
description: "Require a SAFETY explanation on every Oxlint or ESLint disable directive.",
},
messages: {
missingSafetyComment:
"This lint suppression has no `SAFETY:` explanation. State why leaving the finding in place is safe.",
},
},
createOnce(context) {
return {
Program() {
for (const comment of context.sourceCode.getAllComments()) {
if (
lintDisableDirective.test(comment.value)
&& !safetyExplanation.test(comment.value)
) {
context.report({node: comment, messageId: "missingSafetyComment"});
}
}
},
};
},
});