Suppress "File is a CommonJS module" suggestion #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.jsonfile 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:
[js] File is a CommonJS module; it may be converted to an ES6 module. microsoft/vscode#47299
[Suggestion] No suggestions in workspace which ask programmers to convert a CommonJS module into an ES6 module microsoft/vscode#47458
[Suggestion] No suggestions in workspace which ask programmers to convert a CommonJS module into an ES6 module microsoft/TypeScript#23391
Suggestion to convert to ES6 module should only trigger in projects which express some intent to use ES6 microsoft/TypeScript#23576
--noEmit doesn't indicate an intent to use ES6 modules microsoft/TypeScript#25721
--noEmit doesn't indicate an intent to use ES6 modules microsoft/TypeScript#25721 (comment)
[Suggestion] No suggestions in workspace which ask programmers to convert a CommonJS module into an ES6 module microsoft/TypeScript#23391 (comment)