Skip to content

Commit 9213215

Browse files
feat(unstable): add test for lint plugin destroy hook (#27981)
Noticed that we didn't test the `destroy()` hook of lint plugins. This PR adds a test for that.
1 parent df02af2 commit 9213215

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"steps": [
3+
{
4+
"args": "lint a.ts",
5+
"output": "lint.out"
6+
}
7+
]
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const _a = "foo";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"lint": {
3+
"plugins": ["./plugin.ts"]
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
create: test-plugin/my-rule
2+
create: test-plugin/my-rule-2
3+
destroy: test-plugin/my-rule
4+
destroy: test-plugin/my-rule-2
5+
Checked 1 file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default {
2+
name: "test-plugin",
3+
rules: {
4+
"my-rule": {
5+
create(ctx) {
6+
console.log(`create: ${ctx.id}`);
7+
return {};
8+
},
9+
destroy(ctx) {
10+
console.log(`destroy: ${ctx.id}`);
11+
},
12+
},
13+
"my-rule-2": {
14+
create(ctx) {
15+
console.log(`create: ${ctx.id}`);
16+
return {};
17+
},
18+
destroy(ctx) {
19+
console.log(`destroy: ${ctx.id}`);
20+
},
21+
},
22+
},
23+
};

0 commit comments

Comments
 (0)