import-sort
import-sort copied to clipboard
Allow glob special characters on `import-sort-cli` paths
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:
globbytypes for latest release required a newertypescriptversion.import-sortwould not build due to TS errors onpackages/import-sort-parser-babylon/src/index.ts.eslintconfig declares@typescript-eslint/parseras parser but the module was never installed as a dependency, forcinglint-stagedscripts to fail.
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.
Thanks @nfantone and npm solution matched the version from another use on my package tree.
"overrides": { "import-sort-cli": { "globby": "11.1.0" } },