Skip to content

Commit 9213823

Browse files
committed
test(linter/plugins): add tests for .ts, .mts, .cts plugin files
1 parent db91b09 commit 9213823

File tree

13 files changed

+106
-11
lines changed

13 files changed

+106
-11
lines changed
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
{
22
"jsPlugins": [
3-
"./plugins/test_plugin1.js",
4-
"./plugins/test_plugin2.cjs",
5-
"./plugins/test_plugin3.mjs",
6-
"./plugins/test_plugin4",
7-
"test_plugin5",
8-
"test_plugin6"
3+
"./plugins/plugin1.js",
4+
"./plugins/plugin2.cjs",
5+
"./plugins/plugin3.mjs",
6+
"./plugins/plugin4.ts",
7+
"./plugins/plugin5.cts",
8+
"./plugins/plugin6.mts",
9+
"./plugins/plugin7",
10+
"plugin8",
11+
"plugin9"
912
],
1013
"rules": {
1114
"plugin1/no-debugger": "error",
1215
"plugin2/no-debugger": "error",
1316
"plugin3/no-debugger": "error",
1417
"plugin4/no-debugger": "error",
1518
"plugin5/no-debugger": "error",
16-
"plugin6/no-debugger": "error"
19+
"plugin6/no-debugger": "error",
20+
"plugin7/no-debugger": "error",
21+
"plugin8/no-debugger": "error",
22+
"plugin9/no-debugger": "error"
1723
}
1824
}

apps/oxlint/test/fixtures/load_paths/node_modules/test_plugin5/index.js renamed to apps/oxlint/test/fixtures/load_paths/node_modules/plugin8/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/oxlint/test/fixtures/load_paths/node_modules/test_plugin6/plugin.js renamed to apps/oxlint/test/fixtures/load_paths/node_modules/plugin9/plugin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/oxlint/test/fixtures/load_paths/output.snap.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,25 @@
4646
: ^^^^^^^^^
4747
`----
4848
49-
Found 1 warning and 6 errors.
49+
x plugin7(no-debugger): Unexpected Debugger Statement
50+
,-[files/index.js:1:1]
51+
1 | debugger;
52+
: ^^^^^^^^^
53+
`----
54+
55+
x plugin8(no-debugger): Unexpected Debugger Statement
56+
,-[files/index.js:1:1]
57+
1 | debugger;
58+
: ^^^^^^^^^
59+
`----
60+
61+
x plugin9(no-debugger): Unexpected Debugger Statement
62+
,-[files/index.js:1:1]
63+
1 | debugger;
64+
: ^^^^^^^^^
65+
`----
66+
67+
Found 1 warning and 9 errors.
5068
Finished in Xms on 1 file using X threads.
5169
```
5270

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { Plugin } from '../../../../dist/index.js';
2+
3+
const plugin: Plugin = {
4+
meta: {
5+
name: 'plugin4',
6+
},
7+
rules: {
8+
'no-debugger': {
9+
create(context) {
10+
return {
11+
DebuggerStatement(debuggerStatement) {
12+
context.report({
13+
message: 'Unexpected Debugger Statement',
14+
node: debuggerStatement,
15+
});
16+
},
17+
};
18+
},
19+
},
20+
},
21+
};
22+
23+
export default plugin;

0 commit comments

Comments
 (0)