eslint-plugin-filenames
eslint-plugin-filenames copied to clipboard
Feature request: filenames/match-imported
It would be nice to have a new rule, filenames/match-imported
, that is similar to filenames/match-exported
but works on import
s. When used together, this would prevent renaming across the module boundary.
For example:
// src/components/foo-bar.js
const FooBar = ({foo, bar}) => (
<ul>
<li>{foo}</li>
<li>{bar}</li>
</ul>
);
export default FooBar;
// src/widgets/foo-bar-widget.js (good)
import FooBar from '../components/foo-bar';
// src/widgets/foo-bar-widget.js (bad)
import FooBarComponent from '../components/foo-bar';
This would add a lot of value in combination with filenames/match-exported
.
When refactoring, it's easy to forget to rename the variable of the import statement, which can result in a wrong meaning if the meaning of the refactored file has changed. This is especially true when IDEs help to rename import paths automatically without a need to have a look at those files.