Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #440 from kachick/ts5
Browse files Browse the repository at this point in the history
Migrate to TypeScript 5
  • Loading branch information
kachick authored Apr 17, 2023
2 parents 717780b + 85a2200 commit 556faa7
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ rules:
'@typescript-eslint/prefer-readonly-parameter-types':
- error
- ignoreInferredTypes: true
# See https://zenn.dev/teppeis/articles/2023-04-typescript-5_0-verbatim-module-syntax for enabling reason
'@typescript-eslint/consistent-type-imports': 'error'
'@typescript-eslint/no-import-type-side-effects': 'error'
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 12
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ const config: Config.InitialOptions = {
extensionsToTreatAsEsm: ['.ts'],
testMatch: ['**/**/*.test.ts'],
};
export default config;
module.exports = config;
29 changes: 8 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@tsconfig/node16-strictest-esm": "^1.0.3",
"@types/node": "^16.18.23",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
Expand All @@ -44,6 +43,6 @@
"jest": "^29.5.0",
"ts-node": "^10.9.1",
"tsx": "^3.12.6",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion src/elm-package-detector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from 'fs';
import { BuildTarget, Package, PackageCache, Snapshot } from '@github/dependency-submission-toolkit';
import { BuildTarget, type Package, PackageCache, Snapshot } from '@github/dependency-submission-toolkit';
import { context } from '@actions/github';
import { PackageURL } from 'packageurl-js';
import { assertIsDefined } from './typeguards';
Expand Down
30 changes: 30 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Import from https://github.com/tsconfig/bases/commit/0ae4791797d8ba3dd2bca9aca880eb2d3e30e6fb
// To avoid issues around tsconfig.extends array
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16 + Strictest",
"compilerOptions": {
"lib": [
"es2021"
],
"module": "commonjs",
"target": "es2021",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"verbatimModuleSyntax": true,
"checkJs": true
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// https://github.com/tsconfig/bases/blob/d1543a94d47c3ef9af9987790742b09caf71b71d/bases/node16-strictest-esm.combined.json
"extends": "@tsconfig/node16-strictest-esm/tsconfig.json",
// TODO: Use tsconfig/base after all tools support tsconfig.extends array
"extends": "./tsconfig.base.json",
"compilerOptions": {
// https://www.typescriptlang.org/docs/handbook/esm-node.html
"module": "node16",
Expand Down

0 comments on commit 556faa7

Please sign in to comment.