This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Fixes #921 by @sarayourfriend
Description
Adds support for native TypeScript by adding the following dependencies:
@nuxt/typescript-build
-> This adds TypeScript to our build pipeline@typescript-eslint/*
-> These packages enable TypeScript parsing and recommended rules for ESLint@babel/preset-typescript
-> This adds TypeScript to the babel configuration we use for runningjest
Additionally, I've had to add a
.pnpmfile.cjs
(documentation for that here) in order to force resolvetypescript
to a modern version. We need this because@nuxt/typescript-build
uses an older version of TypeScript that doesn't support some of the TS features we were already using (like casting toconst
with JSDoc and type parameter defaults in JSDoc).Finally, I've converted
deepFreeze
to be native TypeScript to prove that this works top to bottom.Testing Instructions
Checkout the branch and run
pnpm dev
. Ensure the application compiles with no errors. Visit the search results page to make sure thatdeepFreeze
is actually being run and verify that there are no errors.Make some changes to the code that will fail TypeScript compilation. For example, in
deepFreeze.ts
add the following:Confirm that
pnpm types
fails and thatpnpm dev
spits out a compilation error.Finally, test the ESLint integration by adding something that will fail eslint in a TypeScript file and verify that the error shows.
The jest integration is tested by the tests passing locally and in CI. Ensure they pass locally by running
pnpm test
and check that the CI passes them as well.Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin