eslint-plugin-import
eslint-plugin-import copied to clipboard
Autofix for "extensions" rule
I would like to work on autofixing the extensions rule, would you be open for that? Removing the extension is not a problem, but adding one is tricky, because we can't know whether a should be a.js or a/index.js, right? Should the autofix only work one way?
You'd have to check the filesystem, for one. However, for the index case, a probably should remain as a because it doesn't point to a file, it points to a directory (the index.js is implicit).
Thanks! If the import path is unresolved, should I always treat it as valid as far as extensions rule is concerned? Or should I autofix ./foo.js to ./foo, but not the other way around?
I'm asking because I can't know whether ./foo refers to ./foo.js or ./foo/index.js as it's unresolved, that's why I can only autofix ./foo.js to ./foo (in case the option is never).
Or is it best to ignore the extensions rule if it's unresolved?
I think if a path is unresolved, the extensions rule should ignore it, because there's nothing safe for it to do there.
duplicate of #1749?
Actually, the reverse is true, but let's close this one because I'm no longer up for working on this, I forgot about offering to do it, sorry!
I'm closing this one per OPs request, plus overlap with 1749