In addition to the proposed eslint plugin, you can enable semantic verification of the JS file in VS code by adding // @ts-check to the beginning of the file:
// @ts-check import foo from './this-path-doesnt-exist'

This will also allow you to perform a number of other checks in the file, including type checking, so it may not be suitable for each code base, but it can help catch many common programming errors.
Read more about ts-check
source share