Files
oxc-project__oxc/apps/oxlint/test/fixtures/definePlugin/plugin.ts
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

40 lines
765 B
TypeScript

import { definePlugin } from "#oxlint/plugins";
import type { Rule } from "#oxlint/plugins";
const createRule: Rule = {
create(context) {
return {
Identifier(node) {
context.report({
message: `ident visit fn "${node.name}":\n` + `filename: ${context.filename}`,
node,
});
},
};
},
};
const createOnceRule: Rule = {
createOnce(context) {
return {
Identifier(node) {
context.report({
message: `ident visit fn "${node.name}":\n` + `filename: ${context.filename}`,
node,
});
},
};
},
};
export default definePlugin({
meta: {
name: "define-plugin-plugin",
},
rules: {
create: createRule,
"create-once": createOnceRule,
},
});