[PR #596] [MERGED] Feature: Add prettier/pretty-quick formatting w/ Husky pre-commit #2735

Closed
opened 2026-03-17 00:24:40 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/596
Author: @dihmeetree
Created: 2/24/2020
Status: Merged
Merged: 2/25/2020
Merged by: @jamesgeorge007

Base: masterHead: feature/prettier-formatting


📝 Commits (10+)

  • b0f5ab9 Add prettier/husky config
  • 1543c99 Fix prettier function
  • 777e629 Initial prettier formatted files
  • 241abd3 Final prettier formatted file
  • 97f5ffc Remove the ts,tsx from prettier function
  • b8b2dfd Change yarn to npm run
  • 7dc702c Merge branch 'master' into feature/prettier-formatting
  • c2befae Ignore build.js file (Prettier)
  • 19c9c54 Revert "Ignore build.js file (Prettier)"
  • c635d21 Fix package-lock.json file

📊 Changes

86 files changed (+3533 additions, -3546 deletions)

View changed files

.huskyrc (+5 -0)
.prettierignore (+7 -0)
.prettierrc (+6 -0)
📝 assets/js/curlparser.js (+95 -99)
📝 assets/js/oauth.js (+72 -83)
📝 assets/js/pwa.js (+21 -26)
📝 build.js (+22 -26)
📝 components/ace-editor.vue (+26 -28)
📝 components/autocomplete.vue (+46 -48)
📝 components/collections/addCollection.vue (+16 -18)
📝 components/collections/addFolder.vue (+11 -11)
📝 components/collections/collection.vue (+15 -23)
📝 components/collections/editCollection.vue (+15 -15)
📝 components/collections/editFolder.vue (+12 -17)
📝 components/collections/editRequest.vue (+29 -50)
📝 components/collections/folder.vue (+14 -14)
📝 components/collections/importExportCollections.vue (+99 -137)
📝 components/collections/index.vue (+54 -56)
📝 components/collections/request.vue (+9 -13)
📝 components/collections/saveRequestAs.vue (+55 -91)

...and 66 more files

📄 Description

Husky (https://github.com/typicode/husky) allows us to run commands before initial commits to the repo are made/PR's are pushed. In this scenario, husky runs yarn prettier to format all of the files within the repo before being staged. This is done in the .huskyrc file like so (this can be moved to the package.json file if we want):

{
  "hooks": {
    "pre-commit": "npm run prettier"
  }
}

I've used an opinionated Prettier config .prettierrc which look's like the following (this can be moved to the package.json file if we want):

{
  "trailingComma": "es5",
  "semi": false,
  "singleQuote": true,
  "printWidth": 100
}

The command that is added to the package.json is the following:
"prettier": "prettier --write **/*.{html,js,json,vue}"

This tells Prettier what files can be formatted.

The reason for this PR is to clean up the code quality and formatting within the repo, to one that's consistent (updated by Prettier).

Note: This does not affect how new code must be written or formatted. You can code/format in any way you would like, and Prettier will format it right before changes are committed to the repo/PR is made.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/596 **Author:** [@dihmeetree](https://github.com/dihmeetree) **Created:** 2/24/2020 **Status:** ✅ Merged **Merged:** 2/25/2020 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `master` ← **Head:** `feature/prettier-formatting` --- ### 📝 Commits (10+) - [`b0f5ab9`](https://github.com/hoppscotch/hoppscotch/commit/b0f5ab9776622f148ce5da35ac9933e531b45bc2) Add prettier/husky config - [`1543c99`](https://github.com/hoppscotch/hoppscotch/commit/1543c990cac2996e5ebcd15f15011e54b5060bf2) Fix prettier function - [`777e629`](https://github.com/hoppscotch/hoppscotch/commit/777e629b3d6db8fca41f7a9894efae2d9bd63e0d) Initial prettier formatted files - [`241abd3`](https://github.com/hoppscotch/hoppscotch/commit/241abd3c5077b3dfbb2ea83c0ba36d24c138f352) Final prettier formatted file - [`97f5ffc`](https://github.com/hoppscotch/hoppscotch/commit/97f5ffc8aebd5db6d167a99995cb1a54d9994475) Remove the ts,tsx from prettier function - [`b8b2dfd`](https://github.com/hoppscotch/hoppscotch/commit/b8b2dfda762542ba9319b8a5851f4a9e1b8d3f54) Change yarn to npm run - [`7dc702c`](https://github.com/hoppscotch/hoppscotch/commit/7dc702c626ba563ba09c371f861f80d0a7a61055) Merge branch 'master' into feature/prettier-formatting - [`c2befae`](https://github.com/hoppscotch/hoppscotch/commit/c2befaee46008ccbe6d9ee902ce348e952cae654) Ignore build.js file (Prettier) - [`19c9c54`](https://github.com/hoppscotch/hoppscotch/commit/19c9c5491b8550066809b6c35c43b2df0dfa9739) Revert "Ignore build.js file (Prettier)" - [`c635d21`](https://github.com/hoppscotch/hoppscotch/commit/c635d21180aec8a04aad2c41e099ec1c6e520c11) Fix package-lock.json file ### 📊 Changes **86 files changed** (+3533 additions, -3546 deletions) <details> <summary>View changed files</summary> ➕ `.huskyrc` (+5 -0) ➕ `.prettierignore` (+7 -0) ➕ `.prettierrc` (+6 -0) 📝 `assets/js/curlparser.js` (+95 -99) 📝 `assets/js/oauth.js` (+72 -83) 📝 `assets/js/pwa.js` (+21 -26) 📝 `build.js` (+22 -26) 📝 `components/ace-editor.vue` (+26 -28) 📝 `components/autocomplete.vue` (+46 -48) 📝 `components/collections/addCollection.vue` (+16 -18) 📝 `components/collections/addFolder.vue` (+11 -11) 📝 `components/collections/collection.vue` (+15 -23) 📝 `components/collections/editCollection.vue` (+15 -15) 📝 `components/collections/editFolder.vue` (+12 -17) 📝 `components/collections/editRequest.vue` (+29 -50) 📝 `components/collections/folder.vue` (+14 -14) 📝 `components/collections/importExportCollections.vue` (+99 -137) 📝 `components/collections/index.vue` (+54 -56) 📝 `components/collections/request.vue` (+9 -13) 📝 `components/collections/saveRequestAs.vue` (+55 -91) _...and 66 more files_ </details> ### 📄 Description Husky (https://github.com/typicode/husky) allows us to run commands before initial commits to the repo are made/PR's are pushed. In this scenario, husky runs `yarn prettier` to format all of the files within the repo before being staged. This is done in the `.huskyrc` file like so (this can be moved to the `package.json` file if we want): ``` { "hooks": { "pre-commit": "npm run prettier" } } ``` I've used an opinionated Prettier config `.prettierrc` which look's like the following (this can be moved to the `package.json` file if we want): ``` { "trailingComma": "es5", "semi": false, "singleQuote": true, "printWidth": 100 } ``` The command that is added to the `package.json` is the following: `"prettier": "prettier --write **/*.{html,js,json,vue}"` This tells Prettier what files can be formatted. **The reason for this PR is to clean up the code quality and formatting within the repo, to one that's consistent (updated by Prettier).** **Note**: This does not affect how new code must be written or formatted. You can code/format in any way you would like, and Prettier will format it right before changes are committed to the repo/PR is made. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 00:24:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#2735
No description provided.