Ignoring Files
Configure ignore files to keep the repository clean and secure
Overview
This section explains how to configure ignore files to prevent unnecessary, generated, or sensitive files from being tracked by version control or processed by development tools.
Proper ignore rules help maintain a clean repository, improve performance, and reduce the risk of exposing sensitive data.
Git Ignore
Create a .gitignore file in the project root. This file tells Git which files and folders should not be tracked.
# Dependencies
node_modules/
dist/
# TypeScript
*.tsbuildinfo
# Logs
*.log
# Testing and coverage
coverage/
*.test.js
# IDE and editor files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace
# OS-specific files
.DS_Store
Thumbs.db
ehthumbs.db
desktop.ini
# Environment variables
.env
# Miscellaneous
!.gitignoreThis setup ensures that build outputs, local configurations, and sensitive files remain excluded from version control.
Prettier Ignore
To prevent Prettier from formatting generated or external files, create a .prettierignore file in the project root:
# Build artifacts
dist
build
coverage
# Dependencies
node_modules
# Framework output
.nextThis keeps formatting focused only on source files that matter.
ESLint Ignore
It is also recommended to exclude non-source files from ESLint checks. Create an .eslintignore file:
# Dependencies
node_modules/
# Build output
dist/
build/
# Coverage reports
coverage/This ensures ESLint runs faster and only analyzes relevant code.
Summary
With ignore files correctly configured:
- Sensitive data remains untracked
- Generated and compiled files stay out of the repository
- Linting and formatting tools run efficiently
- The codebase remains clean and professional
Your project is now properly set up to avoid unnecessary clutter and risks during development.
Last updated on