Open msikma opened 7 years ago
This would also be great for cases where you originally had Foo.js
but decided to break it up into a folder like Foo/index.js
, Foo/bar.js
but forgot to remove the original file.
One of our devs had a case like this recently but fortunately we got a rough pointer to the issue because we use knip too, which told us the Foo/*
files were unused - it still took a little while for us to realise what had actually happened though (originally thought knip was giving us a false positive), so a rule in this plugin to catch this scenario feels like it'd be a good fit for the plugin and a useful feature!
For example, let's say I have the following files:
Inside
main.js
, I have the following code:This is a little dangerous, because did I mean
./something
or./something/
? I don't think code should be split up like this—in this case, I would take the contents ofsomething.js
and move them tosomething/index.js
and just import from there. A warning would be helpful to track down cases like this.