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

"import-sort-cli" doesn't match files/directories starting with "+" ending up with "No files found for the given patterns" error

Open vladimiry opened this issue 7 years ago • 3 comments
trafficstars

The core issue is in micromatch matching, used by globby internally, see playground here https://codesandbox.io/s/10p9160v7l

So a possible solution is to escaping "+" character, probably not only the plus one. Ie escaping each pattern before calling globby.sync here.

vladimiry avatar Sep 04 '18 16:09 vladimiry

Similar issue if feeding files with [ or ] in their names. Pretty common nowadays with the likes of Next.js using patterns in file names.

❯ ./node_modules/.bin/import-sort --write '/path/src/pages/posts/[slug].js'
No files found for the given patterns: /path/src/pages/posts/[slug].js, !**/node_modules/**, !./node_modules/**

nfantone avatar Aug 25 '20 16:08 nfantone

@nfantone hi, did you find a solution by chance?

Yedrup avatar Feb 02 '21 17:02 Yedrup

@Yedrup Yeah - I had opened #127 for this, but went unnoticed. I also posted a workaround in there.

nfantone avatar Feb 05 '21 11:02 nfantone