mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
1193c9dbaf
dogfood
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
import type { Node, Plugin, Rule } from "#oxlint/plugins";
|
|
|
|
const SPAN: Node = {
|
|
start: 0,
|
|
end: 0,
|
|
range: [0, 0],
|
|
loc: {
|
|
start: { line: 0, column: 0 },
|
|
end: { line: 0, column: 0 },
|
|
},
|
|
};
|
|
|
|
const rule: Rule = {
|
|
create(context) {
|
|
context.report({
|
|
message:
|
|
"\n"
|
|
+ `this === rule: ${this === rule}\n`
|
|
+ `id: ${context.id}\n`
|
|
+ `filename: ${context.filename}\n`
|
|
+ `getFilename(): ${context.getFilename()}\n`
|
|
+ `physicalFilename: ${context.physicalFilename}\n`
|
|
+ `getPhysicalFilename(): ${context.getPhysicalFilename()}\n`
|
|
+ `cwd: ${context.cwd}\n`
|
|
+ `getCwd(): ${context.getCwd()}\n`
|
|
+ `parserPath: ${context.parserPath}`,
|
|
node: SPAN,
|
|
});
|
|
|
|
return {
|
|
VariableDeclaration(node) {
|
|
context.report({ message: `\nthis === undefined: ${this === undefined}`, node });
|
|
},
|
|
};
|
|
},
|
|
};
|
|
|
|
const plugin: Plugin = {
|
|
meta: {
|
|
name: "context-plugin",
|
|
},
|
|
rules: {
|
|
"log-context": rule,
|
|
},
|
|
};
|
|
|
|
export default plugin;
|