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

Allow glob special characters on `import-sort-cli` paths

Open nfantone opened this issue 5 years ago • 2 comments

Related https://github.com/sindresorhus/globby/issues/81

File paths passed to import-sort-cli containing glob special characters -such as [, (, ] and )- would not work with currently set globby dependency even though they are valid.

yarn import-sort --write '/path/src/pages/jobs/[slug].js'  
yarn run v1.22.4
$ /path/node_modules/.bin/import-sort --write /path/src/pages/jobs/[slug].js
No files found for the given patterns: /path/src/pages/jobs/[slug].js, !**/node_modules/**, !./node_modules/**

Upgrading globby to 11.0.1 resolves the issue. However, the following was also addressed:

  • globby types for latest release required a newer typescript version.
  • import-sort would not build due to TS errors on packages/import-sort-parser-babylon/src/index.ts.
  • eslint config declares @typescript-eslint/parser as parser but the module was never installed as a dependency, forcing lint-staged scripts to fail.

nfantone avatar Aug 25 '20 17:08 nfantone

Wanted to point out that, seeing how little activity there seems to be in this repository, users can workaround this issue by locking the globby version in their own projects.

  "resolutions": {
    "import-sort-cli/globby": "11.0.1"
  }

This might have other unintended effects (as import-sort-cli requires ^9.0.0), but so far it seems to be working fine for me.

nfantone avatar Aug 25 '20 17:08 nfantone

Thanks @nfantone and npm solution matched the version from another use on my package tree.

"overrides": { "import-sort-cli": { "globby": "11.1.0" } },

leppaott avatar Feb 21 '24 12:02 leppaott