Skip to content
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

Allow glob special characters on import-sort-cli paths #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nfantone
Copy link

@nfantone nfantone commented Aug 25, 2020

Related sindresorhus/globby#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
Copy link
Author

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.

@leppaott
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants