editorconfig-core-js
editorconfig-core-js copied to clipboard
Broken resolution for paths that include `[` characters
I've discovered that .editorconfig
settings are not discovered in paths as e.g. /Volumes/[C] 10 Edge/Users/xxx/some-package
(on my side it's the path on which I can access Windows disk as exposed by Parallels Desktop)
I assume it's because of [
characters.
How to reproduce
1. Prepare same .editorconfig
file in following two folders as e.g.
-
/Users/xxx/some-package
-
/Volumes/[C] 10 Edge/Users/xxx/some-package
2. Install editorconfig
npm package in each of the folders
3. Create following test.js
script in each of the folders:
const { parseSync } = require("editorconfig");
if (process.cwd() !== __dirname) {
throw new Error("To expose the issue, working directory must be same as dir of a script")
}
console.log(
parseSync("test.js", {
root: __dirname
})
);
4. Navigate into each of the directory and run node test.js
. In first one content of .editorconfig
will be resolved, in second one it will not
I was just debugging the same problem and I found this. I can confirm I have the same problem. I will try to see if there is something we can do.
Tracked it down to minimatch
variant we are using in fnmatch.js.
# When testing for this file path fn `if (!fnmatch(filepath, fullGlob)) {` will return false instead of true
/Volumes/[C] Windows 10/work/test/**/*
false
And so the entire module breaks.
Yeah. I don't love that this project has variations to minimatch.