kaelzhang / node-ignore

🔍 node-ignore is the manager and filter for .gitignore rules, the one used by eslint, prettier and many others.
Other
440 stars 45 forks source link

Suggested replacement for addIgnoreFile doesn't work always #108

Closed dhilgarth closed 9 months ago

dhilgarth commented 9 months ago

With the attached .gitignore, the following code will return false

const ig = ignore.default();
ig.add(fs.readFileSync('.gitignore').toString());
console.log(ig.ignores('node_modules'));

I believe it's because of the BOM at the beginning of the file.

gitignore.zip

kaelzhang commented 9 months ago

confirmed. Nice catch buddy.

kaelzhang commented 9 months ago

I will do a complete tests for all zero-width chars

kaelzhang commented 9 months ago

Landed in 5.3.1

dhilgarth commented 9 months ago

Awesome, thanks!