BootNodeDev / dAppBooster

A modern blockchain boilerplate built to quickly get you started with your next project.
https://dappbooster.dev
MIT License
5 stars 1 forks source link

fix(tsconfig): enforce `verbatimModuleSyntax` and fix files #310

Closed fernandomg closed 2 months ago

fernandomg commented 2 months ago

Description:

By enabling verbatimModuleSyntax we will be forced to specify when we're importing a type.

Using the verbatimModuleSyntax flag on a clean install triggered an error upon pnpm wagmi-generate script call.

So to keep the usefulness of the tsc checks I moved away the check from the pre-commit husky hook and moved it to a pre-push husky hook.

Steps:

# update husky config
$ pnpm I # or pnpm prepare

# modify a file with a type import (remove the `type` keyword)

# commit the file
$ git commit -a -m 'chore: a broken file'

# push and pray for the hook to work and see something like the following
$ git push
Running TS checks...
src/components/sharedComponents/BigNumberInput.tsx:2:3 - error TS1484: 'RefObject' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

2   RefObject,
    ~~~~~~~~~

Found 1 error in src/components/sharedComponents/BigNumberInput.tsx:2

TS checks failed. Push aborted.
error: failed to push some refs to 'github.com:bootnodedev/dAppBooster.git'

Edit: THANKS @gabitoesmiapodo for the husky help 💡

Type of change:

How Has This Been Tested?

Remember to check that:

Screenshots

(Add screenshots or videos to help test this pull request)

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dappbooster ✅ Ready (Inspect) Visit Preview Sep 19, 2024 7:54pm
docs.dappbooster ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 7:54pm
fernandomg commented 2 months ago

@nicosampler please re-check this, as it's completely different from what you approved