-
Notifications
You must be signed in to change notification settings - Fork 13.2k
--noEmit doesn't indicate an intent to use ES6 modules #25721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@mjbvz have we heard any complains about the suggestion/quick fix to convert to ES6 modules being offered too often? |
|
Yes previously there were quite a few node developers who did not like seeing the suggestion since it would end up breaking their code (if they were not using a transpiler) |
When you say "previously", you mean it is not an issue any longer? or are you still getting feedback about this? For context #23576 disabled this suggestion for many projects. this change limits it further. wondering if we need to take this change, or we are in a good place with #23576 only. |
|
No, when the suggestion was first introduced I heard a lot about it but I have not heard anything after we restricted when it will be shown with #23576 |
|
Sounds like we're in a good place as-is. Easy enough to revive this if we hear more. |
|
I've run into this issue and I don't understand why the In short, I believe this pull request should have been merged since #23576 hasn't helped with JavaScript-only node.js projects, in my experience. |
When editing JavaScript files in VS Code, TypeScript will suggest converting any CommonJS module to an ES6 module, even for node.js backend code. Unfortunately, how TypeScript determines when to suppress or show this suggestion is flawed, especially in a combination frontend/backend project like this one where the frontend code can use ES6 modules through transpilation. This adds a `jsconfig.json` file to the starter files that will suppress the spurious suggestions for the node.js code, but maintain the suggestion in the frontend code. See these GitHub issues and pull requests for more details on the issue: - microsoft/vscode#47299 - microsoft/vscode#47458 - microsoft/TypeScript#23391 - microsoft/TypeScript#23576 - microsoft/TypeScript#25721 - microsoft/TypeScript#25721 (comment) - microsoft/TypeScript#23391 (comment)
|
@RyanCavanaugh Can this please be reviewed? There's no guarantee that
The logic around this suggestion seems to be quite negatively-geared against development scenarios where we need to stick with CommonJS due to Node scripting. I absolutely prefer to use import syntax when I'm allowed a compiler to support it, but it's absolutely maddening to be prompted on every file about this when working with Node scripts where I literally can not use the import syntax… |
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Sequel to #23576.
I don't think it makes sense to view
--noEmitas permission to suggest ES6 modules, because any JS project is likely to have--noEmitset.