eslint-plugin-unnecessary-filename-in-import
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

eslint-plugin-unnecessary-filename-in-import

ESLint rule to require import statements to only reference the directory of a module instead of the file if the name of the module and the file are the same. This is useful when each module has a package.json with "main" set to the modules main file.

Some IDEs do not recognize the existence of the package.json and create import statements with the filename.

You can provide the option { "skipPackageJsonCheck": true } to not read each potentially violating import's package.json to check if it matches the use case. This means you are certain that every package that has a source file with the same name as the package also has a package.json with "main" set to that file.

Installation

yarn add -D eslint-plugin-unnecessary-filename-in-import

Then, in your .eslintrc.json:

{
    "plugins": ["unnecessary-filename-in-import"],
    "rules": {
        "unnecessary-filename-in-import/rule": "error"
    }
}

Changelog

The changelog can be found on the Releases page.

Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

Authors and license

Kialo GmbH and contributors.

MIT License, see the included License.md file.

Readme

Keywords

Package Sidebar

Install

npm i eslint-plugin-unnecessary-filename-in-import

Weekly Downloads

170

Version

1.0.3

License

MIT

Unpacked Size

15.6 kB

Total Files

11

Last publish

Collaborators

  • ska-kialo