File tree Expand file tree Collapse file tree 7 files changed +63
-0
lines changed
filesWithDifferentOptions Expand file tree Collapse file tree 7 files changed +63
-0
lines changed Original file line number Diff line number Diff 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+
3549exports [` e2e cases > should exec eslint successfully > importXResolverV3 1` ] = `
3650{
3751 " exitCode" : 0 ,
Original file line number Diff line number Diff line change 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+ )
Original file line number Diff line number Diff line change 1+ import y from './y'
Original file line number Diff line number Diff line change 1+ import x from './x'
Original file line number Diff line number Diff line change 1+ export const x = 'x'
Original file line number Diff line number Diff line change 1+ export const y = 'y'
Original file line number Diff line number Diff line change 1+ {}
You can’t perform that action at this time.
0 commit comments