Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TypeScript 5 while keeping current tools and avoiding the new TS5 "tsconfig.extends array" feature. #313

Merged
merged 16 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { wait } from '../src/wait';
import { env, execPath } from 'process';
import { execFileSync, ExecFileSyncOptions } from 'child_process';
import { execFileSync, type ExecFileSyncOptions } from 'child_process';
import { join } from 'path';
import { expect, test } from '@jest/globals';

Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b77bbeca8ba3069eea82a3711242cdc2240cc7c9.tar.gz") { } }:
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4c3edba85629ec304b5269e4b0ac7f26c433df23.tar.gz") { } }:

pkgs.mkShell {
buildInputs = [
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ const config: Config.InitialOptions = {
extensionsToTreatAsEsm: ['.ts'],
testMatch: ['**/**/*.test.ts'],
};
export default config;
module.exports = config;
450 changes: 208 additions & 242 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"pretest": "npm run package",
"test": "jest",
"typecheck": "tsc",
"repl": "tsx",
"all": "npm run format:check && npm run lint:check && npm run build && npm run package && npm test"
"repl": "tsx"
},
"repository": {
"type": "git",
Expand All @@ -32,7 +31,6 @@
},
"devDependencies": {
"@octokit/types": "^9.0.0",
"@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 +42,6 @@
"jest": "^29.5.0",
"ts-node": "^10.9.1",
"tsx": "^3.12.6",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
}
}
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