Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier + Husky linting #377

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if grep -q 'WIP' "$1"; then
echo "Commit with 'WIP' detected - skipping commitlint."
exit 0
fi

yarn commitlint --edit "$1"
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Runs all precommit hooks specified in `package.json#lint-staged`
yarn lint-staged
53 changes: 53 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docs
docs/
README.md
##

# Contracts
packages/contracts/
packages/contracts/artifacts/
packages/contracts/mainnetDeployment/

# Fuzzer
packages/fuzzer/

# Subgraph
packages/subgraph/
packages/lib-subgraph/

# Frontend
packages/dev-frontend/

# SDK
packages/providers/src/
packages/providers/README.md
packages/lib-ethers/
packages/lib-base/
packages/lib-react/

# Explicitly ignore config files without prettier parser (needed for lint-staged)
commitlint.config.js
.editorconfig
.gitblameignore
.gitmodules
.gitignore
.github/
.husky
.prettierignore
yarn.lock
*.plantuml
.env.*
*.png
*.svg
*.ico
*.jpg
*.jpeg
*.otf
*.properties
remix-compiler.config.js
Makefile
*.puml
*.archive
*.sh
.vscode/settings.json
.yarn/
5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
trailingComma: none
arrowParens: avoid
printWidth: 101
# overrides:
# - files: 'someDir/for/example/**/*'
# options:
# singleQuote: true

17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"docs:collect-sdk-apis": "node scripts/collect-sdk-apis.js",
"docs:api-documenter": "api-documenter generate -i temp/sdk-apis -o docs/sdk",
"fuzzer": "yarn workspace @kumodao/fuzzer fuzzer",
"postinstall": "husky install",
"prepare": "run-s prepare:*",
"prepare:contracts": "yarn workspace @kumodao/contracts prepare",
"prepare:lib-base": "yarn workspace @kumodao/lib-base prepare",
Expand All @@ -57,6 +58,9 @@
"prepare:providers": "yarn workspace @kumodao/providers prepare",
"prepare:subgraph": "yarn workspace @kumodao/subgraph prepare",
"prepare:docs": "run-s docs",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"prettier:list-different": "prettier --list-different .",
"rebuild": "run-s prepare build",
"release": "run-s release:*",
"release:delete-dev-deployments": "yarn workspace @kumodao/lib-ethers delete-dev-deployments",
Expand Down Expand Up @@ -89,13 +93,20 @@
"coverage": "run-s coverage:*",
"coverage:contracts": "yarn workspace @kumodao/contracts coverage"
},
"lint-staged": {
"*": [
"yarn prettier:write"
]
},
"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^16.2.1",
"@microsoft/api-documenter": "^7.17.14",
"fs-extra": "^9.1.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"prettier": "^3.0.1",
"semantic-release": "^19.0.3",
"semantic-release-monorepo": "^7.0.4"
},
Expand All @@ -108,4 +119,4 @@
"@types/react": "17.0.2",
"@types/react-dom": "17.0.2"
}
}
}
Loading