diff --git a/.changeset/modern-parents-float.md b/.changeset/modern-parents-float.md new file mode 100644 index 0000000000..326d098c76 --- /dev/null +++ b/.changeset/modern-parents-float.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": minor +--- + +Upgraded typescript-eslint to v6, with reworked ESLint configurations diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c860b469b1..a050858b18 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -4,8 +4,8 @@ const config = { parser: "@typescript-eslint/parser", plugins: ["isaacscript", "import"], extends: [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", "plugin:prettier/recommended", ], parserOptions: { @@ -19,8 +19,16 @@ const config = { "./www/tsconfig.json", ], }, + overrides: [ + // Template files don't have reliable type information + { + files: ["./cli/template/**/*.{ts,tsx}"], + extends: ["plugin:@typescript-eslint/disable-type-checked"], + }, + ], rules: { - "@typescript-eslint/restrict-template-expressions": "off", + // These off/not-configured-the-way-we-want lint rules we like & opt into + "@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" }, @@ -31,19 +39,13 @@ const config = { ], "import/consistent-type-specifier-style": ["error", "prefer-inline"], - // These rules are only disabled because we hit a bug in linting. - // See https://github.com/t3-oss/create-t3-app/pull/1036#discussion_r1060505136 - // If you still see the bug once TypeScript@5 is used, please let typescript-eslint know! - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unnecessary-type-assertion": "off", - // For educational purposes we format our comments/jsdoc nicely "isaacscript/complete-sentences-jsdoc": "warn", "isaacscript/format-jsdoc-comments": "warn", + + // These lint rules don't make sense for us but are enabled in the preset configs + "@typescript-eslint/no-confusing-void-expression": "off", + "@typescript-eslint/restrict-template-expressions": "off", }, }; diff --git a/cli/.eslintignore b/cli/.eslintignore new file mode 100644 index 0000000000..1521c8b765 --- /dev/null +++ b/cli/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/cli/src/helpers/installDependencies.ts b/cli/src/helpers/installDependencies.ts index a0c3824729..00e7c3f485 100644 --- a/cli/src/helpers/installDependencies.ts +++ b/cli/src/helpers/installDependencies.ts @@ -7,9 +7,9 @@ import { } from "~/utils/getUserPkgManager.js"; import { logger } from "~/utils/logger.js"; -type Options = { +interface Options { projectDir: string; -}; +} /*eslint-disable @typescript-eslint/no-floating-promises*/ const runInstallCommand = async ( @@ -76,7 +76,7 @@ export const installDependencies = async ({ projectDir }: Options) => { // If the spinner was used to show the progress, use succeed method on it // If not, use the succeed on a new spinner - (installSpinner || ora()).succeed( + (installSpinner ?? ora()).succeed( chalk.green("Successfully installed dependencies!\n") ); }; diff --git a/cli/src/helpers/installPackages.ts b/cli/src/helpers/installPackages.ts index 1f5b4089b6..496796cd83 100644 --- a/cli/src/helpers/installPackages.ts +++ b/cli/src/helpers/installPackages.ts @@ -6,9 +6,9 @@ import { } from "~/installers/index.js"; import { logger } from "~/utils/logger.js"; -type InstallPackagesOptions = { +type InstallPackagesOptions = InstallerOptions & { packages: PkgInstallerMap; -} & InstallerOptions; +}; // This runs the installer for all the packages that the user has selected export const installPackages = (options: InstallPackagesOptions) => { const { packages } = options; diff --git a/cli/src/helpers/logNextSteps.ts b/cli/src/helpers/logNextSteps.ts index 1541d28422..a77f92e911 100644 --- a/cli/src/helpers/logNextSteps.ts +++ b/cli/src/helpers/logNextSteps.ts @@ -8,7 +8,7 @@ export const logNextSteps = ({ projectName = DEFAULT_APP_NAME, packages, noInstall, -}: Pick) => { +}: Pick) => { const pkgManager = getUserPkgManager(); logger.info("Next steps:"); diff --git a/cli/src/helpers/selectBoilerplate.ts b/cli/src/helpers/selectBoilerplate.ts index 6589ec8b7c..4ba343a03a 100644 --- a/cli/src/helpers/selectBoilerplate.ts +++ b/cli/src/helpers/selectBoilerplate.ts @@ -4,7 +4,7 @@ import { PKG_ROOT } from "~/consts.js"; import { type InstallerOptions } from "~/installers/index.js"; type SelectBoilerplateProps = Required< - Pick + Pick >; // This generates the _app.tsx file that is used to render the app export const selectAppFile = ({ diff --git a/cli/src/utils/renderVersionWarning.ts b/cli/src/utils/renderVersionWarning.ts index 5029510afc..61cc5f65e7 100644 --- a/cli/src/utils/renderVersionWarning.ts +++ b/cli/src/utils/renderVersionWarning.ts @@ -37,9 +37,9 @@ export const renderVersionWarning = (npmVersion: string) => { * directory of this source tree. * https://github.com/facebook/create-react-app/blob/main/packages/create-react-app/LICENSE */ -type DistTagsBody = { +interface DistTagsBody { latest: string; -}; +} function checkForLatestVersion(): Promise { return new Promise((resolve, reject) => { diff --git a/cli/template/base/_eslintrc.cjs b/cli/template/base/_eslintrc.cjs index 8b7a0e8f9c..2e6e541cf4 100644 --- a/cli/template/base/_eslintrc.cjs +++ b/cli/template/base/_eslintrc.cjs @@ -1,25 +1,15 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const path = require("path"); - /** @type {import("eslint").Linter.Config} */ const config = { - overrides: [ - { - extends: [ - "plugin:@typescript-eslint/recommended-requiring-type-checking", - ], - files: ["*.ts", "*.tsx"], - parserOptions: { - project: path.join(__dirname, "tsconfig.json"), - }, - }, - ], parser: "@typescript-eslint/parser", parserOptions: { - project: path.join(__dirname, "tsconfig.json"), + project: true, }, plugins: ["@typescript-eslint"], - extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], + extends: [ + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + ], rules: { "@typescript-eslint/consistent-type-imports": [ "warn", diff --git a/cli/template/base/package.json b/cli/template/base/package.json index 7ef32803ce..778150c317 100644 --- a/cli/template/base/package.json +++ b/cli/template/base/package.json @@ -20,8 +20,8 @@ "@types/node": "^18.16.0", "@types/react": "^18.2.6", "@types/react-dom": "^18.2.4", - "@typescript-eslint/eslint-plugin": "^5.59.6", - "@typescript-eslint/parser": "^5.59.6", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", "eslint": "^8.40.0", "eslint-config-next": "^13.4.2", "typescript": "^5.0.4" diff --git a/cli/template/extras/src/server/api/trpc/with-auth-prisma.ts b/cli/template/extras/src/server/api/trpc/with-auth-prisma.ts index c2491f0a88..b044d0deb3 100644 --- a/cli/template/extras/src/server/api/trpc/with-auth-prisma.ts +++ b/cli/template/extras/src/server/api/trpc/with-auth-prisma.ts @@ -23,9 +23,9 @@ import { prisma } from "~/server/db"; * These allow you to access things when processing a request, like the database, the session, etc. */ -type CreateContextOptions = { +interface CreateContextOptions { session: Session | null; -}; +} /** * This helper generates the "internals" for a tRPC context. If you need to use it, you can export @@ -108,7 +108,7 @@ export const publicProcedure = t.procedure; /** Reusable middleware that enforces users are logged in before running the procedure. */ const enforceUserIsAuthed = t.middleware(({ ctx, next }) => { - if (!ctx.session || !ctx.session.user) { + if (!ctx.session?.user) { throw new TRPCError({ code: "UNAUTHORIZED" }); } return next({ diff --git a/cli/template/extras/src/server/api/trpc/with-auth.ts b/cli/template/extras/src/server/api/trpc/with-auth.ts index 9f4a31fde6..bb4776b229 100644 --- a/cli/template/extras/src/server/api/trpc/with-auth.ts +++ b/cli/template/extras/src/server/api/trpc/with-auth.ts @@ -21,9 +21,9 @@ import { getServerAuthSession } from "~/server/auth"; * These allow you to access things when processing a request, like the database, the session, etc. */ -type CreateContextOptions = { +interface CreateContextOptions { session: Session | null; -}; +} /** * This helper generates the "internals" for a tRPC context. If you need to use it, you can export @@ -106,7 +106,7 @@ export const publicProcedure = t.procedure; /** Reusable middleware that enforces users are logged in before running the procedure. */ const enforceUserIsAuthed = t.middleware(({ ctx, next }) => { - if (!ctx.session || !ctx.session.user) { + if (!ctx.session?.user) { throw new TRPCError({ code: "UNAUTHORIZED" }); } return next({ diff --git a/cli/template/extras/src/server/auth/base.ts b/cli/template/extras/src/server/auth/base.ts index 1113ac3bdc..18dc5373bd 100644 --- a/cli/template/extras/src/server/auth/base.ts +++ b/cli/template/extras/src/server/auth/base.ts @@ -15,11 +15,11 @@ import { env } from "~/env.mjs"; */ declare module "next-auth" { interface Session extends DefaultSession { - user: { + user: DefaultSession["user"] & { id: string; // ...other properties // role: UserRole; - } & DefaultSession["user"]; + }; } // interface User { diff --git a/cli/template/extras/src/server/auth/with-prisma.ts b/cli/template/extras/src/server/auth/with-prisma.ts index e3f544447d..c20057e7d8 100644 --- a/cli/template/extras/src/server/auth/with-prisma.ts +++ b/cli/template/extras/src/server/auth/with-prisma.ts @@ -17,11 +17,11 @@ import { prisma } from "~/server/db"; */ declare module "next-auth" { interface Session extends DefaultSession { - user: { + user: DefaultSession["user"] & { id: string; // ...other properties // role: UserRole; - } & DefaultSession["user"]; + }; } // interface User { diff --git a/cli/tsconfig.eslint.json b/cli/tsconfig.eslint.json index 5d94b40d2c..8f55a9c420 100644 --- a/cli/tsconfig.eslint.json +++ b/cli/tsconfig.eslint.json @@ -1,3 +1,4 @@ { + "extends": "./tsconfig.json", "include": ["src", "template", "tsup.config.ts"] } diff --git a/package.json b/package.json index 6addbbe4ea..7f0932c651 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "@types/eslint": "^8.37.0", "@types/node": "^18.16.0", "@types/prettier": "^2.7.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", - "@typescript-eslint/parser": "^5.59.6", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", "eslint": "^8.40.0", "eslint-config-prettier": "^8.8.0", "eslint-config-turbo": "^0.0.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 373a688c91..2772cfee92 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,11 +26,11 @@ importers: specifier: ^2.7.2 version: 2.7.2 '@typescript-eslint/eslint-plugin': - specifier: ^5.59.6 - version: 5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.40.0)(typescript@5.0.4) + specifier: 6.0.0 + version: 6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.40.0)(typescript@5.0.4) '@typescript-eslint/parser': - specifier: ^5.59.6 - version: 5.59.6(eslint@8.40.0)(typescript@5.0.4) + specifier: 6.0.0 + version: 6.0.0(eslint@8.40.0)(typescript@5.0.4) eslint: specifier: ^8.40.0 version: 8.40.0 @@ -42,10 +42,10 @@ importers: version: 0.0.9(eslint@8.40.0) eslint-plugin-import: specifier: ^2.27.5 - version: 2.27.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + version: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint@8.40.0) eslint-plugin-isaacscript: specifier: ^2.6.7 - version: 2.6.7(@typescript-eslint/parser@5.59.6)(eslint@8.40.0)(typescript@5.0.4) + version: 2.6.7(@typescript-eslint/parser@6.0.0)(eslint@8.40.0)(typescript@5.0.4) eslint-plugin-prettier: specifier: ^4.2.1 version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.40.0)(prettier@2.8.8) @@ -259,11 +259,11 @@ importers: specifier: ^3.0.2 version: 3.0.2 '@typescript-eslint/eslint-plugin': - specifier: ^5.59.6 - version: 5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.40.0)(typescript@5.0.4) + specifier: 6.0.0 + version: 6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.40.0)(typescript@5.0.4) '@typescript-eslint/parser': - specifier: ^5.59.6 - version: 5.59.6(eslint@8.40.0)(typescript@5.0.4) + specifier: 6.0.0 + version: 6.0.0(eslint@8.40.0)(typescript@5.0.4) autoprefixer: specifier: ^10.4.14 version: 10.4.14(postcss@8.4.23) @@ -380,8 +380,8 @@ importers: specifier: ^1.0.0 version: 1.0.0 '@typescript-eslint/parser': - specifier: ^5.59.6 - version: 5.59.6(eslint@8.40.0)(typescript@5.0.4) + specifier: 6.0.0 + version: 6.0.0(eslint@8.40.0)(typescript@5.0.4) astro: specifier: ^2.4.5 version: 2.4.5(@types/node@18.16.1)(sharp@0.32.1) @@ -1419,6 +1419,10 @@ packages: resolution: {integrity: sha512-BISJ6ZE4xQsuL/FmsyRaiffpq977bMlsKfGHTQrOGFErfByxIe6iZTxPf/00Zon9b9a7iUykfQwejN3s2ZW/Bw==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + /@eslint-community/regexpp@4.5.1: + resolution: {integrity: sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + /@eslint/eslintrc@2.0.3: resolution: {integrity: sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2758,35 +2762,38 @@ packages: /@types/yargs-parser@21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} - /@typescript-eslint/eslint-plugin@5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.40.0)(typescript@5.0.4): - resolution: {integrity: sha512-sXtOgJNEuRU5RLwPUb1jxtToZbgvq3M6FPpY4QENxoOggK+UpTxUBpj6tD8+Qh2g46Pi9We87E+eHnUw8YcGsw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/eslint-plugin@6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - '@typescript-eslint/parser': ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@eslint-community/regexpp': 4.4.1 - '@typescript-eslint/parser': 5.59.6(eslint@8.40.0)(typescript@5.0.4) - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/type-utils': 5.59.6(eslint@8.40.0)(typescript@5.0.4) - '@typescript-eslint/utils': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@eslint-community/regexpp': 4.5.1 + '@typescript-eslint/parser': 6.0.0(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/type-utils': 6.0.0(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/utils': 6.0.0(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/visitor-keys': 6.0.0 debug: 4.3.4 eslint: 8.40.0 grapheme-splitter: 1.0.4 + graphemer: 1.4.0 ignore: 5.2.4 + natural-compare: 1.4.0 natural-compare-lite: 1.4.0 - semver: 7.3.8 - tsutils: 3.21.0(typescript@5.0.4) + semver: 7.5.1 + ts-api-utils: 1.0.1(typescript@5.0.4) typescript: 5.0.4 transitivePeerDependencies: - supports-color - /@typescript-eslint/parser@5.59.6(eslint@8.40.0)(typescript@5.0.4): - resolution: {integrity: sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==} + /@typescript-eslint/parser@5.62.0(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2795,47 +2802,81 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.4) + '@typescript-eslint/scope-manager': 5.62.0 + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.4) debug: 4.3.4 eslint: 8.40.0 typescript: 5.0.4 transitivePeerDependencies: - supports-color + dev: true - /@typescript-eslint/scope-manager@5.59.6: - resolution: {integrity: sha512-gLbY3Le9Dxcb8KdpF0+SJr6EQ+hFGYFl6tVY8VxLPFDfUZC7BHFw+Vq7bM5lE9DwWPfx4vMWWTLGXgpc0mAYyQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/parser@6.0.0(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/visitor-keys': 5.59.6 + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.0.4) + '@typescript-eslint/visitor-keys': 6.0.0 + debug: 4.3.4 + eslint: 8.40.0 + typescript: 5.0.4 + transitivePeerDependencies: + - supports-color - /@typescript-eslint/type-utils@5.59.6(eslint@8.40.0)(typescript@5.0.4): - resolution: {integrity: sha512-A4tms2Mp5yNvLDlySF+kAThV9VTBPCvGf0Rp8nl/eoDX9Okun8byTKoj3fJ52IJitjWOk0fKPNQhXEB++eNozQ==} + /@typescript-eslint/scope-manager@5.62.0: + resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/visitor-keys': 5.62.0 + dev: true + + /@typescript-eslint/scope-manager@6.0.0: + resolution: {integrity: sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 + + /@typescript-eslint/type-utils@6.0.0(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: '*' + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.4) - '@typescript-eslint/utils': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.0.4) + '@typescript-eslint/utils': 6.0.0(eslint@8.40.0)(typescript@5.0.4) debug: 4.3.4 eslint: 8.40.0 - tsutils: 3.21.0(typescript@5.0.4) + ts-api-utils: 1.0.1(typescript@5.0.4) typescript: 5.0.4 transitivePeerDependencies: - supports-color - /@typescript-eslint/types@5.59.6: - resolution: {integrity: sha512-tH5lBXZI7T2MOUgOWFdVNUILsI02shyQvfzG9EJkoONWugCG77NDDa1EeDGw7oJ5IvsTAAGVV8I3Tk2PNu9QfA==} + /@typescript-eslint/types@5.62.0: + resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + + /@typescript-eslint/types@6.0.0: + resolution: {integrity: sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==} + engines: {node: ^16.0.0 || >=18.0.0} - /@typescript-eslint/typescript-estree@5.59.6(typescript@5.0.4): - resolution: {integrity: sha512-vW6JP3lMAs/Tq4KjdI/RiHaaJSO7IUsbkz17it/Rl9Q+WkQ77EOuOnlbaU8kKfVIOJxMhnRiBG+olE7f3M16DA==} + /@typescript-eslint/typescript-estree@5.62.0(typescript@5.0.4): + resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -2843,8 +2884,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/visitor-keys': 5.59.6 + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/visitor-keys': 5.62.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -2853,19 +2894,40 @@ packages: typescript: 5.0.4 transitivePeerDependencies: - supports-color + dev: true - /@typescript-eslint/utils@5.59.6(eslint@8.40.0)(typescript@5.0.4): - resolution: {integrity: sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/typescript-estree@6.0.0(typescript@5.0.4): + resolution: {integrity: sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.1 + ts-api-utils: 1.0.1(typescript@5.0.4) + typescript: 5.0.4 + transitivePeerDependencies: + - supports-color + + /@typescript-eslint/utils@6.0.0(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.3.0(eslint@8.40.0) '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.4) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.0.4) eslint: 8.40.0 eslint-scope: 5.1.1 semver: 7.5.1 @@ -2873,11 +2935,19 @@ packages: - supports-color - typescript - /@typescript-eslint/visitor-keys@5.59.6: - resolution: {integrity: sha512-zEfbFLzB9ETcEJ4HZEEsCR9HHeNku5/Qw1jSS5McYJv5BR+ftYXwFFAH5Al+xkGaZEqowMwl7uoJjQb1YSPF8Q==} + /@typescript-eslint/visitor-keys@5.62.0: + resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.59.6 + '@typescript-eslint/types': 5.62.0 + eslint-visitor-keys: 3.4.1 + dev: true + + /@typescript-eslint/visitor-keys@6.0.0: + resolution: {integrity: sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.0.0 eslint-visitor-keys: 3.4.1 /@vercel/analytics@0.1.11(react@18.2.0): @@ -3266,8 +3336,8 @@ packages: engines: {node: ^14.18.0 || >=16.0.0} dependencies: '@astrojs/compiler': 1.4.1 - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 + '@typescript-eslint/scope-manager': 5.62.0 + '@typescript-eslint/types': 5.62.0 astrojs-compiler-sync: 0.3.2(@astrojs/compiler@1.4.1) debug: 4.3.4 eslint-visitor-keys: 3.4.1 @@ -4260,11 +4330,11 @@ packages: dependencies: '@next/eslint-plugin-next': 13.4.1 '@rushstack/eslint-patch': 1.2.0 - '@typescript-eslint/parser': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.62.0(eslint@8.40.0)(typescript@5.0.4) eslint: 8.40.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint@8.40.0) eslint-plugin-jsx-a11y: 6.7.1(eslint@8.40.0) eslint-plugin-react: 7.32.2(eslint@8.40.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.40.0) @@ -4301,7 +4371,7 @@ packages: transitivePeerDependencies: - supports-color - /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0): + /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0): resolution: {integrity: sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -4311,8 +4381,8 @@ packages: debug: 4.3.4 enhanced-resolve: 5.14.0 eslint: 8.40.0 - eslint-module-utils: 2.7.4(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint-module-utils: 2.7.4(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint@8.40.0) get-tsconfig: 4.5.0 globby: 13.1.3 is-core-module: 2.11.0 @@ -4323,8 +4393,9 @@ packages: - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color + dev: true - /eslint-module-utils@2.7.4(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0): + /eslint-module-utils@2.7.4(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0): resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==} engines: {node: '>=4'} peerDependencies: @@ -4345,11 +4416,40 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.62.0(eslint@8.40.0)(typescript@5.0.4) + debug: 3.2.7 + eslint: 8.40.0 + eslint-import-resolver-node: 0.3.7 + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-module-utils@2.7.4(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint@8.40.0): + resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + dependencies: + '@typescript-eslint/parser': 6.0.0(eslint@8.40.0)(typescript@5.0.4) debug: 3.2.7 eslint: 8.40.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) transitivePeerDependencies: - supports-color @@ -4361,7 +4461,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.3.0(eslint@8.40.0) '@jridgewell/sourcemap-codec': 1.4.14 - '@typescript-eslint/types': 5.59.6 + '@typescript-eslint/types': 5.62.0 astro-eslint-parser: 0.14.0 eslint: 8.40.0 postcss: 8.4.23 @@ -4370,7 +4470,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0): + /eslint-plugin-import@2.27.5(@typescript-eslint/parser@6.0.0)(eslint@8.40.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -4380,7 +4480,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 6.0.0(eslint@8.40.0)(typescript@5.0.4) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -4388,7 +4488,7 @@ packages: doctrine: 2.1.0 eslint: 8.40.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.7.4(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint-module-utils: 2.7.4(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint@8.40.0) has: 1.0.3 is-core-module: 2.11.0 is-glob: 4.0.3 @@ -4402,14 +4502,14 @@ packages: - eslint-import-resolver-webpack - supports-color - /eslint-plugin-isaacscript@2.6.7(@typescript-eslint/parser@5.59.6)(eslint@8.40.0)(typescript@5.0.4): + /eslint-plugin-isaacscript@2.6.7(@typescript-eslint/parser@6.0.0)(eslint@8.40.0)(typescript@5.0.4): resolution: {integrity: sha512-DiXhGx078zJeMxTb+atnpJp70sCTNW+kgd8NEIQHn+7eabY+60Op3STT13ht5Jrs5FryGwZvUh3RqIrlmmAtIg==} peerDependencies: '@typescript-eslint/parser': '>= 5.0.0' eslint: '>= 8.0.0' typescript: '>= 4.0.0' dependencies: - '@typescript-eslint/parser': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 6.0.0(eslint@8.40.0)(typescript@5.0.4) eslint: 8.40.0 typescript: 5.0.4 dev: false @@ -4949,6 +5049,7 @@ packages: /get-tsconfig@4.5.0: resolution: {integrity: sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==} + dev: true /git-hooks-list@3.1.0: resolution: {integrity: sha512-LF8VeHeR7v+wAbXqfgRlTSX/1BJR9Q1vEMR8JAz1cEg6GX07+zyj3sAdDvYjj/xnlIfVuGgj4qBei1K3hKH+PA==} @@ -5095,6 +5196,9 @@ packages: /grapheme-splitter@1.0.4: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + /gray-matter@4.0.3: resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} engines: {node: '>=6.0'} @@ -8647,6 +8751,14 @@ packages: /trough@2.1.0: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} + /ts-api-utils@1.0.1(typescript@5.0.4): + resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} + engines: {node: '>=16.13.0'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.0.4 + /ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} @@ -8670,6 +8782,7 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + dev: true /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} @@ -8718,6 +8831,7 @@ packages: dependencies: tslib: 1.14.1 typescript: 5.0.4 + dev: true /tty-table@4.2.1: resolution: {integrity: sha512-xz0uKo+KakCQ+Dxj1D/tKn2FSyreSYWzdkL/BYhgN6oMW808g8QRMuh1atAV9fjTPbWBjfbkKQpI/5rEcnAc7g==} diff --git a/upgrade/package.json b/upgrade/package.json index 64d5745718..f80064019f 100644 --- a/upgrade/package.json +++ b/upgrade/package.json @@ -46,8 +46,8 @@ "@types/react": "^18.2.6", "@types/react-dom": "^18.2.4", "@types/refractor": "^3.0.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", - "@typescript-eslint/parser": "^5.59.6", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", "autoprefixer": "^10.4.14", "eslint": "^8.40.0", "eslint-config-next": "^13.4.1", diff --git a/upgrade/src/app/api/og/route.tsx b/upgrade/src/app/api/og/route.tsx index a2ec2df9a4..499bd8876e 100644 --- a/upgrade/src/app/api/og/route.tsx +++ b/upgrade/src/app/api/og/route.tsx @@ -129,5 +129,8 @@ async function getFont({ const res = await fetch(font.url); return [font.weight, await res.arrayBuffer()]; }); + + // Object.fromEntries is typed as returning any *sigh* + // eslint-disable-next-line @typescript-eslint/no-unsafe-return return Object.fromEntries(await Promise.all(promises)); } diff --git a/upgrade/src/app/diff/[slug]/page.tsx b/upgrade/src/app/diff/[slug]/page.tsx index e07c6831d8..5a8a249714 100644 --- a/upgrade/src/app/diff/[slug]/page.tsx +++ b/upgrade/src/app/diff/[slug]/page.tsx @@ -63,7 +63,7 @@ export default async function Page({ }) { if (!params?.slug) notFound(); const versionsAndFeatures = extractVersionsAndFeatures(params.slug); - const viewType = searchParams["viewType"] === "unified" ? "unified" : "split"; + const viewType = searchParams.viewType === "unified" ? "unified" : "split"; if (!versionsAndFeatures) notFound(); const diff = await getDiffFromGithub(versionsAndFeatures).catch(notFound); diff --git a/upgrade/src/lib/utils.ts b/upgrade/src/lib/utils.ts index 0325152d74..955a93d50a 100644 --- a/upgrade/src/lib/utils.ts +++ b/upgrade/src/lib/utils.ts @@ -14,10 +14,12 @@ export const prettyFeatureNameMap: Record = { tailwind: "Tailwind CSS", }; -export type VersionsGroupedByMajor = Array<{ +export interface VersionGroupedByMajor { major: string; versions: string[]; -}>; +} + +export type VersionsGroupedByMajor = VersionGroupedByMajor[]; export const getT3Versions = async () => { const releases = await request("GET /repos/{owner}/{repo}/releases", { @@ -102,10 +104,10 @@ export const getFeatureUrl = (feature: string) => { } }; -type VersionsRegex = { +interface VersionsRegex { currentVersion: string; upgradeVersion: string; -}; +} export const extractVersionsAndFeatures = (slug: string) => { const regex = diff --git a/upgrade/src/mdx-components.tsx b/upgrade/src/mdx-components.tsx index cf768dc97f..f3b432cb77 100644 --- a/upgrade/src/mdx-components.tsx +++ b/upgrade/src/mdx-components.tsx @@ -27,7 +27,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents { const Component = isExternal ? "a" : Link; return ( {children} diff --git a/www/package.json b/www/package.json index b1c884f452..803563a9b3 100644 --- a/www/package.json +++ b/www/package.json @@ -48,7 +48,7 @@ "@types/react-dom": "^18.2.4", "@types/react-typist": "^2.0.3", "@types/treeify": "^1.0.0", - "@typescript-eslint/parser": "^5.59.6", + "@typescript-eslint/parser": "6.0.0", "astro": "^2.4.5", "eslint": "^8.40.0", "eslint-plugin-astro": "^0.27.0", diff --git a/www/src/components/docs/breadCrumbs.tsx b/www/src/components/docs/breadCrumbs.tsx index 8931ccb92c..7dee760647 100644 --- a/www/src/components/docs/breadCrumbs.tsx +++ b/www/src/components/docs/breadCrumbs.tsx @@ -2,7 +2,7 @@ import { SIDEBAR, SIDEBAR_HEADER_MAP, type OuterHeaders } from "../../config"; import { getIsRtlFromLangCode, getLanguageFromURL } from "../../languages"; import clsx from "clsx"; -type SlugType = "" | "usage" | "deployment"; +type SlugType = "" | "deployment" | "usage"; export default function BreadCrumbs() { const lang = getLanguageFromURL(window.location.href); @@ -57,7 +57,7 @@ export default function BreadCrumbs() { href: `${window.location.protocol}//${window.location.host}${path}`, key: crumb, text: - getPathNameFromLink(path.slice(path.indexOf(lang))) || + getPathNameFromLink(path.slice(path.indexOf(lang))) ?? getHeaderName( `${crumb[0]?.toUpperCase()}${crumb.slice(1)}` as OuterHeaders, ), diff --git a/www/src/components/docs/callout.tsx b/www/src/components/docs/callout.tsx index 0cb17c3eb8..860e1e630d 100644 --- a/www/src/components/docs/callout.tsx +++ b/www/src/components/docs/callout.tsx @@ -4,7 +4,7 @@ export default function Callout({ type, children, }: { - type: "warning" | "info" | "tip"; + type: "info" | "tip" | "warning"; children: React.ReactNode; }) { const getEmoji = () => { diff --git a/www/src/components/navigation/LanguageSelect.tsx b/www/src/components/navigation/LanguageSelect.tsx index 7886f9c34b..142d5b8c12 100644 --- a/www/src/components/navigation/LanguageSelect.tsx +++ b/www/src/components/navigation/LanguageSelect.tsx @@ -4,9 +4,9 @@ import { Listbox, Transition } from "@headlessui/react"; import clsx from "clsx"; import { Fragment } from "react"; -type LanguageSelectProps = { +interface LanguageSelectProps { language: KnownLanguageCode; -}; +} export default function LanguageSelect({ language }: LanguageSelectProps) { const handleSelect = (code: string) => { diff --git a/www/src/components/navigation/OnThisPageLinks.tsx b/www/src/components/navigation/OnThisPageLinks.tsx index 3d2f7eb8d1..17f1bae505 100644 --- a/www/src/components/navigation/OnThisPageLinks.tsx +++ b/www/src/components/navigation/OnThisPageLinks.tsx @@ -3,11 +3,11 @@ import { type MarkdownHeading } from "astro"; import clsx from "clsx"; import { useEffect, useMemo, useState } from "react"; -type OnThisPageLinksProps = { +interface OnThisPageLinksProps { headings: MarkdownHeading[]; title: string; isRtl: boolean; -}; +} export default function OnThisPageLinks({ headings, diff --git a/www/src/components/navigation/Search.tsx b/www/src/components/navigation/Search.tsx index 8a7c024159..8e05832301 100644 --- a/www/src/components/navigation/Search.tsx +++ b/www/src/components/navigation/Search.tsx @@ -10,9 +10,11 @@ import { createPortal } from "react-dom"; /** FIXME: This is still kinda nasty, but DocSearch is not ESM ready. */ const DocSearchModal = docSearchReact.DocSearchModal || + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access (docSearchReact as any).default.DocSearchModal; const useDocSearchKeyboardEvents = docSearchReact.useDocSearchKeyboardEvents || + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access (docSearchReact as any).default.useDocSearchKeyboardEvents; export default function Search({ isLanding }: { isLanding: boolean }) { diff --git a/www/src/components/openGraph.tsx b/www/src/components/openGraph.tsx index 310174df72..7d1b2638e3 100644 --- a/www/src/components/openGraph.tsx +++ b/www/src/components/openGraph.tsx @@ -1,10 +1,10 @@ -type OpenGraphProps = { +interface OpenGraphProps { title: string; description: string; imageBase: string; pageUrl: string; rtl: boolean; -}; +} export default function OpenGraph({ title, diff --git a/www/src/config.ts b/www/src/config.ts index 97737e4e6f..f003da3d89 100644 --- a/www/src/config.ts +++ b/www/src/config.ts @@ -13,7 +13,7 @@ export const OPEN_GRAPH = { }; // This is the type of the frontmatter you put in the docs markdown files. -export type Frontmatter = { +export interface Frontmatter { title: string; description: string; layout: string; @@ -22,7 +22,7 @@ export type Frontmatter = { ogLocale?: string; lang?: KnownLanguageCode; isMdx?: boolean; -}; +} export const KNOWN_LANGUAGES = { // Add more languages here @@ -51,12 +51,14 @@ export const ALGOLIA = { apiKey: "892c4647b96fe1b3d0b7d8de1c5b5e40", }; -export type OuterHeaders = "Create T3 App" | "Usage" | "Deployment"; +export type OuterHeaders = "Create T3 App" | "Deployment" | "Usage"; -export type SidebarItem = { +export interface SidebarItem< + TCode extends KnownLanguageCode = KnownLanguageCode, +> { text: string; link: `${TCode}/${string}`; -}; +} export type SidebarItemLink = SidebarItem["link"]; diff --git a/www/src/utils/fetchGithub.ts b/www/src/utils/fetchGithub.ts index 667c276a95..5166451b60 100644 --- a/www/src/utils/fetchGithub.ts +++ b/www/src/utils/fetchGithub.ts @@ -1,10 +1,10 @@ import { z } from "zod"; -type Options = { +interface Options { throwIfNotOk?: boolean; throwIfNoAuth?: boolean; fetchType: T; -}; +} export const repoSchema = z.object({ stargazers_count: z.number(), @@ -27,7 +27,7 @@ export const commitsSchema = z.array( export type Commit = z.infer[number]; /** Helper function to fetch the GitHub API with an auth token to avoid rate limiting. */ -export const fetchGithub = async ( +export const fetchGithub = async ( url: string, opts: Options, ): Promise({ const res = await fetch(font.url); return [font.weight, await res.arrayBuffer()]; }); + + // Object.fromEntries is typed as returning any *sigh* + // eslint-disable-next-line @typescript-eslint/no-unsafe-return return Object.fromEntries(await Promise.all(promises)); } diff --git a/www/tailwind.config.ts b/www/tailwind.config.ts index 8ba7f87770..536ee92de4 100644 --- a/www/tailwind.config.ts +++ b/www/tailwind.config.ts @@ -66,6 +66,6 @@ export default { ], }, }, - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call plugins: [require("tailwind-scrollbar")({ nocompatible: true })], } satisfies Config;