feat: support a user level ignore file via globalIgnoreFile#287
Merged
Conversation
owlstronaut
suggested changes
May 18, 2026
Adds a `globalIgnoreFile` option pointing to a single ignore file owned by the user and applied to every directory pack. Its parsed contents are injected as a new `globalRules` synthetic rule set, placed between `defaultRules` and `package.json` in the precedence chain. A package's local `.npmignore`, and any specific path listed in its `files` array (which feeds `strictRules`), continue to take precedence over the global rules. The file is read once on the root walker and cached on `globalIgnoreRules` so child walkers reuse the parsed content without reopening the file. Bundled dependencies never receive the option, since they ship third party code as is. Includes unit tests for default layering, coexistence with a local `.npmignore`, the package "files" carve out, missing file no op, subdirectory propagation, and bundled dependency isolation.
ljharb
force-pushed
the
feat/global-ignore-file
branch
from
May 18, 2026 17:05
004bf73 to
f73d516
Compare
owlstronaut
approved these changes
May 22, 2026
Merged
owlstronaut
pushed a commit
that referenced
this pull request
May 22, 2026
🤖 I have created a release *beep* *boop* --- ## [11.1.0](v11.0.0...v11.1.0) (2026-05-22) ### Features * [`1369ec3`](1369ec3) [#287](#287) support a user level ignore file via globalIgnoreFile (#287) (@ljharb) ### Chores * [`e1f3d11`](e1f3d11) [#289](#289) bump @npmcli/eslint-config from 6.0.1 to 7.0.0 (#289) (@dependabot[bot]) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
globalIgnoreFileoption pointing to a single ignore file owned by the user and applied to every directory pack. Its parsed contents are injected as a newglobalRulessynthetic rule set, placed betweendefaultRulesandpackage.jsonin the precedence chain. A package's local.npmignore, and any specific path listed in itsfilesarray (which feedsstrictRules), continue to take precedence over the global rules. The file is read once on the root walker and cached onglobalIgnoreRulesso child walkers reuse the parsed content without reopening the file. Bundled dependencies never receive the option, since they ship third party code as is.Includes unit tests for default layering, coexistence with a local
.npmignore, the package "files" carve out, missing file no op, subdirectory propagation, and bundled dependency isolation.Required for npm/cli#9351