How do I disable: [js] File is a CommonJS module; it may be converted to an ES6 module

Solution 1:

This is a new feature added in Visual Studio Code called "Suggestion Code Actions". "Suggestion Code Actions" are enabled by default in JavaScript and TypeScript.

You can disable them by setting: "typescript.suggestionActions.enabled": false or "javascript.suggestionActions.enabled": false in your user/workspace settings. The documentation can be found here.

(Image provided by Yusuf Yaşar.)

Solution 2:

For anyone using Vim with coc.nvim, you can make the same change by adding the same in the :CocConfig object:

"javascript.suggestionActions.enabled": false

If you haven't added any settings to :CocConfig before, then you need to make sure the above setting is wrapped in a JSON object:

{
    "javascript.suggestionActions.enabled": false
}

Solution 3:

Alert! This approach might be too much for VSCode users who love the intelligent coding assistance. Use it as a simple & quick help, together with other linting & testing utilities.


The control of the presence of the said message is located in Settings => Extensions => TypeScript. (TypeScript !!! :P)

As shown in screenshot, I searched in Settings with keyword "validate", then click TypeScript. It's the first item.

enter image description here