Skip to content

Commit

Permalink
Merge both TypeScript configs
Browse files Browse the repository at this point in the history
There was no strong reason for maintaining project references,
especially because some of the tooling doesn't support it. By using a
single config we make TypeScript checks faster and tools aren't running
into problems.

- TypeScript ESLint: typescript-eslint/typescript-eslint#2094
- eslint-import-resolver-typescript: typescript-eslint/typescript-eslint#2094
- Vitest: vitest-dev/vitest#3752
- Remix also didn't work, but I wasn't able to find the issue, probablt
  esbuild

So that's at least 4 tools not working. 😄
  • Loading branch information
silvenon committed Feb 11, 2024
1 parent 427ff40 commit a9eaff4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: npm install

- name: Type check
run: npx tsc --build
run: npx tsc --noEmit

vitest:
name: Vitest
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ node_modules
/test-results/
/playwright-report/
/playwright/.cache/

# TypeScript
*.tsbuildinfo
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ pre-push:
playwright:
run: npx playwright test
typescript:
run: npx tsc --build
run: npx tsc --noEmit
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start": "remix-serve ./build/index.js",
"test:unit": "vitest run",
"test:e2e": "playwright test",
"typecheck": "tsc --build",
"typecheck": "tsc --noEmit",
"validate": "lefthook run pre-push"
},
"dependencies": {
Expand Down
25 changes: 0 additions & 25 deletions tsconfig.app.json

This file was deleted.

15 changes: 0 additions & 15 deletions tsconfig.e2e.json

This file was deleted.

25 changes: 16 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.e2e.json" },
],
"compilerOptions": {
// ESLint, Vitest & Remix don't seem to support Project References yet,
// duplicating this mapping here helps them resolve the module paths
// https://github.com/import-js/eslint-import-resolver-typescript/issues/94
// https://github.com/vitest-dev/vitest/issues/3752
"lib": ["DOM", "DOM.Iterable", "ES2020"],
"types": ["vitest/globals"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ES2020",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"~/*": ["./app/*"],
},
"skipLibCheck": true,

// Remix takes care of building everything in `remix build`.
"noEmit": true,
},
}

0 comments on commit a9eaff4

Please sign in to comment.