Gitignore Check

Gitignore Check is a copy-paste React component that stops node_modules committed despite .gitignore before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/gitignore-check
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

Stopsnode_modules committed despite .gitignore

Was this component page useful?

How do I install Gitignore Check?

pnpm dlx shadcn@latest add @bollard/gitignore-check

The files land in your project. They're yours to edit.

How do I use Gitignore Check in React?

gitignore-check-usage.tsx
import { GitignoreCheck } from "@/components/ui/gitignore-check"

return <GitignoreCheck defaultValue={GITIGNORE} defaultFiles={FILES} trackedFiles={[".env"]} />

What input mistakes does Gitignore Check catch?

  • Inline # comments, trailing tabs, leading spaces, backslashes and ./ that change a pattern
  • ! lines that can't re-include a file under an excluded folder, or are overridden later
  • Leading / anchors that miss nested folders
  • .env, private keys or node_modules not ignored
  • Already-committed files .gitignore won't untrack, with the git rm --cached command

What props does Gitignore Check accept?

GitignoreCheck props
PropTypeDefault
value

Controlled .gitignore text.

string—
defaultValue

Initial .gitignore text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
files

Controlled file list (one path per line; `git status --porcelain` lines also work).

string—
defaultFiles

Initial file list when uncontrolled.

string""
onFilesChange

Called when the file list is edited.

(files: string) => void—
trackedFiles

Paths you know are committed, e.g. from `git ls-files`.

string[]—
defaultPathsTracked

Start with "These paths are already committed" ticked.

booleanfalse
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{line}`, `{detail}`, `{rule}`, `{count}` and friends are filled in.

Partial<GitignoreCheckMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

How is Gitignore Check accessible?

  • Text areas have labels; the editor has aria-invalid when errors exist and is described by the status
  • Result summary uses role=status; icons are aria-hidden
  • Each issue has a button to select its line, and focus returns to a sensible control after a fix

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Checks only the one .gitignore and file list you paste; nested .gitignore, .git/info/exclude and global excludes are not read
  • Reimplements Git's rules in JS; edge cases may differ from your Git version
  • Does not scan file contents for secrets

What expensive mistakes does Gitignore Check stop?

node_modules committed despite .gitignore

Also known as

.gitignore · git · ignore file · .env · node_modules · git rm --cached · repo · commit

Field type

What dependencies does Gitignore Check require?

Gitignore Check facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameGitignore Check
Registry identifier@bollard/gitignore-check
Install commandnpx shadcn@latest add @bollard/gitignore-check
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Gitignore Check

What form validation mistake does Gitignore Check catch?

Gitignore Check prevents node_modules committed despite .gitignore. Runs Git's real ignore rules against your files so a .gitignore that only looks right doesn't let secrets or node_modules into a commit. Catches: Inline # comments, trailing tabs, leading spaces, backslashes and ./ that change a pattern, ! lines that can't re-include a file under an excluded folder, or are overridden later, Leading / anchors that miss nested folders, .env, private keys or node_modules not ignored, Already-committed files .gitignore won't untrack, with the git rm --cached command. Limitation: validate gitignore-check schemas on backend.

How do I install gitignore-check with shadcn?

Run `npx shadcn@latest add @bollard/gitignore-check`. Sources added: registry/default/gitignore-check/gitignore-check.tsx, registry/default/gitignore-check/gitignore.ts. Package requirements: lucide-react.

What props customize Gitignore Check?

Gitignore Check accepts `value`, `defaultValue`, `onValueChange`, `files`, `defaultFiles`. Configures .gitignore, git, ignore file behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of gitignore-check?

Checks only the one .gitignore and file list you paste; nested .gitignore, .git/info/exclude and global excludes are not read. Reimplements Git's rules in JS; edge cases may differ from your Git version. Does not scan file contents for secrets Server requirement: backend verification for gitignore-check.

How does Gitignore Check meet accessibility guidelines?

Text areas have labels; the editor has aria-invalid when errors exist and is described by the status. Result summary uses role=status; icons are aria-hidden. Each issue has a button to select its line, and focus returns to a sensible control after a fix. Minimizes errors: gitignore not working, .env still committed.

Which components pair with Gitignore Check?