-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help: Can't include multiple directories with CLI flag, or exclude node_modules with config #22
Comments
Thanks for the feedback! Could you share more details about:
|
Indeed, I'll try to get back to you with a minimum reproducible example soon. I was just wondering if you could spot any errors in my config above or your code just off the cuff. |
Here is a minimal reproducible example: First, I want to format This works, if I just want to format
This part of the docs suggests you can specify multiple directories in a single command, but apparently only with
As an alternative, with
... but this still seems to scan |
I think you discussed 2 issues:
For 1, I don't think node_modules/ are formatted after testing your repo on my laptop. The long time is because the tool needs to find out all files (including node_modules/) and check if they need process. For 2, it's a design decision to support single directory because you can't specify |
This is understandable.
In my repo, it takes ~2 minutes to complete scanning I'm not sure how your code is selecting/filtering files and directories recursively, but you may want to consider using the
This is fine but will get pretty lengthy and full of code duplication with a longer command: |
Here is the code for handling Happy to receive PRs if you think it can be improved. Thanks! |
I'm in the same boat. Doing something like |
For what it's worth, I ended up switching to a prettier plugin for this, I appreciate the hard work that went into this library, but that plugin ended up being a smoother experience, both with integration and configuration. I think this library has more options though. Perhaps the author here could consider porting this to a Prettier plugin. |
@vincerubinetti - Yeah, that makes sense. I use WebStorm, which has first-class support for Prettier, so making the switch to prettier-plugin-sort-imports was a bit of a no-brainer after I ran into the same issue that you did. Thanks for the tip. |
Thanks for making this tool, it's great! This is more of a question or request for help. I would've made a discussion instead of an issue if they were enabled.
I'm basically trying to run this plugin recursively on a few select folders in my repo:
src
,unit
, ande2e
. Here's the setup I have:package.json
import-sorter.json
I've looked through the docs and tried a few things. If I append
./unit ./e2e
to the command, like the docs say I can do, I simply get errors likeCommand failed with exit code 1.
. I've also tried using theexclude
andexcludeGlob
config options to exclude the most time consuming directories,node_modules
anddist
, but no matter what variation I try, the plugin runs onnode_modules
and takes an impractical amount of time.One thing to possibly note is that I'm running this in a subdirectory in a monorepo,
/frontend
. I'm running the commands and everything relative to this directory, but in VS Code the project folder I have open is one level up, so maybe that is messing things up.Could you advise some things to try?
The text was updated successfully, but these errors were encountered: