import-js icon indicating copy to clipboard operation
import-js copied to clipboard

Excluding gitignored files

Open callumlocke opened this issue 8 years ago • 2 comments

Thanks for this module, it's really useful.

When I run 'fix imports' in the file src/something.js, it asks me to choose between ./Foo.js and ../lib/Foo.js. The latter is the Babel output, which obviously wouldn't make sense to import into the source.

It would be nice if there was an option to automatically exclude anything in .gitignore, because if it's in .gitignore then it's probably something I never want to import (or at least rarely enough that I don't mind doing it manually in those cases).

(I'm using the Atom plugin.)

callumlocke avatar Nov 26 '17 16:11 callumlocke

That's a good idea, we could definitely read that file if it exists.

Right now you can add exclusions to the excludes config option. Something like:

// .importjs.js
module.exports = {
  excludes: ['./lib/**'],
};

trotzig avatar Nov 27 '17 10:11 trotzig

You could probably even add a little code to your config that reads your .gitignore file and populates the excludes array.

lencioni avatar Nov 28 '17 22:11 lencioni