-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
df02af2
commit 9213215
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"steps": [ | ||
{ | ||
"args": "lint a.ts", | ||
"output": "lint.out" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const _a = "foo"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lint": { | ||
"plugins": ["./plugin.ts"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}, | ||
}, | ||
}, | ||
}; |