reflectiondm / vscode-npmsmartimporter

An extension for VSCode editor that provides a quick fix command that inserts import statement for undeclared variables based on common naming conventions
https://marketplace.visualstudio.com/items?itemName=reflectiondm.npmsmartimporter
MIT License
2 stars 1 forks source link

NPM Smart Importer

Provides a quick fix command that inserts import statement for undeclared variables based on common naming conventions

What is it for?

Forgetting to import an npm package in file can be frustrating and breaks the flow. But lo! Frustrate no more as Npm Smart Importer will fix this little problem for you!

Picture worth a thousand words!

Importing NPM packages

Importing local modules

Features

When you have an undeclared variable in your code and use eslint or jshint linter, you will get a linter error. In this case you can click on the variable (with jshint you have to either put a cursor at the beginning of the variable or just highlight it) and a quick fix actions will appear providing a convenient way to add a missing import statement. This smart helper can detect whether es6 imports or just plain old require is used in the file based on the existing imports. Preferable imports type can be set via settings. If you do not have a linter in your project, you can still make use of this extension by enabling the quickfixes for selection.

Extension Settings

This extension contributes the following settings:

Enjoy!


Changelog

[3.0.0]


License

MIT © Andrei Zubov