Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
cspell-gitignore
Advanced tools
cspell-gitignore
A library to assist reading and filtering out files matching glob patterns found in .gitignore
files.
npm install -S cspell-gitignore
import { GitIgnore, findRepoRoot } from 'cspell-gitignore';
// ...
const cwd = process.cwd();
const root = (await findRepoRoot(cwd)) || cwd;
const gitIgnore = new GitIgnore([root]);
const allFiles = glob('**');
const files = await gitIgnore.filterOutIgnored(allFiles);
.gitignore
files in the directory hierarchy..gitignore
files.The .gitignore
globs are evaluated from highest to lowest, matching the git
behavior.
To prevent searching higher in the directory hierarchy, specify roots:
const gitIgnore = new GitIgnore([process.cwd()]);
cspell-gitignore
CLIcspell-gitignore
provides a simple cli for debugging .gitignore issues.
In most cases it should provide the same output as git check-ignore
.
Usage cspell-gitignore [options] <files>
Check files against .gitignore
Compare against git check-ignore -v -n <files>
Options:
-r, --root Add a root to prevent searching for .gitignore files above the root if the file is under the root.
This option can be used multiple times to add multiple roots. The default root is the current
repository root determined by the `.git` directory.
Example:
cspell-gitignore README.md
cspell-gitignore -r . node_modules
$ cspell-gitignore -r . node_modules
.gitignore:58:node_modules/ node_modules
<small>8.17.3 (2025-01-28)</small>
FAQs
Gitignore Glob matcher for cspell
The npm package cspell-gitignore receives a total of 424,923 weekly downloads. As such, cspell-gitignore popularity was classified as popular.
We found that cspell-gitignore demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.