From b8b05dd8976a91dc809972b3aaa12c975dea580a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 16 Apr 2023 22:59:46 +0000 Subject: [PATCH 1/4] Update dependency typescript to v5 --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f2aba44..1887aa3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "eslint-plugin-react-hooks": "4.6.0", "ts-node-test": "0.4.1", "tsx": "3.12.6", - "typescript": "4.9.5", + "typescript": "5.0.4", "vite": "4.2.1" } }, @@ -3827,16 +3827,16 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/update-browserslist-db": { @@ -6738,9 +6738,9 @@ "dev": true }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true }, "update-browserslist-db": { diff --git a/package.json b/package.json index 7df0255b..7a9fa4dc 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "eslint-plugin-react-hooks": "4.6.0", "ts-node-test": "0.4.1", "tsx": "3.12.6", - "typescript": "4.9.5", + "typescript": "5.0.4", "vite": "4.2.1" }, "scripts": { From aca53a7559cd0538b28447a08ead84ce25cf2581 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 18 Apr 2023 02:43:43 +0900 Subject: [PATCH 2/4] Update tsconfig and eslint config for TS5 era --- .eslintrc.yml | 3 +++ tsconfig.base.json | 30 ++++++++++++++++++++++++++++++ tsconfig.json | 3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tsconfig.base.json diff --git a/.eslintrc.yml b/.eslintrc.yml index dae9209a..d9b2a0cc 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -37,6 +37,9 @@ rules: - selector: TSEnumDeclaration message: >- Don't declare enums. ref: https://www.kabuku.co.jp/developers/good-bye-typescript-enum + # 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' overrides: - files: - src/**/*.ts diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000..d564fc00 --- /dev/null +++ b/tsconfig.base.json @@ -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 18 + ESM + Strictest", + "compilerOptions": { + "lib": [ + "es2022" + ], + "module": "es2022", + "target": "es2022", + "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 + } +} diff --git a/tsconfig.json b/tsconfig.json index 1ba4e8a5..a17dbaae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { - "extends": "@tsconfig/node18-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", From 599322cf9fa46ef4114abe43f7a812cdafe3628a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 18 Apr 2023 02:45:21 +0900 Subject: [PATCH 3/4] `npm uninstall @tsconfig/node18-strictest-esm` --- package-lock.json | 13 ------------- package.json | 1 - 2 files changed, 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index d7214d4d..f738941a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "devDependencies": { "@testing-library/react": "14.0.0", "@testing-library/user-event": "14.4.3", - "@tsconfig/node18-strictest-esm": "1.0.1", "@types/node": "18.15.11", "@types/react": "18.0.36", "@types/react-dom": "18.0.11", @@ -1168,12 +1167,6 @@ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, - "node_modules/@tsconfig/node18-strictest-esm": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node18-strictest-esm/-/node18-strictest-esm-1.0.1.tgz", - "integrity": "sha512-cHzmAqw7CMbyqROWeBgVhard3F2V6zxOSJnQ4E6SJWruXD5ypuP9/QKekwBdfXQ4oUTaizIICKIwb+v3v33t0w==", - "dev": true - }, "node_modules/@types/aria-query": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", @@ -4862,12 +4855,6 @@ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, - "@tsconfig/node18-strictest-esm": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node18-strictest-esm/-/node18-strictest-esm-1.0.1.tgz", - "integrity": "sha512-cHzmAqw7CMbyqROWeBgVhard3F2V6zxOSJnQ4E6SJWruXD5ypuP9/QKekwBdfXQ4oUTaizIICKIwb+v3v33t0w==", - "dev": true - }, "@types/aria-query": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", diff --git a/package.json b/package.json index b216ee71..ecd66210 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "devDependencies": { "@testing-library/react": "14.0.0", "@testing-library/user-event": "14.4.3", - "@tsconfig/node18-strictest-esm": "1.0.1", "@types/node": "18.15.11", "@types/react": "18.0.36", "@types/react-dom": "18.0.11", From d4394bbf4141afdcaddc8be1af7cb4ce9c962030 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 18 Apr 2023 02:51:09 +0900 Subject: [PATCH 4/4] Update type importing for TS5 verbatimModuleSyntax --- src/common/usersContexts.tsx | 2 +- src/session/Interval.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/usersContexts.tsx b/src/common/usersContexts.tsx index f6857ac2..eb5fa564 100644 --- a/src/common/usersContexts.tsx +++ b/src/common/usersContexts.tsx @@ -1,4 +1,4 @@ -import { createContext, ReactElement, useContext, useState } from "react"; +import { createContext, type ReactElement, useContext, useState } from "react"; import { getStorageUsers, setStorageUsers } from "./storage"; const usersContext = createContext([]); diff --git a/src/session/Interval.tsx b/src/session/Interval.tsx index 3f4379b2..2e374c97 100644 --- a/src/session/Interval.tsx +++ b/src/session/Interval.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, useCallback } from "react"; +import { type ChangeEvent, useCallback } from "react"; import TextInput from "../common/TextInput";