Skip to content

Commit 7412c17

Browse files
committed
add repro
1 parent 84b2605 commit 7412c17

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

apps/oxlint/test/e2e.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface TestOptions {
1515
snapshotName?: string;
1616
// Function to get extra data to include in the snapshot
1717
getExtraSnapshotData?: (dirPath: string) => Promise<{ [key: string]: string }>;
18+
19+
overrideFiles?: string;
1820
}
1921

2022
/**
@@ -29,7 +31,7 @@ async function testFixture(fixtureName: string, options?: TestOptions): Promise<
2931
// Use current NodeJS executable, rather than `node`, to avoid problems with a Node version manager
3032
// installed on system resulting in using wrong NodeJS version
3133
command: process.execPath,
32-
args: [CLI_PATH, ...args, 'files'],
34+
args: [CLI_PATH, ...args, options?.overrideFiles ?? 'files'],
3335
fixtureName,
3436
snapshotName: options?.snapshotName ?? 'output',
3537
getExtraSnapshotData: options?.getExtraSnapshotData,
@@ -73,6 +75,12 @@ describe('oxlint CLI', () => {
7375
await testFixture('basic_custom_plugin_many_files');
7476
});
7577

78+
it('should load a custom plugin correctly when extending in a nested config', async () => {
79+
await testFixture('custom_plugin_nested_config', {
80+
overrideFiles: '.',
81+
});
82+
});
83+
7684
it('should load a custom plugin when configured in overrides', async () => {
7785
await testFixture('custom_plugin_via_overrides');
7886
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"jsPlugins": ["./plugin.ts"],
3+
"rules": {
4+
"basic-custom-plugin/no-debugger": "error"
5+
},
6+
"categories": { "correctness": "off" }
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["../.oxlintrc.json"]
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
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: 'basic-custom-plugin',
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)