Skip to content

Commit c4cb88d

Browse files
committed
test: add failing test in preparation for a fix
1 parent c06392f commit c4cb88d

File tree

7 files changed

+63
-0
lines changed

7 files changed

+63
-0
lines changed

tests/e2e/__snapshots__/e2e.spec.ts.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ exports[`e2e cases > should exec eslint successfully > dotProject 1`] = `
3232
}
3333
`;
3434

35+
exports[`e2e cases > should exec eslint successfully > filesWithDifferentOptions 1`] = `
36+
{
37+
"exitCode": 1,
38+
"stderr": "",
39+
"stdout": "
40+
<ROOT>/tests/e2e/filesWithDifferentOptions/src/a.foo.js
41+
1:15 error Unable to resolve path to module './x' import-x/no-unresolved
42+
43+
1 problem (1 error, 0 warnings)
44+
45+
",
46+
}
47+
`;
48+
3549
exports[`e2e cases > should exec eslint successfully > importXResolverV3 1`] = `
3650
{
3751
"exitCode": 0,
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
2+
import { defaultExtensions } from 'eslint-import-resolver-typescript'
3+
import importX, { flatConfigs } from 'eslint-plugin-import-x'
4+
5+
export default defineConfig(
6+
globalIgnores(['eslint.config.js']),
7+
{
8+
files: ['**/*.foo.js', '**/*.bar.js'],
9+
plugins: {
10+
'import-x': importX,
11+
},
12+
settings: {
13+
...flatConfigs.typescript.settings,
14+
'import-x/resolver': {
15+
typescript: {},
16+
},
17+
},
18+
rules: {
19+
'import-x/no-unresolved': 'error',
20+
},
21+
},
22+
// .foo.js files should prefer importing other .foo.js files.
23+
{
24+
files: ['**/*.foo.js'],
25+
settings: {
26+
'import-x/resolver': {
27+
typescript: {
28+
extensions: ['.foo.js', ...defaultExtensions],
29+
},
30+
},
31+
},
32+
},
33+
// .bar.js files should prefer importing other .bar.js files.
34+
{
35+
files: ['**/*.bar.js'],
36+
settings: {
37+
'import-x/resolver': {
38+
typescript: {
39+
extensions: ['.bar.js', ...defaultExtensions],
40+
},
41+
},
42+
},
43+
},
44+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import y from './y'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import x from './x'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const x = 'x'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const y = 'y'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)