Stop VS Code complaining about `require`s

Viewed 281

VS Code seems determined that I must use ES6 modules, but I'm writing a Node application which doesn't support this syntax (unless I use something like TS or Babel, which I don't want to).

require instruction with a squiggle on it

I just want VS to understand that this actually isn't supported by my runtime and stop giving me this one warning.

I tried creating a jsconfig.json file but it was to no avail. Is there a way that I can make VS/TS understand that the environment I'm in doesn't support this?

2 Answers

VS is suggesting here ... this is not an error so you can ignore it if you wish

if you are determined to disable it you can add the following to your vs code settings "javascript.suggestionActions.enabled": "false", This though will disable all suggestedActions (including other rules)

As far as i know there is no way to specifically disable this rule or any other rule for the matter in vs code - you can find more here https://github.com/Microsoft/vscode/issues/47299

VS Code will farm out linting to an external linter. Determine which one you are using and configure it.

For example, using the ESLint extension you can use the "ESLint: Create ESLint configuration" option in the command palette. This will give you a Q&A to determine your style, including a question about if you are using import or not.

Related