Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) support TS resolution mode node16/nodenext (#1526)
#1522 - only force module/resolutionmode if not set to something valid by user - TS plugin: add new param to ts resolver to fix diagnostics not appearing
- Loading branch information
1 parent
83d92c5
commit 5922491
Showing
15 changed files
with
198 additions
and
30 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
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
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
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
2 changes: 2 additions & 0 deletions
2
packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/node16/bar.js
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,2 @@ | ||
export const foo = true; | ||
export const baz = true; |
10 changes: 10 additions & 0 deletions
10
...anguage-server/test/plugins/typescript/features/diagnostics/fixtures/node16/expected.json
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,10 @@ | ||
[ | ||
{ | ||
"range": { "start": { "line": 4, "character": 22 }, "end": { "line": 4, "character": 29 } }, | ||
"severity": 1, | ||
"source": "ts", | ||
"message": "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './bar.js'?", | ||
"code": 2835, | ||
"tags": [] | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
...guage-server/test/plugins/typescript/features/diagnostics/fixtures/node16/expectedv2.json
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,10 @@ | ||
[ | ||
{ | ||
"range": { "start": { "line": 4, "character": 22 }, "end": { "line": 4, "character": 29 } }, | ||
"severity": 1, | ||
"source": "ts", | ||
"message": "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './bar.js'?", | ||
"code": 2835, | ||
"tags": [] | ||
} | ||
] |
8 changes: 8 additions & 0 deletions
8
...language-server/test/plugins/typescript/features/diagnostics/fixtures/node16/input.svelte
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 @@ | ||
<script lang="ts"> | ||
// valid | ||
import { foo } from './bar.js'; | ||
// invalid | ||
import { baz } from './bar'; | ||
foo;baz; | ||
</script> |
3 changes: 3 additions & 0 deletions
3
...language-server/test/plugins/typescript/features/diagnostics/fixtures/node16/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
12 changes: 12 additions & 0 deletions
12
...anguage-server/test/plugins/typescript/features/diagnostics/fixtures/node16/tsconfig.json
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,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"module": "Node16", | ||
"moduleResolution": "Node16", | ||
/** | ||
This is actually not needed, but makes the tests faster | ||
because TS does not look up other types. | ||
*/ | ||
"types": ["svelte"] | ||
} | ||
} |
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
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
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
Oops, something went wrong.