[PR #3472] [MERGED] chore(common): implement enforced pre-commit type checks for FE service files #4395

Closed
opened 2026-03-17 01:56:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3472
Author: @jamesgeorge007
Created: 10/25/2023
Status: Merged
Merged: 11/2/2023
Merged by: @AndrewBastin

Base: release/2023.8.3Head: services-type-check


📝 Commits (9)

  • 993133f chore: perform type check for FE service files
  • ba6e098 chore: update do-typecheck script
  • fd08fbf fix: use absolute path while checking against the directory path
  • e4af695 fix: existing type error in scope
  • 26191ac fix: make the script agnostic of the path it is getting executed from
  • fa62478 fix: resolve tsconfig path relative to the workspace root
  • 867340b refactor: rewrite following ESM semantics
  • 856e597 feat: add the ability to work with multiple directory paths
  • ace4a48 feat: add the ability to work with multiple file patterns

📊 Changes

4 files changed (+931 additions, -718 deletions)

View changed files

📝 packages/hoppscotch-common/package.json (+2 -1)
📝 packages/hoppscotch-common/src/modules/i18n.ts (+7 -2)
packages/hoppscotch-common/type-check.mjs (+92 -0)
📝 pnpm-lock.yaml (+830 -715)

📄 Description

Description

This PR aims at performing type checks for TS files for FE services source files as part of the pre-commit hook.

  • Adds a type-check.mjs script at the hoppscotch-common package root that performs type check on TS files under the services directory leveraging the TS and Vue TSC compiler APIs. Files under **/__tests__/** & .d.ts based are ignored while performing type check. The findFilesToPerformTypeCheck helper function accepts the list of directory paths and file patterns where type checking will be performed.
  • Adds glob as a dev dependency consumed while compiling TS files in the given directory.
  • Update the do-typecheck script to invoke the above script, configured to run as part of the pre-commit hook.
  • Fixes an existing type error in scope.

Closes HFE-249.

Demo

https://github.com/hoppscotch/hoppscotch/assets/25279263/1b356afb-d6e7-4721-875d-4aa50b933ea6

Checks

  • My pull request adheres to the code style of this project
  • All the tests have passed

🔄 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/3472 **Author:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Created:** 10/25/2023 **Status:** ✅ Merged **Merged:** 11/2/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.8.3` ← **Head:** `services-type-check` --- ### 📝 Commits (9) - [`993133f`](https://github.com/hoppscotch/hoppscotch/commit/993133f8479b3fb8a7169b7cd7a590e88ee52ea7) chore: perform type check for FE service files - [`ba6e098`](https://github.com/hoppscotch/hoppscotch/commit/ba6e0989f8da2c0f68d729136a9d22233d439fb3) chore: update `do-typecheck` script - [`fd08fbf`](https://github.com/hoppscotch/hoppscotch/commit/fd08fbf155a80f9c36b3241446d8159886004f23) fix: use absolute path while checking against the directory path - [`e4af695`](https://github.com/hoppscotch/hoppscotch/commit/e4af69597dff2c51a0536388f992cbd00e4d1881) fix: existing type error in scope - [`26191ac`](https://github.com/hoppscotch/hoppscotch/commit/26191ac941503b9ed76a3d2898fe54f707b50cda) fix: make the script agnostic of the path it is getting executed from - [`fa62478`](https://github.com/hoppscotch/hoppscotch/commit/fa62478ab6d7a205dc2f3e516def66050f263200) fix: resolve tsconfig path relative to the workspace root - [`867340b`](https://github.com/hoppscotch/hoppscotch/commit/867340bfae440e3415ec4d1f14e14e115e58c2a3) refactor: rewrite following ESM semantics - [`856e597`](https://github.com/hoppscotch/hoppscotch/commit/856e597d0d176a7a7517f8de4a28f2f3be36dc3c) feat: add the ability to work with multiple directory paths - [`ace4a48`](https://github.com/hoppscotch/hoppscotch/commit/ace4a485fc0a19e86ce9f07bfff35e608ae3d9a0) feat: add the ability to work with multiple file patterns ### 📊 Changes **4 files changed** (+931 additions, -718 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/package.json` (+2 -1) 📝 `packages/hoppscotch-common/src/modules/i18n.ts` (+7 -2) ➕ `packages/hoppscotch-common/type-check.mjs` (+92 -0) 📝 `pnpm-lock.yaml` (+830 -715) </details> ### 📄 Description ### Description This PR aims at performing type checks for TS files for FE services source files as part of the pre-commit hook. - Adds a `type-check.mjs` script at the `hoppscotch-common` package root that performs type check on TS files under the `services` directory leveraging the TS and Vue TSC compiler APIs. Files under `**/__tests__/**` & `.d.ts` based are ignored while performing type check. The `findFilesToPerformTypeCheck` helper function accepts the list of directory paths and file patterns where type checking will be performed. - Adds `glob` as a dev dependency consumed while compiling TS files in the given directory. - Update the `do-typecheck` script to invoke the above script, configured to run as part of the pre-commit hook. - Fixes an existing type error in scope. Closes HFE-249. ### Demo https://github.com/hoppscotch/hoppscotch/assets/25279263/1b356afb-d6e7-4721-875d-4aa50b933ea6 ### Checks - [x] My pull request adheres to the code style of this project - [x] All the tests have passed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:56:01 +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#4395
No description provided.