Files
overlookmotel 9de9385fd1 refactor(linter/plugins): rename oxlint/plugin to oxlint/plugins (#18792)
Part of #18610.

Our intent is to move `definePlugin`, `defineRule`, and `eslintCompatPlugin` to a separate package `@oxlint/plugins` (plural to avoid confusion with naming convention for plugins `oxlint-plugin-xxx`).

So rename the current entry point which exports these functions from `oxlint/plugin` to `oxlint/plugins` (plural).
2026-02-01 13:23:14 +00:00

39 lines
833 B
TypeScript

import assert from "node:assert";
import type { Plugin, Rule } from "#oxlint/plugins";
const unicodeCommentsRule: Rule = {
create(context) {
const { sourceCode } = context;
for (const comment of sourceCode.getAllComments()) {
assert(comment.start === comment.range[0]);
assert(comment.end === comment.range[1]);
const { start, end } = comment.loc;
context.report({
message: JSON.stringify(
{
lines: `${start.line},${start.column}-${end.line},${end.column}`,
value: comment.value,
},
null,
4,
),
node: comment,
});
}
return {};
},
};
const plugin: Plugin = {
meta: {
name: "unicode-comments",
},
rules: {
"unicode-comments": unicodeCommentsRule,
},
};
export default plugin;