Add Hardhat.gitignore#4882
Open
thejesh23 wants to merge 1 commit into
Open
Conversation
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
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.gitignoreis scoped specifically to the Remix IDE plugin'sartifacts/,deps/, andstates/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 byNode.gitignore, which the template file itself recommends as the base:Provenance for each rule
Every rule mirrors the
.gitignorethat ships in Hardhat's ownpackages/example-project/.gitignore:/artifacts.gitignore(labelled "Hardhat Build Artifacts")/cache.gitignore(labelled "Hardhat compilation (v2) support directory")/typesoutDirfor@nomicfoundation/hardhat-typechain(Hardhat 3).gitignore(labelled "Types generated by typechain")/typechain-typesoutDirfor@typechain/hardhat(Hardhat 2). Included for backward compatibility during the v2 → v3 transition/ignition/deployments.gitignore(labelled "Ignition deployment output")All paths are anchored with a leading
/to prevent accidentally matching similarly-named nested directories (e.g. hand-writtensrc/types/).Compliance with CONTRIBUTING.md
.gitignorecited per rule)Node.gitignorecommunity/per the README guidance that specialized ecosystem-specific templates start there and may be promoted later.