-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add prettier to pre-commit, install pre-commit in prebuild #8655
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
#- id: check-yaml | ||
# args: [--allow-multiple-documents] | ||
# - id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
exclude: .*/src/main/java/io/gitpod/supervisor/api/.* | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
hooks: | ||
#- id: check-yaml | ||
# args: [--allow-multiple-documents] | ||
# - id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
exclude: .*/src/main/java/io/gitpod/supervisor/api/.* | ||
|
||
- id: check-symlinks | ||
- id: mixed-line-ending | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: mixed-line-ending | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-merge-conflict | ||
|
||
# keep fork in sync! | ||
- repo: https://github.com/gitpod-io/pre-commit-hooks | ||
rev: "2.1.5" | ||
hooks: | ||
- id: forbid-binary | ||
exclude: | | ||
(?x)^( | ||
.*example-layer.tar.gz| | ||
.*\.(png|svg|ico|gpg)| | ||
dev/version-manifest/version-manifest| | ||
.*gradle-wrapper\.jar | ||
)$ | ||
- id: script-must-have-extension | ||
- id: shellcheck | ||
args: [-e, "SC1090,SC1091"] | ||
exclude: .*/gradlew$ | ||
|
||
# keep fork in sync! | ||
- repo: https://github.com/gitpod-io/pre-commit-hooks | ||
rev: "2.1.5" | ||
hooks: | ||
- id: forbid-binary | ||
exclude: | | ||
(?x)^( | ||
.*example-layer.tar.gz| | ||
.*\.(png|svg|ico|gpg)| | ||
dev/version-manifest/version-manifest| | ||
.*gradle-wrapper\.jar | ||
)$ | ||
- id: script-must-have-extension | ||
- id: shellcheck | ||
args: [-e, "SC1090,SC1091"] | ||
exclude: .*/gradlew$ | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v2.5.1" | ||
hooks: | ||
- id: prettier | ||
# Only enabled for WebApp components initially, to build consensus and incrementally onboard others | ||
files: ^components\/(server|gitpod-protocol|gitpod-db|dashboard)\/.*\.ts(x?)$ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 4, | ||
"endOfLine": "auto", | ||
"trailingComma": "all" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ async function branchNameCheck(werft: Werft, config: JobConfig) { | |
|
||
async function preCommitCheck(werft: Werft) { | ||
werft.log("pre-commit checks", "Running pre-commit hooks.") | ||
const preCommitCmd = exec(`pre-commit run --all-files --show-diff-on-failure`, { slice: "pre-commit checks" }); | ||
const preCommitCmd = exec(`pre-commit run --show-diff-on-failure`, { slice: "pre-commit checks" }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, there's limited value in running pre-commit on all files. Not only does it prevent incremental lint fix, it also takes longer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine with that. I don't think we have a case of "transitive invalidation" in any of our checks, |
||
|
||
if (preCommitCmd.code != 0) { | ||
throw new Error(preCommitCmd.stderr.toString().trim()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍