Skip to content

Commit

Permalink
ci: Run test:types on CI (#9)
Browse files Browse the repository at this point in the history
* chore: Add type checking

* Use moduleResolution bundler

* Re-enable strict mode
  • Loading branch information
lachlancollins authored Jan 3, 2024
1 parent e55ce49 commit 00dc983
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions bin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ async function requireOrImport(path) {
try {
return require(path)
} catch (e) {
// @ts-expect-error
if (pathToFileURL && e.code === 'ERR_REQUIRE_ESM') {
// This is needed on Windows, because import() fails if providing a Windows file path.
const url = pathToFileURL(path)
// @ts-expect-error
return import(url)
}
throw e
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@
"prettier": "prettier --ignore-unknown '**/*'",
"prettier:write": "pnpm run prettier --write",
"test:build": "publint --strict",
"test:types": "tsc",
"test:eslint": "eslint --ext .ts,.tsx src",
"test:format": "pnpm run prettier --check",
"test:pr": "nx run-many --targets=test:format,test:eslint,test:build",
"test:ci": "nx run-many --targets=test:format,test:eslint,test:build"
"test:pr": "nx run-many --targets=test:format,test:eslint,test:types,test:build",
"test:ci": "nx run-many --targets=test:format,test:eslint,test:types,test:build"
},
"nx": {
"includedScripts": [
"test:format",
"test:eslint",
"test:types",
"test:build"
]
},
Expand Down
24 changes: 14 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"lib": ["ES2022"],
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"strictNullChecks": true,
"allowUnreachableCode": true,
"baseUrl": ".",
"checkJs": true,
"declaration": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"lib": ["ES2022"],
"module": "ES2020",
"moduleResolution": "Bundler",
"noEmit": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"skipLibCheck": true,
"baseUrl": ".",
"allowUnreachableCode": true
"strict": true,
"strictNullChecks": true,
"target": "ES2020"
},
"include": ["bin", "prettier.config.js", "src"]
}

0 comments on commit 00dc983

Please sign in to comment.