JavaScript

JavaScript

Made by DeepSource

Detected import declarations which import extraneous modules JS-0257

Bug risk
Major

If an import declaration's source is extraneous (it's not written in package.json), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors. This rule disallows import declarations of extraneous modules.

Bad Practice

// foo.js is outside the project directory
import module from '../../foo'

Recommended

// foo.js has been moved to the project directory
import module from './foo'