Skip to content

Commit

Permalink
feat(unstable): add test for lint plugin destroy hook
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Feb 5, 2025
1 parent 408d581 commit 57cbd53
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/specs/lint/lint_plugin_lifecycle/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"steps": [
{
"args": "lint a.ts",
"output": "lint.out",
"exitCode": 1
},
{
"args": "lint -c deno_exclude.json a.ts",
"output": "lint_exclude.out"
},
{
"args": "lint --fix a.ts",
"output": "lint_fixed.out"
}
]
}
1 change: 1 addition & 0 deletions tests/specs/lint/lint_plugin_lifecycle/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const _a = "foo";
5 changes: 5 additions & 0 deletions tests/specs/lint/lint_plugin_lifecycle/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lint": {
"plugins": ["./plugin.ts"]
}
}
5 changes: 5 additions & 0 deletions tests/specs/lint/lint_plugin_lifecycle/lint.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
create: test-plugin/my-rule
create: test-plugin/my-rule-2
destroy: test-plugin/my-rule
destroy: test-plugin/my-rule-2
Checked 1 file
23 changes: 23 additions & 0 deletions tests/specs/lint/lint_plugin_lifecycle/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
name: "test-plugin",
rules: {
"my-rule": {
create(ctx) {
console.log(`create: ${ctx.id}`);
return {};
},
destroy(ctx) {
console.log(`destroy: ${ctx.id}`);
},
},
"my-rule-2": {
create(ctx) {
console.log(`create: ${ctx.id}`);
return {};
},
destroy(ctx) {
console.log(`destroy: ${ctx.id}`);
},
},
},
};

0 comments on commit 57cbd53

Please sign in to comment.