diff --git a/index.js b/index.js index a25577f..c559806 100644 --- a/index.js +++ b/index.js @@ -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 ) diff --git a/package.json b/package.json index 7c62cad..edc78d3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/fixtures/.gitignore-with-BOM b/test/fixtures/.gitignore-with-BOM new file mode 100755 index 0000000..843f7a9 --- /dev/null +++ b/test/fixtures/.gitignore-with-BOM @@ -0,0 +1 @@ +node_modules diff --git a/test/fixtures/cases.js b/test/fixtures/cases.js index 09e6336..d51444b 100644 --- a/test/fixtures/cases.js +++ b/test/fixtures/cases.js @@ -22,6 +22,15 @@ const cases = [ // } // ], ///////////////////////////////////////////////////////////////////// + [ + '#108: gitignore rules with BOM', + [ + readPatterns('.gitignore-with-BOM'), + ], + { + 'node_modules': 1 + } + ], [ 'charactor ?', [