@oxlint/migrate
Version:
Generates a `.oxlintrc.json` from a existing eslint flat config
21 lines (20 loc) • 684 B
JavaScript
import replaceRuleDirectiveComment from "./replaceRuleDirectiveComment.mjs";
function replaceComments(comment, type, options) {
const originalComment = comment;
comment = comment.trim();
if (comment.startsWith("eslint-")) {
return replaceRuleDirectiveComment(originalComment, type, options);
} else if (type === "Block") {
if (comment.startsWith("eslint ")) {
throw new Error(
"changing eslint rules with inline comment is not supported"
);
} else if (comment.startsWith("global ")) {
throw new Error("changing globals with inline comment is not supported");
}
}
return originalComment;
}
export {
replaceComments as default
};