Search code examples
javascriptwebstorm

Why does WebStorm add an import-statement to the top of my js-file?


Sometimes when working with WebStorm editing a .js file I see an import statement gets automatically inserted to the top of the file, like following:

import {setTimeout} from "../../typings/globals/node";

It then causes an error because "import" is not understood.

I'd like to understand why this happens so I can prevent it from happening.


Solution

  • You can disable auto-import completely in Settings | Editor | General | Auto Import; also, if you don't like to see warnings regarding non-imported modules, try disabling JavaScript | General | Missing import statement inspection (Settings | Editor | Inspections)