Skip to content

Help: Can't include multiple directories with CLI flag, or exclude node_modules with config #22

@vincerubinetti

Description

@vincerubinetti

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, and e2e. Here's the setup I have:

package.json

{
  "scripts": {
    "sort-imports": "npx format-imports --config ./import-sorter.json --log ./src",
  }
}

import-sorter.json

{
  "autoFormat": "off",
  "emptyLinesBetweenGroups": 0,
  "formatExports": false,
  "wrappingStyle": "prettier",
  "groupRules": ["^vue", "^\\w", "^@\\w", "^@\\/", { "flags": "scripts" }]
}

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 like Command failed with exit code 1.. I've also tried using the exclude and excludeGlob config options to exclude the most time consuming directories, node_modules and dist, but no matter what variation I try, the plugin runs on node_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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions