Skip to content

Commit

Permalink
5.3.1: #108: remove BOM before processing .gitignore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Feb 1, 2024
1 parent e7f02c8 commit 49bd7fa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ const cleanRangeBackSlash = slashes => {
// '`foo/`' should not continue with the '`..`'
const REPLACERS = [

[
// remove BOM
// TODO:
// Other similar zero-width characters?
/^\uFEFF/,
() => EMPTY
],

// > Trailing spaces are ignored unless they are quoted with backslash ("\")
[
// (a\ ) -> (a )
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ignore",
"version": "5.3.0",
"version": "5.3.1",
"description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.",
"files": [
"legacy.js",
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/.gitignore-with-BOM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 9 additions & 0 deletions test/fixtures/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ const cases = [
// }
// ],
/////////////////////////////////////////////////////////////////////
[
'#108: gitignore rules with BOM',
[
readPatterns('.gitignore-with-BOM'),
],
{
'node_modules': 1
}
],
[
'charactor ?',
[
Expand Down

0 comments on commit 49bd7fa

Please sign in to comment.