Skip to content

Add Hardhat.gitignore#4882

Open
thejesh23 wants to merge 1 commit into
github:mainfrom
thejesh23:add-hardhat-gitignore
Open

Add Hardhat.gitignore#4882
thejesh23 wants to merge 1 commit into
github:mainfrom
thejesh23:add-hardhat-gitignore

Conversation

@thejesh23

Copy link
Copy Markdown

What

Adds community/Hardhat.gitignore — a template for projects using Hardhat, the Ethereum smart-contract development environment maintained by Nomic Foundation.

Why

Hardhat is one of the two most widely-used Ethereum development environments (alongside Foundry). Every Hardhat project generates the same set of build artifacts, cache files, generated TypeScript types, and deployment records that should not be committed. There is currently no template in this repo covering these paths — Solidity-Remix.gitignore is scoped specifically to the Remix IDE plugin's artifacts/, deps/, and states/ folders and does not cover Hardhat's layout (cache/, types/, ignition/deployments/, etc.).

Scope

Per the contributing guidelines, the template is limited to Hardhat-specific paths only. Generic Node.js paths (node_modules, dist) and coverage output are intentionally excluded — they are already covered by Node.gitignore, which the template file itself recommends as the base:

# Recommended: Node.gitignore

Provenance for each rule

Every rule mirrors the .gitignore that ships in Hardhat's own packages/example-project/.gitignore:

Rule Purpose Source
/artifacts Compiled contract output Hardhat example-project .gitignore (labelled "Hardhat Build Artifacts")
/cache Compilation support cache Hardhat example-project .gitignore (labelled "Hardhat compilation (v2) support directory")
/types TypeChain output — default outDir for @nomicfoundation/hardhat-typechain (Hardhat 3) Hardhat example-project .gitignore (labelled "Types generated by typechain")
/typechain-types TypeChain output — default outDir for @typechain/hardhat (Hardhat 2). Included for backward compatibility during the v2 → v3 transition @typechain/hardhat plugin default
/ignition/deployments Hardhat Ignition deployment output Hardhat example-project .gitignore (labelled "Ignition deployment output")

All paths are anchored with a leading / to prevent accidentally matching similarly-named nested directories (e.g. hand-written src/types/).

Compliance with CONTRIBUTING.md

  • Homepage link:https://hardhat.org/
  • Reason for change: ✅ (above)
  • Documentation links: ✅ (upstream .gitignore cited per rule)
  • Scope limited: ✅ only Hardhat-specific paths; generic Node.js rules are deferred to Node.gitignore
  • One template per PR:
  • No duplicate rules:
  • Placement: community/ per the README guidance that specialized ecosystem-specific templates start there and may be promoted later.

Hardhat (https://hardhat.org/) is a widely-used development
environment for Ethereum smart contracts. Its default project layout
generates several directories that should not be committed. This
template mirrors the .gitignore that ships in Hardhat's own
example-project (packages/example-project/.gitignore in
NomicFoundation/hardhat), limited to Hardhat-specific paths (generic
Node.js paths such as node_modules and dist are already covered by
Node.gitignore).

Rules:
- /artifacts, /cache: compiled contract output and compilation cache
- /types: TypeChain output for @nomicfoundation/hardhat-typechain (v3)
- /typechain-types: TypeChain output for @typechain/hardhat (v2)
- /ignition/deployments: Hardhat Ignition deployment output
Copilot AI review requested due to automatic review settings July 14, 2026 12:48
@thejesh23 thejesh23 requested a review from a team as a code owner July 14, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a community .gitignore template for Hardhat projects.

Changes:

  • Ignores Hardhat build artifacts and caches.
  • Ignores Hardhat 2/3 TypeChain output.
  • Ignores Hardhat Ignition deployment output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants