organize-imports-cli icon indicating copy to clipboard operation
organize-imports-cli copied to clipboard

Path-based file or directory exclusion

Open tonyfm15 opened this issue 3 years ago • 3 comments

As far as I can tell, the only ways to exclude files/directories from being organized are

  1. Add // organize-imports-ignore to each file.
  2. Exclude the files in your tsconfig.json
  3. Specify every file except the ones you want to exclude

I use organize-imports-cli in lint-staged and I want to exclude a single folder because it has autogenerated code that I don't want to touch. Other linters make this dead simple, usually by adding a path to an "ignore" file or command line option. Is there something similar for organize-imports-cli? Or interest in implementing it?

tonyfm15 avatar May 05 '21 16:05 tonyfm15

lint-staged is configured by globs. Why not use them to exclude the autogenerated files?

thorn0 avatar May 05 '21 17:05 thorn0

Because it's not really how lint-staged is meant to work (see this part of their README) and figuring out the correct glob syntax is much trickier than say, adding the following to an .eslintignore:

my/ignore/dir

tonyfm15 avatar May 05 '21 18:05 tonyfm15

Okay, PRs welcome

thorn0 avatar May 05 '21 19:05 thorn0