{
 "kind": "tool",
 "slug": "ignore",
 "path": "tools/ignore/",
 "name": "ignore",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Utilities",
   "tools/utilities/"
  ]
 ],
 "lead": "Apply .gitignore rules in JavaScript.",
 "chips": [
  {
   "label": "Utilities",
   "path": "tools/utilities/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install ignore"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/kaelzhang/node-ignore"
  },
  {
   "label": "Website",
   "href": "https://github.com/kaelzhang/node-ignore#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source products.",
   "src": "https://github.com/kaelzhang/node-ignore/blob/master/LICENSE-MIT"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change today",
   "note": "Latest GitHub release Aug 31, 2026. ",
   "src": "https://github.com/kaelzhang/node-ignore"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "27 projects",
   "status": "info",
   "sub": "#57 of 406 in its category",
   "note": "Dependency in 27 public GitHub projects set up for AI coding agents that we scanned (0.4%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What ignore does",
   "parts": [
    {
     "t": "prose",
     "text": "ignore is a small free JavaScript library that answers one question: would this .gitignore file leave this file out? Tools use it to skip build folders, installed packages and secret files the same way git does. You give it the rules and a list of file paths; it does not look at your disk itself."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Skip ignored files when packing",
       "text": "Your tool zips or uploads a project and leaves out what the project's .gitignore already excludes, such as builds and secrets.",
       "idea": false
      },
      {
       "title": "Your own .ignore file for a tool",
       "text": "Your app or script lets people list files to skip in its own ignore file, written the same way as .gitignore, like ESLint does.",
       "idea": false
      },
      {
       "title": "Explain why a file is skipped",
       "text": "Someone asks why a file never shows up; your tool names the exact rule that hides it, as git check-ignore -v does.",
       "idea": false
      },
      {
       "title": "Match git's answers exactly",
       "text": "Your tool and git agree on which files count, so nobody sees a file in one place and not the other.",
       "idea": false
      },
      {
       "title": "Keep secrets away from an AI helper",
       "text": "Before an AI assistant or code indexer reads a project, drop .env files and folders the project already hides.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "ignore popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "57",
       "of": "/ 100",
       "l": "Gid Score, #1151 overall"
      },
      {
       "n": "434M",
       "l": "downloads a week, npm"
      },
      {
       "n": "508",
       "l": "GitHub stars"
      },
      {
       "n": "27",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How ignore is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "ignore is a dependency in 27 of the 6,254 public GitHub projects set up for AI coding agents that we scanned (0.6% of the 4,863 JavaScript/TypeScript ones), #57 of 406 in utilities.",
      "Counting the projects our scan samples by dependency (Solana 3,063, Ethereum and EVM 1,777, 3D and games 3,120, agent frameworks and SDKs 13,629), it appears in 127; those are left out of every share on this page.",
      "Projects that use it most often also use Model Context Protocol SDK (JavaScript) (74.1%), Zod (85.2%), Vitest (77.8%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "21 projects, 0.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "16 projects, 0.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "7 projects, 2.1%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "7 projects, 0.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 74.1% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 85.2% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 77.8% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 70.4% of its projects",
       "v": "chalk",
       "path": "tools/chalk/"
      },
      {
       "l": "In 70.4% of its projects",
       "v": "diff",
       "path": "tools/diff/"
      },
      {
       "l": "In 66.7% of its projects",
       "v": "Anthropic SDK",
       "path": "tools/anthropic-ai/"
      },
      {
       "l": "In 66.7% of its projects",
       "v": "esbuild",
       "path": "tools/esbuild/"
      },
      {
       "l": "In 66.7% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about ignore",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "Open Collective: https://opencollective.com/node-ignore"
       ]
      },
      {
       "title": "More in Utilities",
       "path": "tools/utilities/",
       "items": [
        {
         "text": "clsx",
         "path": "tools/clsx/"
        },
        {
         "text": "date-fns",
         "path": "tools/date-fns/"
        },
        {
         "text": "PyYAML",
         "path": "tools/pyyaml/"
        },
        {
         "text": "uuid",
         "path": "tools/uuid/"
        },
        {
         "text": "yaml",
         "path": "tools/yaml/"
        },
        {
         "text": "js-yaml",
         "path": "tools/js-yaml/"
        },
        {
         "text": "glob",
         "path": "tools/glob/"
        },
        {
         "text": "Lodash",
         "path": "tools/lodash/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "ignore",
       "me": true,
       "facts": [
        "MIT",
        "Gid 57",
        "434M/wk"
       ]
      },
      {
       "name": "globby",
       "why": "Pick globby when you also need to find the files on disk, with .gitignore support built in.",
       "path": "tools/globby/",
       "facts": []
      },
      {
       "name": "minimatch",
       "why": "Pick minimatch for general file-name patterns or .npmignore files, which do not follow .gitignore rules.",
       "path": "tools/minimatch/",
       "facts": []
      },
      {
       "name": "pathspec",
       "why": "Pick pathspec when your tool is written in Python and needs gitignore-style matching.",
       "path": "tools/pathspec/",
       "facts": []
      }
     ],
     "more": "Compare ignore with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use the npm package ignore (pin ignore@7.0.14) to filter the project's file list by its .gitignore: pass paths relative to the repo root without ./, add a trailing / for folders, and set ignorecase: false to match git on Linux."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add the package to your JavaScript project.",
       "code": "npm i ignore\n",
       "src": "https://github.com/kaelzhang/node-ignore/blob/master/README.md"
      },
      {
       "text": "Create a checker and add rules, either a list or the whole text of a .gitignore file.",
       "code": "ignore()\n.add(fs.readFileSync(filenameOfGitignore).toString())\n.filter(filenames)\n",
       "src": "https://github.com/kaelzhang/node-ignore/blob/master/README.md"
      },
      {
       "text": "Pass paths relative to the folder of the .gitignore, without a leading ./ or /.",
       "code": null,
       "src": "https://github.com/kaelzhang/node-ignore/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "ig.ignores('./src/app.js') or ig.ignores('/src/app.js')",
       "fix": "ig.ignores('src/app.js'), using path.relative(rootDir, file)",
       "why": "Since 5.0 such paths throw; our run got: path should be a `path.relative()`d string."
      },
      {
       "dont": "ignore({ allowRelative: true }) (the name the upgrade notes use)",
       "fix": "ignore({ allowRelativePaths: true })",
       "why": "In 7.0.14 the option is allowRelativePaths; in our run allowRelative still threw."
      },
      {
       "dont": "ig.ignores('config') for a folder rule config/",
       "fix": "ig.ignores('config/') with a trailing slash for folders",
       "why": "It never looks at the disk, so a name without a slash counts as a file (our run: false vs true)."
      },
      {
       "dont": "Relying on the default on a Linux server",
       "fix": "ignore({ ignorecase: false }) or the repository's core.ignorecase value",
       "why": "Default matching ignores case, so *.png also hides Photo.PNG while git on Linux would keep it."
      },
      {
       "dont": "Using minimatch to apply .gitignore rules",
       "fix": "Use ignore for .gitignore, minimatch for .npmignore and plain patterns",
       "why": "minimatch does not follow the gitignore rules."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I use it in a paid, closed-source app?",
       "a": "Yes. It is MIT-licensed; keep the copyright and license notice with its files.",
       "evidence": {
        "url": "https://github.com/kaelzhang/node-ignore/blob/master/LICENSE-MIT",
        "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."
       }
      },
      {
       "q": "Does it work in the browser?",
       "a": "Yes. The code checks for Node.js only to handle Windows paths; our demo ran it in a browser page.",
       "evidence": {
        "url": "https://github.com/kaelzhang/node-ignore/blob/master/index.js",
        "quote": "Detect `process` so that it can run in browsers."
       }
      },
      {
       "q": "Why does ig.ignores('./src/app.js') throw an error?",
       "a": "Since version 5 paths must be relative and clean. Drop the ./ (path.relative() gives the right form).",
       "evidence": {
        "url": "https://github.com/kaelzhang/node-ignore/blob/master/README.md",
        "quote": "Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory."
       }
      },
      {
       "q": "Is it exactly the same as git?",
       "a": "Almost. The README lists a few known differences, such as letter case and some non-English characters.",
       "evidence": {
        "url": "https://github.com/kaelzhang/node-ignore/blob/master/README.md",
        "quote": "A few divergences are deliberate or inherited from how JavaScript differs from C."
       }
      },
      {
       "q": "Is it still maintained?",
       "a": "Yes. Version 7.0.14 came out on 23 October 2026.",
       "evidence": {
        "url": "https://registry.npmjs.org/ignore",
        "quote": "\"7.0.14\":\"2026-10-23T23:24:50.714Z\""
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm ignore"
  ],
  [
   "Category",
   "Utilities"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "57.2"
  ],
  [
   "Rank in category",
   "#57 of 406"
  ],
  [
   "GitHub",
   "kaelzhang/node-ignore"
  ],
  [
   "Last change",
   "Nov 17, 2026"
  ]
 ],
 "good": [
  "It only checks names you give it. It does not list folders, find .gitignore files or read git settings.",
  "Paths must be relative to the folder of the rules. A path starting with ./ or / stops your code with an error.",
  "It ignores upper and lower case by default, unlike git on Linux. Pass ignorecase: false to match git there."
 ],
 "checked_line": "Read by AgentGid from 6 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/kaelzhang.png"
}