From 98e93c1af2c22c4ccfc43bdf24c958df9b9b8914 Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Mon, 28 Aug 2023 23:29:55 -0400 Subject: [PATCH 01/11] chore(eslint): enable `@typescript-eslint/consistent-type-imports` --- packages/eslint-config/shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-config/shared.js b/packages/eslint-config/shared.js index ae75aebcafc0..3e4e02658f2d 100644 --- a/packages/eslint-config/shared.js +++ b/packages/eslint-config/shared.js @@ -143,6 +143,7 @@ module.exports = { ], }, ], + '@typescript-eslint/consistent-type-imports': 'error', }, overrides: [ { From 417d5b5aa911c59f2a6ec17ed61dc21a94188dcf Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Mon, 28 Aug 2023 23:31:36 -0400 Subject: [PATCH 02/11] chore(eslint): run `yarn lint:fix` --- .../src/__tests__/withApiProxy.test.ts | 2 +- .../src/__tests__/withFunctions.test.ts | 2 +- .../src/__tests__/withWebServer.test.ts | 2 +- packages/api-server/src/cliHandlers.ts | 2 +- packages/api-server/src/fastify.ts | 2 +- .../api-server/src/plugins/lambdaLoader.ts | 6 +++++- .../api-server/src/plugins/withApiProxy.ts | 5 +++-- .../api-server/src/plugins/withFunctions.ts | 2 +- .../api-server/src/plugins/withWebServer.ts | 4 ++-- packages/api-server/src/server.ts | 2 +- packages/api-server/src/types.ts | 4 ++-- .../getAuthenticationContext.test.ts | 2 +- packages/api/src/cache/index.ts | 2 +- packages/api/src/types.ts | 2 +- packages/api/src/webhooks/index.ts | 3 +-- .../auth-providers/auth0/api/src/decoder.ts | 2 +- .../auth-providers/auth0/setup/src/setup.ts | 2 +- .../auth0/setup/src/setupHandler.ts | 2 +- .../auth0/web/src/__tests__/auth0.test.tsx | 2 +- .../auth-providers/auth0/web/src/auth0.ts | 3 ++- .../azureActiveDirectory/api/src/decoder.ts | 2 +- .../azureActiveDirectory/setup/src/setup.ts | 2 +- .../setup/src/setupHandler.ts | 2 +- .../__tests__/azureActiveDirectory.test.tsx | 2 +- .../web/src/azureActiveDirectory.ts | 7 ++++--- .../auth-providers/clerk/api/src/decoder.ts | 2 +- .../auth-providers/clerk/setup/src/setup.ts | 2 +- .../clerk/setup/src/setupHandler.ts | 2 +- .../clerk/web/src/__tests__/clerk.test.tsx | 4 ++-- .../auth-providers/clerk/web/src/clerk.tsx | 5 +++-- .../auth-providers/custom/setup/src/setup.ts | 2 +- .../custom/setup/src/setupHandler.ts | 2 +- .../dbAuth/api/src/DbAuthHandler.ts | 9 ++------- .../auth-providers/dbAuth/api/src/decoder.ts | 2 +- .../auth-providers/dbAuth/setup/src/setup.ts | 2 +- .../dbAuth/setup/src/setupHandler.ts | 2 +- .../dbAuth/web/src/__tests__/dbAuth.test.ts | 5 +++-- .../auth-providers/dbAuth/web/src/dbAuth.ts | 5 +++-- .../firebase/api/src/decoder.ts | 2 +- .../firebase/setup/src/setup.ts | 2 +- .../firebase/setup/src/setupHandler.ts | 2 +- .../web/src/__tests__/firebase.test.tsx | 8 +++++--- .../firebase/web/src/firebase.ts | 3 ++- .../auth-providers/netlify/api/src/decoder.ts | 2 +- .../auth-providers/netlify/setup/src/setup.ts | 2 +- .../netlify/setup/src/setupHandler.ts | 2 +- .../web/src/__tests__/netlify.test.tsx | 4 ++-- .../auth-providers/netlify/web/src/netlify.ts | 5 +++-- .../supabase/api/src/decoder.ts | 2 +- .../supabase/setup/src/setup.ts | 2 +- .../supabase/setup/src/setupHandler.ts | 2 +- .../web/src/__tests__/supabase.test.tsx | 6 +++--- .../supabase/web/src/supabase.ts | 3 ++- .../supertokens/api/src/decoder.ts | 5 +++-- .../supertokens/setup/src/setup.ts | 2 +- .../web/src/__tests__/supertokens.test.tsx | 6 +++--- .../supertokens/web/src/supertokens.ts | 3 ++- .../auth/src/AuthProvider/AuthProvider.tsx | 11 +++++----- .../src/AuthProvider/AuthProviderState.ts | 2 +- packages/auth/src/AuthProvider/useHasRole.ts | 2 +- packages/auth/src/AuthProvider/useLogIn.ts | 8 +++----- packages/auth/src/AuthProvider/useLogOut.ts | 2 +- .../src/AuthProvider/useReauthenticate.ts | 6 +++--- packages/auth/src/AuthProvider/useSignUp.ts | 4 ++-- .../auth/src/__tests__/AuthProvider.test.tsx | 6 ++---- packages/auth/src/authFactory.ts | 5 +++-- .../src/auth/__tests__/authTasks.test.ts | 2 +- packages/cli-helpers/src/auth/authTasks.ts | 5 +++-- packages/cli-helpers/src/auth/setupHelpers.ts | 7 ++++--- packages/cli-helpers/src/lib/index.ts | 4 ++-- packages/cli-helpers/src/telemetry/index.ts | 7 ++----- .../storybook/src/commands/storybook.ts | 2 +- .../src/commands/storybookHandler.ts | 5 +++-- packages/codemods/src/codemods/list.yargs.ts | 2 +- .../renameVerifierTimestamp.ts | 2 +- .../renameVerifierTimestamp.yargs.ts | 2 +- .../v0.48.x/upgradeYarn/upgradeYarn.yargs.ts | 2 +- .../updateResolverTypes.yargs.ts | 3 ++- .../updateClerkGetCurrentUser.yargs.ts | 3 ++- .../changeGlobalToGlobalThis.yargs.ts | 3 ++- .../convertJsToJsx/convertJsToJsx.yargs.ts | 3 ++- .../processEnvDotNotation.ts | 2 +- .../processEnvDotNotation.yargs.ts | 3 ++- .../replaceComponentSvgs.yargs.ts | 3 ++- .../updateThemeConfig.yargs.ts | 3 ++- packages/codemods/src/lib/cells.ts | 8 ++++---- .../src/directives/requireAuth/requireAuth.ts | 6 ++---- .../templates/ts/web/vite.config.ts | 3 ++- .../eslint-plugin/src/process-env-computed.ts | 4 ++-- packages/fastify/src/config.ts | 2 +- packages/fastify/src/index.ts | 3 ++- packages/fastify/src/lambda/index.ts | 6 +++++- packages/fastify/src/web.ts | 2 +- packages/forms/src/FormError.tsx | 2 +- packages/forms/src/index.tsx | 3 ++- .../src/__tests__/makeDirectives.test.ts | 2 +- .../src/__tests__/makeMergedSchema.test.ts | 5 +++-- packages/graphql-server/src/cors.ts | 4 ++-- .../graphql-server/src/createGraphQLYoga.ts | 6 ++++-- .../src/directives/makeDirectives.ts | 6 +++--- .../graphql-server/src/functions/graphql.ts | 2 +- .../src/functions/useRequireAuth.ts | 6 ++++-- .../graphql-server/src/makeMergedSchema.ts | 9 ++++++--- .../__tests__/useRedwoodDirective.test.ts | 14 ++++++------- .../useRedwoodGlobalContextSetter.test.ts | 8 ++------ .../__tests__/useRedwoodLogger.test.ts | 3 ++- .../graphql-server/src/plugins/useArmor.ts | 2 +- .../src/plugins/useRedwoodAuthContext.ts | 11 ++++------ .../src/plugins/useRedwoodDirective.ts | 7 +++---- .../src/plugins/useRedwoodError.ts | 4 ++-- .../plugins/useRedwoodGlobalContextSetter.ts | 4 ++-- .../src/plugins/useRedwoodLogger.ts | 9 +++++---- .../src/plugins/useRedwoodOpenTelemetry.ts | 8 +++++--- .../src/plugins/useRedwoodPopulateContext.ts | 4 ++-- .../src/subscriptions/makeSubscriptions.ts | 2 +- packages/graphql-server/src/types.ts | 14 ++++++++----- .../validateSchemaForAuthDirectives.test.ts | 2 +- .../validateSchemaForReservedNames.test.ts | 2 +- packages/internal/src/ast.ts | 3 ++- packages/internal/src/build/babel/api.ts | 2 +- packages/internal/src/build/babel/web.ts | 2 +- ...babel-plugin-redwood-routes-auto-loader.ts | 2 +- packages/internal/src/build/web.ts | 3 ++- .../internal/src/generate/graphqlCodeGen.ts | 2 +- .../internal/src/generate/graphqlSchema.ts | 6 ++++-- .../plugins/rw-typescript-resolvers/index.ts | 5 ++--- .../rw-typescript-resolvers/visitor.ts | 8 +++----- packages/internal/src/gql.ts | 6 ++---- packages/internal/src/validateSchema.ts | 3 ++- .../webpackPlugins/ChunkReferencesPlugin.ts | 2 +- packages/prerender/src/errors.tsx | 3 ++- packages/prerender/src/graphql/graphql.ts | 3 ++- packages/prerender/src/runPrerender.tsx | 3 ++- .../src/graphql/plugins/useRedwoodRealtime.ts | 3 ++- packages/router/src/ActivePageContext.tsx | 2 +- packages/router/src/Set.tsx | 3 ++- packages/router/src/__tests__/router.test.tsx | 2 +- packages/router/src/active-route-loader.tsx | 3 ++- packages/router/src/links.tsx | 3 ++- packages/router/src/location.tsx | 3 ++- packages/router/src/route-validators.tsx | 8 +++++--- packages/router/src/routeParamsTypes.ts | 2 +- packages/router/src/router-context.tsx | 3 ++- packages/router/src/router.tsx | 17 +++++++--------- packages/router/src/util.ts | 5 +++-- packages/structure/src/ide.ts | 18 +++++++++-------- packages/structure/src/index.ts | 6 ++---- .../src/interactive_cli/command_builder.ts | 4 ++-- .../structure/src/interactive_cli/dry_run.ts | 2 +- packages/structure/src/interactive_cli/ui.ts | 2 +- .../src/language_server/RWLanguageServer.ts | 7 ++++--- .../structure/src/language_server/commands.ts | 4 ++-- .../src/language_server/diagnostics.ts | 2 +- .../structure/src/language_server/outline.ts | 2 +- .../structure/src/language_server/xmethods.ts | 2 +- packages/structure/src/model/RWComponent.ts | 2 +- packages/structure/src/model/RWEnvHelper.ts | 12 ++++++----- packages/structure/src/model/RWFunction.ts | 2 +- packages/structure/src/model/RWLayout.ts | 2 +- packages/structure/src/model/RWPage.ts | 2 +- packages/structure/src/model/RWProject.ts | 2 +- packages/structure/src/model/RWRoute.ts | 8 +++++--- packages/structure/src/model/RWRouter.ts | 10 +++++----- packages/structure/src/model/RWSDL.ts | 2 +- packages/structure/src/model/RWSDLField.ts | 14 ++++++------- packages/structure/src/model/RWService.ts | 4 ++-- .../structure/src/model/RWServiceFunction.ts | 10 ++++------ packages/structure/src/model/RWTOML.ts | 5 +++-- packages/structure/src/outline/outline.ts | 11 +++++----- .../vscode-languageserver-types-x.test.ts | 2 +- packages/structure/src/x/prisma.ts | 3 ++- .../src/x/vscode-languageserver-types.ts | 12 ++++++----- .../structure/src/x/vscode-languageserver.ts | 2 +- packages/structure/src/x/vscode.ts | 7 ++++--- .../backend/fastify/plugins/withApiProxy.ts | 5 +++-- packages/studio/backend/fastify/react.ts | 2 +- .../studio/backend/fastify/spanIngester.ts | 2 +- packages/studio/backend/fastify/yoga.ts | 4 ++-- packages/studio/backend/migrations.ts | 2 +- .../src/Charts/SpanTypeTimeSeriesBarChart.tsx | 11 ++-------- .../src/Charts/SpanTypeTimeSeriesChart.tsx | 11 ++-------- .../RedwoodGraphiQL/RedwoodGraphiQL.tsx | 20 +++++++------------ packages/testing/src/api/directive.ts | 2 +- packages/testing/src/api/scenario.ts | 2 +- packages/testing/src/web/MockRouter.tsx | 5 +++-- packages/vite/src/buildFeServer.ts | 5 +++-- packages/vite/src/buildRscFeServer.ts | 4 ++-- packages/vite/src/fully-react/rwRscGlobal.ts | 2 +- .../src/plugins/vite-plugin-jsx-loader.ts | 3 ++- packages/vite/src/runFeServer.ts | 2 +- packages/vite/src/streaming/streamHelpers.ts | 2 +- .../vite/src/streaming/triggerRouteHooks.ts | 4 ++-- .../vite/src/waku-lib/rsc-handler-worker.ts | 4 ++-- packages/web/src/apollo/index.tsx | 3 ++- packages/web/src/apollo/sseLink.tsx | 11 ++++------ packages/web/src/apollo/suspense.tsx | 5 +++-- .../web/src/components/CellCacheContext.tsx | 2 +- .../src/components/FetchConfigProvider.tsx | 3 ++- .../src/components/GraphQLHooksProvider.tsx | 2 +- packages/web/src/components/ServerInject.tsx | 3 ++- packages/web/src/components/createCell.tsx | 5 +++-- packages/web/src/graphql.ts | 2 +- packages/web/src/routeHooks.types.ts | 2 +- 203 files changed, 442 insertions(+), 413 deletions(-) diff --git a/packages/api-server/src/__tests__/withApiProxy.test.ts b/packages/api-server/src/__tests__/withApiProxy.test.ts index f0c6502d9ca4..71f6733fe3af 100644 --- a/packages/api-server/src/__tests__/withApiProxy.test.ts +++ b/packages/api-server/src/__tests__/withApiProxy.test.ts @@ -1,6 +1,6 @@ import path from 'path' -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' import withApiProxy from '../plugins/withApiProxy' diff --git a/packages/api-server/src/__tests__/withFunctions.test.ts b/packages/api-server/src/__tests__/withFunctions.test.ts index f39b7a23c1bf..3bc3e3471cc3 100644 --- a/packages/api-server/src/__tests__/withFunctions.test.ts +++ b/packages/api-server/src/__tests__/withFunctions.test.ts @@ -1,6 +1,6 @@ import path from 'path' -import { FastifyInstance, FastifyPluginCallback } from 'fastify' +import type { FastifyInstance, FastifyPluginCallback } from 'fastify' import { loadFastifyConfig } from '../fastify' import withFunctions from '../plugins/withFunctions' diff --git a/packages/api-server/src/__tests__/withWebServer.test.ts b/packages/api-server/src/__tests__/withWebServer.test.ts index 2e3958a78c1b..0fd33f395f1e 100644 --- a/packages/api-server/src/__tests__/withWebServer.test.ts +++ b/packages/api-server/src/__tests__/withWebServer.test.ts @@ -1,6 +1,6 @@ import path from 'path' -import { FastifyInstance, FastifyPluginCallback } from 'fastify' +import type { FastifyInstance, FastifyPluginCallback } from 'fastify' import { loadFastifyConfig } from '../fastify' import withWebServer from '../plugins/withWebServer' diff --git a/packages/api-server/src/cliHandlers.ts b/packages/api-server/src/cliHandlers.ts index 5c3d6cfcc7d0..8f9622718cb0 100644 --- a/packages/api-server/src/cliHandlers.ts +++ b/packages/api-server/src/cliHandlers.ts @@ -7,7 +7,7 @@ import withApiProxy from './plugins/withApiProxy' import withFunctions from './plugins/withFunctions' import withWebServer from './plugins/withWebServer' import { startServer as startFastifyServer } from './server' -import { BothServerArgs, WebServerArgs, ApiServerArgs } from './types' +import type { BothServerArgs, WebServerArgs, ApiServerArgs } from './types' /* * This file has defines CLI handlers used by the redwood cli, for `rw serve` diff --git a/packages/api-server/src/fastify.ts b/packages/api-server/src/fastify.ts index ffce1de6adf1..36c95c7147b2 100644 --- a/packages/api-server/src/fastify.ts +++ b/packages/api-server/src/fastify.ts @@ -6,7 +6,7 @@ import Fastify from 'fastify' import { getPaths, getConfig } from '@redwoodjs/project-config' -import { FastifySideConfigFn } from './types' +import type { FastifySideConfigFn } from './types' const DEFAULT_OPTIONS = { logger: { diff --git a/packages/api-server/src/plugins/lambdaLoader.ts b/packages/api-server/src/plugins/lambdaLoader.ts index 4ad4c57556bf..c345150c36b4 100644 --- a/packages/api-server/src/plugins/lambdaLoader.ts +++ b/packages/api-server/src/plugins/lambdaLoader.ts @@ -3,7 +3,11 @@ import path from 'path' import c from 'ansi-colors' import type { Handler } from 'aws-lambda' import fg from 'fast-glob' -import { FastifyReply, FastifyRequest, RequestGenericInterface } from 'fastify' +import type { + FastifyReply, + FastifyRequest, + RequestGenericInterface, +} from 'fastify' import { escape } from 'lodash' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/api-server/src/plugins/withApiProxy.ts b/packages/api-server/src/plugins/withApiProxy.ts index 5b428f316fac..9d194816dd4a 100644 --- a/packages/api-server/src/plugins/withApiProxy.ts +++ b/packages/api-server/src/plugins/withApiProxy.ts @@ -1,5 +1,6 @@ -import httpProxy, { FastifyHttpProxyOptions } from '@fastify/http-proxy' -import { FastifyInstance } from 'fastify' +import type { FastifyHttpProxyOptions } from '@fastify/http-proxy' +import httpProxy from '@fastify/http-proxy' +import type { FastifyInstance } from 'fastify' export interface ApiProxyOptions { apiUrl: string diff --git a/packages/api-server/src/plugins/withFunctions.ts b/packages/api-server/src/plugins/withFunctions.ts index d59927c71303..06ebf127009c 100644 --- a/packages/api-server/src/plugins/withFunctions.ts +++ b/packages/api-server/src/plugins/withFunctions.ts @@ -1,5 +1,5 @@ import fastifyUrlData from '@fastify/url-data' -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' import fastifyRawBody from 'fastify-raw-body' import { loadFastifyConfig } from '../fastify' diff --git a/packages/api-server/src/plugins/withWebServer.ts b/packages/api-server/src/plugins/withWebServer.ts index 2cb84304c214..f347e672c2b2 100644 --- a/packages/api-server/src/plugins/withWebServer.ts +++ b/packages/api-server/src/plugins/withWebServer.ts @@ -2,12 +2,12 @@ import fs from 'fs' import path from 'path' import fastifyStatic from '@fastify/static' -import { FastifyInstance, FastifyReply } from 'fastify' +import type { FastifyInstance, FastifyReply } from 'fastify' import { getPaths } from '@redwoodjs/project-config' import { loadFastifyConfig } from '../fastify' -import { WebServerArgs } from '../types' +import type { WebServerArgs } from '../types' import { findPrerenderedHtml } from './findPrerenderedHtml' diff --git a/packages/api-server/src/server.ts b/packages/api-server/src/server.ts index 93d84dee49a7..eda581d3d3fb 100644 --- a/packages/api-server/src/server.ts +++ b/packages/api-server/src/server.ts @@ -1,4 +1,4 @@ -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' export interface HttpServerParams { port: number diff --git a/packages/api-server/src/types.ts b/packages/api-server/src/types.ts index af56b50b4cff..9bc94215a08c 100644 --- a/packages/api-server/src/types.ts +++ b/packages/api-server/src/types.ts @@ -1,6 +1,6 @@ -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' -import { HttpServerParams } from './server' +import type { HttpServerParams } from './server' export interface WebServerArgs extends Omit { apiHost?: string diff --git a/packages/api/src/auth/__tests__/getAuthenticationContext.test.ts b/packages/api/src/auth/__tests__/getAuthenticationContext.test.ts index 3d6253168d30..727c2460415e 100644 --- a/packages/api/src/auth/__tests__/getAuthenticationContext.test.ts +++ b/packages/api/src/auth/__tests__/getAuthenticationContext.test.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyEvent, Context } from 'aws-lambda' +import type { APIGatewayProxyEvent, Context } from 'aws-lambda' import { getAuthenticationContext } from '../index' diff --git a/packages/api/src/cache/index.ts b/packages/api/src/cache/index.ts index 991d53bdd206..bc32e37cfe83 100644 --- a/packages/api/src/cache/index.ts +++ b/packages/api/src/cache/index.ts @@ -1,6 +1,6 @@ import type { Logger } from '../logger' -import BaseClient from './clients/BaseClient' +import type BaseClient from './clients/BaseClient' import { CacheTimeoutError } from './errors' export { default as MemcachedClient } from './clients/MemcachedClient' diff --git a/packages/api/src/types.ts b/packages/api/src/types.ts index e2adcc015380..3217855f3cfe 100644 --- a/packages/api/src/types.ts +++ b/packages/api/src/types.ts @@ -2,7 +2,7 @@ * Houses utility types commonly used on the api side */ -import { O, A } from 'ts-toolbelt' +import type { O, A } from 'ts-toolbelt' /** * ---- Prisma SDL Type Merge ---- diff --git a/packages/api/src/webhooks/index.ts b/packages/api/src/webhooks/index.ts index 62c232593141..341795828245 100644 --- a/packages/api/src/webhooks/index.ts +++ b/packages/api/src/webhooks/index.ts @@ -1,11 +1,10 @@ import type { APIGatewayProxyEvent } from 'aws-lambda' +import type { VerifyOptions, SupportedVerifierTypes } from '../auth/verifiers' import { createVerifier, - VerifyOptions, WebhookVerificationError, DEFAULT_WEBHOOK_SECRET, - SupportedVerifierTypes, DEFAULT_TOLERANCE, } from '../auth/verifiers' diff --git a/packages/auth-providers/auth0/api/src/decoder.ts b/packages/auth-providers/auth0/api/src/decoder.ts index e429f0869b7a..1ffb391713e5 100644 --- a/packages/auth-providers/auth0/api/src/decoder.ts +++ b/packages/auth-providers/auth0/api/src/decoder.ts @@ -1,7 +1,7 @@ import jwt from 'jsonwebtoken' import jwksClient from 'jwks-rsa' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' /** * This takes an auth0 jwt and verifies it. It returns something like this: diff --git a/packages/auth-providers/auth0/setup/src/setup.ts b/packages/auth-providers/auth0/setup/src/setup.ts index 18f94830ba18..3a7264e036ae 100644 --- a/packages/auth-providers/auth0/setup/src/setup.ts +++ b/packages/auth-providers/auth0/setup/src/setup.ts @@ -1,4 +1,4 @@ -import * as yargs from 'yargs' +import type * as yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/auth0/setup/src/setupHandler.ts b/packages/auth-providers/auth0/setup/src/setupHandler.ts index f045008d7edb..ee14a926b049 100644 --- a/packages/auth-providers/auth0/setup/src/setupHandler.ts +++ b/packages/auth-providers/auth0/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx b/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx index 845f872f24a1..d939ea483e70 100644 --- a/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx +++ b/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx @@ -6,7 +6,7 @@ import type { } from '@auth0/auth0-spa-js' import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' import { createAuth } from '../auth0' diff --git a/packages/auth-providers/auth0/web/src/auth0.ts b/packages/auth-providers/auth0/web/src/auth0.ts index 298bb9bdd7e5..54cb1a5fe787 100644 --- a/packages/auth-providers/auth0/web/src/auth0.ts +++ b/packages/auth-providers/auth0/web/src/auth0.ts @@ -4,7 +4,8 @@ import type { RedirectLoginOptions, } from '@auth0/auth0-spa-js' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' // TODO: Map out this user properly. export interface Auth0User {} diff --git a/packages/auth-providers/azureActiveDirectory/api/src/decoder.ts b/packages/auth-providers/azureActiveDirectory/api/src/decoder.ts index 9cc07ee70928..447233db4611 100644 --- a/packages/auth-providers/azureActiveDirectory/api/src/decoder.ts +++ b/packages/auth-providers/azureActiveDirectory/api/src/decoder.ts @@ -1,7 +1,7 @@ import jwt from 'jsonwebtoken' import jwksClient from 'jwks-rsa' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' export const authDecoder: Decoder = async (token: string, type: string) => { if (type !== 'azureActiveDirectory') { diff --git a/packages/auth-providers/azureActiveDirectory/setup/src/setup.ts b/packages/auth-providers/azureActiveDirectory/setup/src/setup.ts index 034399edde79..486ddde4704b 100644 --- a/packages/auth-providers/azureActiveDirectory/setup/src/setup.ts +++ b/packages/auth-providers/azureActiveDirectory/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/azureActiveDirectory/setup/src/setupHandler.ts b/packages/auth-providers/azureActiveDirectory/setup/src/setupHandler.ts index c8bdd8bb94bf..cf42349827aa 100644 --- a/packages/auth-providers/azureActiveDirectory/setup/src/setupHandler.ts +++ b/packages/auth-providers/azureActiveDirectory/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx b/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx index 9e022aae5015..f34c4103bcd1 100644 --- a/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx +++ b/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx @@ -5,7 +5,7 @@ import type { } from '@azure/msal-browser' import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' import { createAuth } from '../azureActiveDirectory' diff --git a/packages/auth-providers/azureActiveDirectory/web/src/azureActiveDirectory.ts b/packages/auth-providers/azureActiveDirectory/web/src/azureActiveDirectory.ts index 966b7f232b88..bbf37be373aa 100644 --- a/packages/auth-providers/azureActiveDirectory/web/src/azureActiveDirectory.ts +++ b/packages/auth-providers/azureActiveDirectory/web/src/azureActiveDirectory.ts @@ -1,12 +1,13 @@ -import { +import type { EndSessionRequest, PublicClientApplication as AzureActiveDirectoryClient, RedirectRequest, SilentRequest, - InteractionRequiredAuthError, } from '@azure/msal-browser' +import { InteractionRequiredAuthError } from '@azure/msal-browser' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' export function createAuth( azureActiveDirectoryClient: AzureActiveDirectoryClient, diff --git a/packages/auth-providers/clerk/api/src/decoder.ts b/packages/auth-providers/clerk/api/src/decoder.ts index 49830232bda6..28f2c5dab15e 100644 --- a/packages/auth-providers/clerk/api/src/decoder.ts +++ b/packages/auth-providers/clerk/api/src/decoder.ts @@ -1,4 +1,4 @@ -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' /** * @deprecated This function will be removed; it uses a rate-limited API. Use `clerkAuthDecoder` instead. diff --git a/packages/auth-providers/clerk/setup/src/setup.ts b/packages/auth-providers/clerk/setup/src/setup.ts index b79ca7144c7d..59374fb7b262 100644 --- a/packages/auth-providers/clerk/setup/src/setup.ts +++ b/packages/auth-providers/clerk/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/clerk/setup/src/setupHandler.ts b/packages/auth-providers/clerk/setup/src/setupHandler.ts index f08d9c1406b4..934ff986174c 100644 --- a/packages/auth-providers/clerk/setup/src/setupHandler.ts +++ b/packages/auth-providers/clerk/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx b/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx index 2661955635c1..93d6faccbabf 100644 --- a/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx +++ b/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx @@ -1,4 +1,4 @@ -import { +import type { Clerk as ClerkClient, UserResource, EmailAddressResource, @@ -6,7 +6,7 @@ import { } from '@clerk/types' import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' import { createAuth } from '../clerk' diff --git a/packages/auth-providers/clerk/web/src/clerk.tsx b/packages/auth-providers/clerk/web/src/clerk.tsx index 6ec0910ee9aa..f23ac13718d7 100644 --- a/packages/auth-providers/clerk/web/src/clerk.tsx +++ b/packages/auth-providers/clerk/web/src/clerk.tsx @@ -1,4 +1,4 @@ -import { +import type { SignInProps, SignUpProps, SignOutCallback, @@ -7,7 +7,8 @@ import { SignOutOptions, } from '@clerk/types' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' type Clerk = ClerkClient | undefined | null diff --git a/packages/auth-providers/custom/setup/src/setup.ts b/packages/auth-providers/custom/setup/src/setup.ts index 215a91c2bbd9..6bc496a8388f 100644 --- a/packages/auth-providers/custom/setup/src/setup.ts +++ b/packages/auth-providers/custom/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/custom/setup/src/setupHandler.ts b/packages/auth-providers/custom/setup/src/setupHandler.ts index 6c14308e4e1c..a055e0924662 100644 --- a/packages/auth-providers/custom/setup/src/setupHandler.ts +++ b/packages/auth-providers/custom/setup/src/setupHandler.ts @@ -6,7 +6,7 @@ import { standardAuthHandler, } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts b/packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts index d88f62888725..097f57d7b21d 100644 --- a/packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts +++ b/packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts @@ -17,13 +17,8 @@ import CryptoJS from 'crypto-js' import md5 from 'md5' import { v4 as uuidv4 } from 'uuid' -import { - CorsConfig, - CorsContext, - CorsHeaders, - createCorsContext, - normalizeRequest, -} from '@redwoodjs/api' +import type { CorsConfig, CorsContext, CorsHeaders } from '@redwoodjs/api' +import { createCorsContext, normalizeRequest } from '@redwoodjs/api' import * as DbAuthError from './errors' import { diff --git a/packages/auth-providers/dbAuth/api/src/decoder.ts b/packages/auth-providers/dbAuth/api/src/decoder.ts index 5a637d28428a..b1ea41d55afd 100644 --- a/packages/auth-providers/dbAuth/api/src/decoder.ts +++ b/packages/auth-providers/dbAuth/api/src/decoder.ts @@ -1,6 +1,6 @@ import type { APIGatewayProxyEvent } from 'aws-lambda' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' import { dbAuthSession } from './shared' diff --git a/packages/auth-providers/dbAuth/setup/src/setup.ts b/packages/auth-providers/dbAuth/setup/src/setup.ts index 1cfe3c7fa31c..b43454f10436 100644 --- a/packages/auth-providers/dbAuth/setup/src/setup.ts +++ b/packages/auth-providers/dbAuth/setup/src/setup.ts @@ -1,5 +1,5 @@ import terminalLink from 'terminal-link' -import yargs from 'yargs' +import type yargs from 'yargs' export const command = 'dbAuth' export const description = 'Set up auth for for dbAuth' diff --git a/packages/auth-providers/dbAuth/setup/src/setupHandler.ts b/packages/auth-providers/dbAuth/setup/src/setupHandler.ts index a82226b32b82..4c6ea5d81540 100644 --- a/packages/auth-providers/dbAuth/setup/src/setupHandler.ts +++ b/packages/auth-providers/dbAuth/setup/src/setupHandler.ts @@ -5,7 +5,7 @@ import prompts from 'prompts' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' import { notes, extraTask } from './setupData' import { notes as webAuthnNotes, diff --git a/packages/auth-providers/dbAuth/web/src/__tests__/dbAuth.test.ts b/packages/auth-providers/dbAuth/web/src/__tests__/dbAuth.test.ts index 9cb039ec243e..f6aa2f01b350 100644 --- a/packages/auth-providers/dbAuth/web/src/__tests__/dbAuth.test.ts +++ b/packages/auth-providers/dbAuth/web/src/__tests__/dbAuth.test.ts @@ -1,8 +1,9 @@ import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' -import { createDbAuthClient, DbAuthClientArgs, createAuth } from '../dbAuth' +import type { DbAuthClientArgs } from '../dbAuth' +import { createDbAuthClient, createAuth } from '../dbAuth' globalThis.RWJS_API_URL = '/.redwood/functions' globalThis.RWJS_API_GRAPHQL_URL = '/.redwood/functions/graphql' diff --git a/packages/auth-providers/dbAuth/web/src/dbAuth.ts b/packages/auth-providers/dbAuth/web/src/dbAuth.ts index dcf3ef9ee3b2..b0fae72a2554 100644 --- a/packages/auth-providers/dbAuth/web/src/dbAuth.ts +++ b/packages/auth-providers/dbAuth/web/src/dbAuth.ts @@ -1,6 +1,7 @@ -import { createAuthentication, CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' -import { WebAuthnClientType } from './webAuthn' +import type { WebAuthnClientType } from './webAuthn' export interface LoginAttributes { username: string diff --git a/packages/auth-providers/firebase/api/src/decoder.ts b/packages/auth-providers/firebase/api/src/decoder.ts index 0758e75143bb..57a0001040c5 100644 --- a/packages/auth-providers/firebase/api/src/decoder.ts +++ b/packages/auth-providers/firebase/api/src/decoder.ts @@ -1,7 +1,7 @@ import admin from 'firebase-admin' import type { FirebaseError } from 'firebase-admin' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' // Alternative third-party JWT verification process described here: // https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library diff --git a/packages/auth-providers/firebase/setup/src/setup.ts b/packages/auth-providers/firebase/setup/src/setup.ts index a9a8f2dfd51e..c07768f6e1cc 100644 --- a/packages/auth-providers/firebase/setup/src/setup.ts +++ b/packages/auth-providers/firebase/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/firebase/setup/src/setupHandler.ts b/packages/auth-providers/firebase/setup/src/setupHandler.ts index 1ffdf95bbe1b..e63cb42c1743 100644 --- a/packages/auth-providers/firebase/setup/src/setupHandler.ts +++ b/packages/auth-providers/firebase/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx b/packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx index 69dc1478f21b..b1e9d4ed0a9a 100644 --- a/packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx +++ b/packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx @@ -1,10 +1,12 @@ import { renderHook, act } from '@testing-library/react' import type FirebaseAuthNamespace from 'firebase/auth' -import { User, OperationType, OAuthProvider, Auth } from 'firebase/auth' +import type { User, OAuthProvider, Auth } from 'firebase/auth' +import { OperationType } from 'firebase/auth' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth, FirebaseClient } from '../firebase' +import type { FirebaseClient } from '../firebase' +import { createAuth } from '../firebase' const user: User = { uid: 'unique_user_id', diff --git a/packages/auth-providers/firebase/web/src/firebase.ts b/packages/auth-providers/firebase/web/src/firebase.ts index dc498f8001ed..9081c523a9d5 100644 --- a/packages/auth-providers/firebase/web/src/firebase.ts +++ b/packages/auth-providers/firebase/web/src/firebase.ts @@ -2,7 +2,8 @@ import type { FirebaseApp } from 'firebase/app' import type { CustomParameters, OAuthProvider, User } from 'firebase/auth' import type FirebaseAuthNamespace from 'firebase/auth' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' type FirebaseAuth = typeof FirebaseAuthNamespace diff --git a/packages/auth-providers/netlify/api/src/decoder.ts b/packages/auth-providers/netlify/api/src/decoder.ts index 9a0ef516a22c..58dbf4d21226 100644 --- a/packages/auth-providers/netlify/api/src/decoder.ts +++ b/packages/auth-providers/netlify/api/src/decoder.ts @@ -1,7 +1,7 @@ import type { Context as LambdaContext, ClientContext } from 'aws-lambda' import jwt, { TokenExpiredError } from 'jsonwebtoken' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' type NetlifyContext = ClientContext & { user?: Record diff --git a/packages/auth-providers/netlify/setup/src/setup.ts b/packages/auth-providers/netlify/setup/src/setup.ts index afb76d424896..957268923b51 100644 --- a/packages/auth-providers/netlify/setup/src/setup.ts +++ b/packages/auth-providers/netlify/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/netlify/setup/src/setupHandler.ts b/packages/auth-providers/netlify/setup/src/setupHandler.ts index 34cfa489c52f..b857fd093cd2 100644 --- a/packages/auth-providers/netlify/setup/src/setupHandler.ts +++ b/packages/auth-providers/netlify/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx b/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx index c71507a3bed3..f6d3feeb905b 100644 --- a/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx +++ b/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx @@ -1,7 +1,7 @@ import { renderHook, act } from '@testing-library/react' -import * as NetlifyIdentityNS from 'netlify-identity-widget' +import type * as NetlifyIdentityNS from 'netlify-identity-widget' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' import { createAuth } from '../netlify' diff --git a/packages/auth-providers/netlify/web/src/netlify.ts b/packages/auth-providers/netlify/web/src/netlify.ts index 3a0bde9bead1..580b758e5334 100644 --- a/packages/auth-providers/netlify/web/src/netlify.ts +++ b/packages/auth-providers/netlify/web/src/netlify.ts @@ -1,6 +1,7 @@ -import * as NetlifyIdentityNS from 'netlify-identity-widget' +import type * as NetlifyIdentityNS from 'netlify-identity-widget' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' // TODO: // In the future, when this is a separate package, we can import the full thing diff --git a/packages/auth-providers/supabase/api/src/decoder.ts b/packages/auth-providers/supabase/api/src/decoder.ts index 3c965d4d88ad..4c71dca75df4 100644 --- a/packages/auth-providers/supabase/api/src/decoder.ts +++ b/packages/auth-providers/supabase/api/src/decoder.ts @@ -1,6 +1,6 @@ import jwt from 'jsonwebtoken' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' export const authDecoder: Decoder = async (token: string, type: string) => { if (type !== 'supabase') { diff --git a/packages/auth-providers/supabase/setup/src/setup.ts b/packages/auth-providers/supabase/setup/src/setup.ts index 10a8cdf1fb56..e6a2c22637b0 100644 --- a/packages/auth-providers/supabase/setup/src/setup.ts +++ b/packages/auth-providers/supabase/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/supabase/setup/src/setupHandler.ts b/packages/auth-providers/supabase/setup/src/setupHandler.ts index 16430493850d..62742188aa07 100644 --- a/packages/auth-providers/supabase/setup/src/setupHandler.ts +++ b/packages/auth-providers/supabase/setup/src/setupHandler.ts @@ -3,7 +3,7 @@ import path from 'path' import { standardAuthHandler } from '@redwoodjs/cli-helpers' -import { Args } from './setup' +import type { Args } from './setup' const { version } = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8') diff --git a/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx b/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx index d45ff78107f9..a9d79a252cd7 100644 --- a/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx +++ b/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx @@ -1,4 +1,4 @@ -import { +import type { SupabaseClient, User, AuthResponse, @@ -11,11 +11,11 @@ import { SignInWithPasswordCredentials, SignUpWithPasswordCredentials, Session, - AuthError, } from '@supabase/supabase-js' +import { AuthError } from '@supabase/supabase-js' import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' import { createAuth } from '../supabase' diff --git a/packages/auth-providers/supabase/web/src/supabase.ts b/packages/auth-providers/supabase/web/src/supabase.ts index c4abbdf3b5e9..8d4406124b06 100644 --- a/packages/auth-providers/supabase/web/src/supabase.ts +++ b/packages/auth-providers/supabase/web/src/supabase.ts @@ -12,7 +12,8 @@ import type { } from '@supabase/supabase-js' import { AuthError } from '@supabase/supabase-js' -import { CurrentUser, createAuthentication } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' export type SignInWithOAuthOptions = SignInWithOAuthCredentials & { authMethod: 'oauth' diff --git a/packages/auth-providers/supertokens/api/src/decoder.ts b/packages/auth-providers/supertokens/api/src/decoder.ts index 44f53bfe4274..400f81b9f7bb 100644 --- a/packages/auth-providers/supertokens/api/src/decoder.ts +++ b/packages/auth-providers/supertokens/api/src/decoder.ts @@ -1,7 +1,8 @@ import jwt from 'jsonwebtoken' -import jwksClient, { SigningKey } from 'jwks-rsa' +import type { SigningKey } from 'jwks-rsa' +import jwksClient from 'jwks-rsa' -import { Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' export const authDecoder: Decoder = async (token: string, type: string) => { if (type !== 'supertokens') { diff --git a/packages/auth-providers/supertokens/setup/src/setup.ts b/packages/auth-providers/supertokens/setup/src/setup.ts index 75ec9eeb9b31..49004f55aa0d 100644 --- a/packages/auth-providers/supertokens/setup/src/setup.ts +++ b/packages/auth-providers/supertokens/setup/src/setup.ts @@ -1,4 +1,4 @@ -import yargs from 'yargs' +import type yargs from 'yargs' import { standardAuthBuilder } from '@redwoodjs/cli-helpers' diff --git a/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx b/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx index a8f4de0da8bb..a740b41134e9 100644 --- a/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx +++ b/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx @@ -1,13 +1,13 @@ import { renderHook, act } from '@testing-library/react' -import { CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' -import { - createAuth, +import type { SuperTokensUser, SessionRecipe, SuperTokensAuth, } from '../supertokens' +import { createAuth } from '../supertokens' const user: SuperTokensUser = { userId: 'unique_user_id', diff --git a/packages/auth-providers/supertokens/web/src/supertokens.ts b/packages/auth-providers/supertokens/web/src/supertokens.ts index 674c821eddec..e20c1e7904ff 100644 --- a/packages/auth-providers/supertokens/web/src/supertokens.ts +++ b/packages/auth-providers/supertokens/web/src/supertokens.ts @@ -1,6 +1,7 @@ import type SuperTokens from 'supertokens-auth-react' -import { createAuthentication, CurrentUser } from '@redwoodjs/auth' +import type { CurrentUser } from '@redwoodjs/auth' +import { createAuthentication } from '@redwoodjs/auth' export interface SuperTokensUser { userId: string diff --git a/packages/auth/src/AuthProvider/AuthProvider.tsx b/packages/auth/src/AuthProvider/AuthProvider.tsx index 08fce5bddfce..b4a5d9a20d29 100644 --- a/packages/auth/src/AuthProvider/AuthProvider.tsx +++ b/packages/auth/src/AuthProvider/AuthProvider.tsx @@ -1,12 +1,11 @@ -import React, { ReactNode, useEffect, useState } from 'react' +import type { ReactNode } from 'react' +import React, { useEffect, useState } from 'react' -import { AuthContextInterface, CurrentUser } from '../AuthContext' +import type { AuthContextInterface, CurrentUser } from '../AuthContext' import type { AuthImplementation } from '../AuthImplementation' -import { - AuthProviderState, - defaultAuthProviderState, -} from './AuthProviderState' +import type { AuthProviderState } from './AuthProviderState' +import { defaultAuthProviderState } from './AuthProviderState' import { useCurrentUser } from './useCurrentUser' import { useForgotPassword } from './useForgotPassword' import { useHasRole } from './useHasRole' diff --git a/packages/auth/src/AuthProvider/AuthProviderState.ts b/packages/auth/src/AuthProvider/AuthProviderState.ts index c8ab8fd0d0ad..f9dbe07c02ff 100644 --- a/packages/auth/src/AuthProvider/AuthProviderState.ts +++ b/packages/auth/src/AuthProvider/AuthProviderState.ts @@ -1,4 +1,4 @@ -import { CurrentUser } from '../AuthContext' +import type { CurrentUser } from '../AuthContext' export type AuthProviderState = { loading: boolean diff --git a/packages/auth/src/AuthProvider/useHasRole.ts b/packages/auth/src/AuthProvider/useHasRole.ts index b78a90a472ed..bda4cbe0e3c3 100644 --- a/packages/auth/src/AuthProvider/useHasRole.ts +++ b/packages/auth/src/AuthProvider/useHasRole.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import { CurrentUser } from '../AuthContext' +import type { CurrentUser } from '../AuthContext' export const useHasRole = (currentUser: CurrentUser | null) => { /** diff --git a/packages/auth/src/AuthProvider/useLogIn.ts b/packages/auth/src/AuthProvider/useLogIn.ts index bab4eabb48b9..5ffbafb84442 100644 --- a/packages/auth/src/AuthProvider/useLogIn.ts +++ b/packages/auth/src/AuthProvider/useLogIn.ts @@ -2,11 +2,9 @@ import { useCallback } from 'react' import type { AuthImplementation } from '../AuthImplementation' -import { - AuthProviderState, - defaultAuthProviderState, -} from './AuthProviderState' -import { useCurrentUser } from './useCurrentUser' +import type { AuthProviderState } from './AuthProviderState' +import { defaultAuthProviderState } from './AuthProviderState' +import type { useCurrentUser } from './useCurrentUser' import { useReauthenticate } from './useReauthenticate' export const useLogIn = < diff --git a/packages/auth/src/AuthProvider/useLogOut.ts b/packages/auth/src/AuthProvider/useLogOut.ts index d2d71000e1d4..e11bb41ffa42 100644 --- a/packages/auth/src/AuthProvider/useLogOut.ts +++ b/packages/auth/src/AuthProvider/useLogOut.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react' import type { AuthImplementation } from '../AuthImplementation' -import { AuthProviderState } from './AuthProviderState' +import type { AuthProviderState } from './AuthProviderState' export const useLogOut = < TUser, diff --git a/packages/auth/src/AuthProvider/useReauthenticate.ts b/packages/auth/src/AuthProvider/useReauthenticate.ts index 7b3371e27c4b..ffca5fe63384 100644 --- a/packages/auth/src/AuthProvider/useReauthenticate.ts +++ b/packages/auth/src/AuthProvider/useReauthenticate.ts @@ -1,9 +1,9 @@ import { useCallback } from 'react' -import { AuthImplementation } from '../AuthImplementation' +import type { AuthImplementation } from '../AuthImplementation' -import { AuthProviderState } from './AuthProviderState' -import { useCurrentUser } from './useCurrentUser' +import type { AuthProviderState } from './AuthProviderState' +import type { useCurrentUser } from './useCurrentUser' import { useToken } from './useToken' const notAuthenticatedState = { diff --git a/packages/auth/src/AuthProvider/useSignUp.ts b/packages/auth/src/AuthProvider/useSignUp.ts index bc5bfd04512a..e1d729e3a090 100644 --- a/packages/auth/src/AuthProvider/useSignUp.ts +++ b/packages/auth/src/AuthProvider/useSignUp.ts @@ -2,8 +2,8 @@ import { useCallback } from 'react' import type { AuthImplementation } from '../AuthImplementation' -import { AuthProviderState } from './AuthProviderState' -import { useCurrentUser } from './useCurrentUser' +import type { AuthProviderState } from './AuthProviderState' +import type { useCurrentUser } from './useCurrentUser' import { useReauthenticate } from './useReauthenticate' export const useSignUp = < diff --git a/packages/auth/src/__tests__/AuthProvider.test.tsx b/packages/auth/src/__tests__/AuthProvider.test.tsx index 24eadacd6ea7..2bd325f615f0 100644 --- a/packages/auth/src/__tests__/AuthProvider.test.tsx +++ b/packages/auth/src/__tests__/AuthProvider.test.tsx @@ -14,10 +14,8 @@ import '@testing-library/jest-dom/extend-expect' import { graphql } from 'msw' import { setupServer } from 'msw/node' -import { - CustomTestAuthClient, - createCustomTestAuth, -} from './fixtures/customTestAuth' +import type { CustomTestAuthClient } from './fixtures/customTestAuth' +import { createCustomTestAuth } from './fixtures/customTestAuth' configure({ asyncUtilTimeout: 5_000, diff --git a/packages/auth/src/authFactory.ts b/packages/auth/src/authFactory.ts index b10b79891133..256ce56ae8ef 100644 --- a/packages/auth/src/authFactory.ts +++ b/packages/auth/src/authFactory.ts @@ -1,5 +1,6 @@ -import { createAuthContext, CurrentUser } from './AuthContext' -import { AuthImplementation } from './AuthImplementation' +import type { CurrentUser } from './AuthContext' +import { createAuthContext } from './AuthContext' +import type { AuthImplementation } from './AuthImplementation' import { createAuthProvider } from './AuthProvider/AuthProvider' import { createUseAuth } from './useAuth' diff --git a/packages/cli-helpers/src/auth/__tests__/authTasks.test.ts b/packages/cli-helpers/src/auth/__tests__/authTasks.test.ts index d7114aebcbc9..70f6b77603e8 100644 --- a/packages/cli-helpers/src/auth/__tests__/authTasks.test.ts +++ b/packages/cli-helpers/src/auth/__tests__/authTasks.test.ts @@ -67,12 +67,12 @@ import fs from 'fs' import path from 'path' import { getPaths } from '../../lib/paths' +import type { AuthGeneratorCtx } from '../authTasks' import { addApiConfig, addConfigToWebApp, addConfigToRoutes, createWebAuth, - AuthGeneratorCtx, hasAuthProvider, removeAuthProvider, } from '../authTasks' diff --git a/packages/cli-helpers/src/auth/authTasks.ts b/packages/cli-helpers/src/auth/authTasks.ts index d1b886c7636d..69d19239cb73 100644 --- a/packages/cli-helpers/src/auth/authTasks.ts +++ b/packages/cli-helpers/src/auth/authTasks.ts @@ -1,11 +1,12 @@ import fs from 'fs' import path from 'path' -import { ListrRenderer, ListrTask, ListrTaskWrapper } from 'listr2' +import type { ListrRenderer, ListrTask, ListrTaskWrapper } from 'listr2' import { resolveFile } from '@redwoodjs/project-config' -import { ExistingFiles, transformTSToJS, writeFilesTask } from '../lib' +import type { ExistingFiles } from '../lib' +import { transformTSToJS, writeFilesTask } from '../lib' import { colors } from '../lib/colors' import { getPaths } from '../lib/paths' import { diff --git a/packages/cli-helpers/src/auth/setupHelpers.ts b/packages/cli-helpers/src/auth/setupHelpers.ts index 67d477b9350e..d3025e2f6ac6 100644 --- a/packages/cli-helpers/src/auth/setupHelpers.ts +++ b/packages/cli-helpers/src/auth/setupHelpers.ts @@ -1,6 +1,7 @@ -import { Listr, ListrTask } from 'listr2' +import type { ListrTask } from 'listr2' +import { Listr } from 'listr2' import terminalLink from 'terminal-link' -import yargs from 'yargs' +import type yargs from 'yargs' import { errorTelemetry } from '@redwoodjs/telemetry' @@ -11,11 +12,11 @@ import { installPackages, } from '../lib/installHelpers' +import type { AuthGeneratorCtx } from './authTasks' import { addAuthConfigToGqlApi, addConfigToRoutes, addConfigToWebApp, - AuthGeneratorCtx, setAuthSetupMode, createWebAuth, generateAuthApiFiles, diff --git a/packages/cli-helpers/src/lib/index.ts b/packages/cli-helpers/src/lib/index.ts index 1107b3d59e7b..30861f18062c 100644 --- a/packages/cli-helpers/src/lib/index.ts +++ b/packages/cli-helpers/src/lib/index.ts @@ -2,12 +2,12 @@ import fs from 'fs' import path from 'path' import * as babel from '@babel/core' -import { - Listr, +import type { ListrTaskWrapper, ListrRenderer, ListrGetRendererClassFromValue, } from 'listr2' +import { Listr } from 'listr2' import { format } from 'prettier' import { colors } from './colors' diff --git a/packages/cli-helpers/src/telemetry/index.ts b/packages/cli-helpers/src/telemetry/index.ts index 71aa520763f5..6e32cd251887 100644 --- a/packages/cli-helpers/src/telemetry/index.ts +++ b/packages/cli-helpers/src/telemetry/index.ts @@ -1,8 +1,5 @@ -import opentelemetry, { - SpanStatusCode, - AttributeValue, - Span, -} from '@opentelemetry/api' +import type { AttributeValue, Span } from '@opentelemetry/api' +import opentelemetry, { SpanStatusCode } from '@opentelemetry/api' type TelemetryAttributes = { [key: string]: AttributeValue diff --git a/packages/cli-packages/storybook/src/commands/storybook.ts b/packages/cli-packages/storybook/src/commands/storybook.ts index 1c8afb22582b..50a6285ccb68 100644 --- a/packages/cli-packages/storybook/src/commands/storybook.ts +++ b/packages/cli-packages/storybook/src/commands/storybook.ts @@ -3,7 +3,7 @@ import type { Argv } from 'yargs' import { recordTelemetryAttributes } from '@redwoodjs/cli-helpers' -import { StorybookYargsOptions } from '../types' +import type { StorybookYargsOptions } from '../types' export const command = 'storybook' export const aliases = ['sb'] diff --git a/packages/cli-packages/storybook/src/commands/storybookHandler.ts b/packages/cli-packages/storybook/src/commands/storybookHandler.ts index 9287aaf0fdff..f815bde114fd 100644 --- a/packages/cli-packages/storybook/src/commands/storybookHandler.ts +++ b/packages/cli-packages/storybook/src/commands/storybookHandler.ts @@ -1,7 +1,8 @@ import fs from 'node:fs' import path from 'node:path' -import execa, { ExecaError } from 'execa' +import type { ExecaError } from 'execa' +import execa from 'execa' import { getPaths } from '@redwoodjs/project-config' // Allow import of untyped package @@ -10,7 +11,7 @@ import { getPaths } from '@redwoodjs/project-config' import { errorTelemetry } from '@redwoodjs/telemetry' import c from '../lib/colors' -import { StorybookYargsOptions } from '../types' +import type { StorybookYargsOptions } from '../types' export async function handler({ build, diff --git a/packages/codemods/src/codemods/list.yargs.ts b/packages/codemods/src/codemods/list.yargs.ts index 744c68e27f68..b59280493260 100644 --- a/packages/codemods/src/codemods/list.yargs.ts +++ b/packages/codemods/src/codemods/list.yargs.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' -import yargs from 'yargs' +import type yargs from 'yargs' import { decamelize } from 'yargs-parser' export const command = 'list ' diff --git a/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.ts b/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.ts index ce58642a5402..c234d68ec43c 100644 --- a/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.ts +++ b/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.ts @@ -1,5 +1,5 @@ import type { FileInfo, API, Identifier, ASTNode, ASTPath } from 'jscodeshift' -import core from 'jscodeshift' +import type core from 'jscodeshift' function renameTimestamp( j: core.JSCodeshift, diff --git a/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.yargs.ts b/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.yargs.ts index 823850f62853..aac582d1ccab 100644 --- a/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.yargs.ts +++ b/packages/codemods/src/codemods/v0.48.x/renameVerifierTimestamp/renameVerifierTimestamp.yargs.ts @@ -2,7 +2,7 @@ import path from 'path' import fg from 'fast-glob' import task from 'tasuku' -import { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v0.48.x/upgradeYarn/upgradeYarn.yargs.ts b/packages/codemods/src/codemods/v0.48.x/upgradeYarn/upgradeYarn.yargs.ts index ff18bcd68532..23e8d538f10e 100644 --- a/packages/codemods/src/codemods/v0.48.x/upgradeYarn/upgradeYarn.yargs.ts +++ b/packages/codemods/src/codemods/v0.48.x/upgradeYarn/upgradeYarn.yargs.ts @@ -1,5 +1,5 @@ import task from 'tasuku' -import { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' import upgradeYarn from './upgradeYarn' diff --git a/packages/codemods/src/codemods/v2.x.x/updateResolverTypes/updateResolverTypes.yargs.ts b/packages/codemods/src/codemods/v2.x.x/updateResolverTypes/updateResolverTypes.yargs.ts index 901f2bd1132c..c09bad1c8caf 100644 --- a/packages/codemods/src/codemods/v2.x.x/updateResolverTypes/updateResolverTypes.yargs.ts +++ b/packages/codemods/src/codemods/v2.x.x/updateResolverTypes/updateResolverTypes.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.ts b/packages/codemods/src/codemods/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.ts index 4643dd49c1c1..196701c20e2b 100644 --- a/packages/codemods/src/codemods/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.ts +++ b/packages/codemods/src/codemods/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.ts @@ -1,6 +1,7 @@ import path from 'path' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.yargs.ts b/packages/codemods/src/codemods/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.yargs.ts index 6f78fe5fb384..0f8598046018 100644 --- a/packages/codemods/src/codemods/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.yargs.ts +++ b/packages/codemods/src/codemods/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v6.x.x/convertJsToJsx/convertJsToJsx.yargs.ts b/packages/codemods/src/codemods/v6.x.x/convertJsToJsx/convertJsToJsx.yargs.ts index 8bc599d6518a..0621e4e41c93 100644 --- a/packages/codemods/src/codemods/v6.x.x/convertJsToJsx/convertJsToJsx.yargs.ts +++ b/packages/codemods/src/codemods/v6.x.x/convertJsToJsx/convertJsToJsx.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import runTransform from '../../../lib/runTransform' diff --git a/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.ts b/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.ts index f9973bccd56a..cdc4737ebe60 100644 --- a/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.ts +++ b/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.ts @@ -1,4 +1,4 @@ -import { FileInfo, API } from 'jscodeshift' +import type { FileInfo, API } from 'jscodeshift' export default function transform(file: FileInfo, api: API) { const j = api.jscodeshift diff --git a/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.yargs.ts b/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.yargs.ts index e96c63111a5c..71450d7f8eb0 100644 --- a/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.yargs.ts +++ b/packages/codemods/src/codemods/v6.x.x/processEnvDotNotation/processEnvDotNotation.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.yargs.ts b/packages/codemods/src/codemods/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.yargs.ts index 2c2624d3b603..e68bb9852624 100644 --- a/packages/codemods/src/codemods/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.yargs.ts +++ b/packages/codemods/src/codemods/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/codemods/v6.x.x/updateThemeConfig/updateThemeConfig.yargs.ts b/packages/codemods/src/codemods/v6.x.x/updateThemeConfig/updateThemeConfig.yargs.ts index 468c3e5b817a..a8bc7f76777e 100644 --- a/packages/codemods/src/codemods/v6.x.x/updateThemeConfig/updateThemeConfig.yargs.ts +++ b/packages/codemods/src/codemods/v6.x.x/updateThemeConfig/updateThemeConfig.yargs.ts @@ -1,7 +1,8 @@ import path from 'path' import fg from 'fast-glob' -import task, { TaskInnerAPI } from 'tasuku' +import type { TaskInnerAPI } from 'tasuku' +import task from 'tasuku' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/codemods/src/lib/cells.ts b/packages/codemods/src/lib/cells.ts index 54e69bf0357c..6b261601b8d8 100644 --- a/packages/codemods/src/lib/cells.ts +++ b/packages/codemods/src/lib/cells.ts @@ -2,18 +2,18 @@ import fs from 'fs' import path from 'path' import { types } from '@babel/core' -import { parse as babelParse, ParserPlugin } from '@babel/parser' +import type { ParserPlugin } from '@babel/parser' +import { parse as babelParse } from '@babel/parser' import traverse from '@babel/traverse' import fg from 'fast-glob' -import { +import type { DocumentNode, FieldNode, InlineFragmentNode, OperationDefinitionNode, OperationTypeNode, - parse, - visit, } from 'graphql' +import { parse, visit } from 'graphql' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/create-redwood-app/templates/ts/api/src/directives/requireAuth/requireAuth.ts b/packages/create-redwood-app/templates/ts/api/src/directives/requireAuth/requireAuth.ts index 59daccb5b79f..77b31a70ae07 100644 --- a/packages/create-redwood-app/templates/ts/api/src/directives/requireAuth/requireAuth.ts +++ b/packages/create-redwood-app/templates/ts/api/src/directives/requireAuth/requireAuth.ts @@ -1,9 +1,7 @@ import gql from 'graphql-tag' -import { - createValidatorDirective, - ValidatorDirectiveFunc, -} from '@redwoodjs/graphql-server' +import type { ValidatorDirectiveFunc } from '@redwoodjs/graphql-server' +import { createValidatorDirective } from '@redwoodjs/graphql-server' import { requireAuth as applicationRequireAuth } from 'src/lib/auth' diff --git a/packages/create-redwood-app/templates/ts/web/vite.config.ts b/packages/create-redwood-app/templates/ts/web/vite.config.ts index 9f02cb335e2a..f7885f0a1336 100644 --- a/packages/create-redwood-app/templates/ts/web/vite.config.ts +++ b/packages/create-redwood-app/templates/ts/web/vite.config.ts @@ -1,6 +1,7 @@ import dns from 'dns' -import { defineConfig, UserConfig } from 'vite' +import type { UserConfig } from 'vite' +import { defineConfig } from 'vite' // See: https://vitejs.dev/config/server-options.html#server-host // So that Vite will load on local instead of 127.0.0.1 diff --git a/packages/eslint-plugin/src/process-env-computed.ts b/packages/eslint-plugin/src/process-env-computed.ts index cff71c708c42..a979fa697967 100644 --- a/packages/eslint-plugin/src/process-env-computed.ts +++ b/packages/eslint-plugin/src/process-env-computed.ts @@ -1,5 +1,5 @@ -import { Rule } from 'eslint' -import { Identifier, MemberExpression } from 'estree' +import type { Rule } from 'eslint' +import type { Identifier, MemberExpression } from 'estree' function isProcessEnv(node: unknown) { return ( diff --git a/packages/fastify/src/config.ts b/packages/fastify/src/config.ts index 2b336adf171d..59cbfe658aef 100644 --- a/packages/fastify/src/config.ts +++ b/packages/fastify/src/config.ts @@ -5,7 +5,7 @@ import type { FastifyInstance, FastifyServerOptions } from 'fastify' import { getPaths, getConfig } from '@redwoodjs/project-config' -import { FastifySideConfigFn, FastifySideConfigFnOptions } from './types' +import type { FastifySideConfigFn, FastifySideConfigFnOptions } from './types' export const DEFAULT_REDWOOD_FASTIFY_CONFIG: FastifyServerOptions = { requestTimeout: 15_000, diff --git a/packages/fastify/src/index.ts b/packages/fastify/src/index.ts index fe92be932b3e..e95488bea13c 100644 --- a/packages/fastify/src/index.ts +++ b/packages/fastify/src/index.ts @@ -1,4 +1,5 @@ -import Fastify, { FastifyServerOptions } from 'fastify' +import type { FastifyServerOptions } from 'fastify' +import Fastify from 'fastify' import { loadFastifyConfig, DEFAULT_REDWOOD_FASTIFY_CONFIG } from './config.js' diff --git a/packages/fastify/src/lambda/index.ts b/packages/fastify/src/lambda/index.ts index 47ebeedf91b5..1a02b6448ea2 100644 --- a/packages/fastify/src/lambda/index.ts +++ b/packages/fastify/src/lambda/index.ts @@ -7,7 +7,11 @@ import type { Handler, } from 'aws-lambda' import fg from 'fast-glob' -import { FastifyReply, FastifyRequest, RequestGenericInterface } from 'fastify' +import type { + FastifyReply, + FastifyRequest, + RequestGenericInterface, +} from 'fastify' import { escape } from 'lodash' import qs from 'qs' diff --git a/packages/fastify/src/web.ts b/packages/fastify/src/web.ts index d295830c4756..46116ab4754a 100644 --- a/packages/fastify/src/web.ts +++ b/packages/fastify/src/web.ts @@ -12,7 +12,7 @@ import type { import { getPaths } from '@redwoodjs/project-config' import { loadFastifyConfig } from './config' -import { RedwoodFastifyWebOptions } from './types' +import type { RedwoodFastifyWebOptions } from './types' export async function redwoodFastifyWeb( fastify: FastifyInstance, diff --git a/packages/forms/src/FormError.tsx b/packages/forms/src/FormError.tsx index bcdbf7fbdb9b..1d9f79760050 100644 --- a/packages/forms/src/FormError.tsx +++ b/packages/forms/src/FormError.tsx @@ -1,4 +1,4 @@ -import { GraphQLError } from 'graphql' +import type { GraphQLError } from 'graphql' export interface ServerParseError extends Error { response: Response diff --git a/packages/forms/src/index.tsx b/packages/forms/src/index.tsx index 4a14e9ffdd53..9aabb01a3dd5 100644 --- a/packages/forms/src/index.tsx +++ b/packages/forms/src/index.tsx @@ -45,7 +45,8 @@ * * @see {@link https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces} */ -import React, { useContext, forwardRef, ForwardedRef } from 'react' +import type { ForwardedRef } from 'react' +import React, { useContext, forwardRef } from 'react' import pascalcase from 'pascalcase' import { get, useForm, FormProvider, useFormContext } from 'react-hook-form' diff --git a/packages/graphql-server/src/__tests__/makeDirectives.test.ts b/packages/graphql-server/src/__tests__/makeDirectives.test.ts index e4a0af0a14eb..8abe864a693b 100644 --- a/packages/graphql-server/src/__tests__/makeDirectives.test.ts +++ b/packages/graphql-server/src/__tests__/makeDirectives.test.ts @@ -1,6 +1,6 @@ import gql from 'graphql-tag' -import { DirectiveParams } from '..' +import type { DirectiveParams } from '..' import { makeDirectivesForPlugin, createTransformerDirective, diff --git a/packages/graphql-server/src/__tests__/makeMergedSchema.test.ts b/packages/graphql-server/src/__tests__/makeMergedSchema.test.ts index 0e0be5f9b3de..a90ad5e82872 100644 --- a/packages/graphql-server/src/__tests__/makeMergedSchema.test.ts +++ b/packages/graphql-server/src/__tests__/makeMergedSchema.test.ts @@ -1,4 +1,5 @@ -import { parse, GraphQLResolveInfo, graphql, GraphQLError } from 'graphql' +import type { GraphQLResolveInfo } from 'graphql' +import { parse, graphql, GraphQLError } from 'graphql' import gql from 'graphql-tag' import { @@ -7,7 +8,7 @@ import { createValidatorDirective, } from '../directives/makeDirectives' import { makeMergedSchema } from '../makeMergedSchema' -import { +import type { GraphQLTypeWithFields, ServicesGlobImports, SdlGlobImports, diff --git a/packages/graphql-server/src/cors.ts b/packages/graphql-server/src/cors.ts index fac3c86f7df9..548309444a0a 100644 --- a/packages/graphql-server/src/cors.ts +++ b/packages/graphql-server/src/cors.ts @@ -1,6 +1,6 @@ -import { CORSOptions } from 'graphql-yoga' +import type { CORSOptions } from 'graphql-yoga' -import { CorsConfig } from '@redwoodjs/api' +import type { CorsConfig } from '@redwoodjs/api' export const mapRwCorsOptionsToYoga = ( rwCorsConfig?: CorsConfig, diff --git a/packages/graphql-server/src/createGraphQLYoga.ts b/packages/graphql-server/src/createGraphQLYoga.ts index 4e838613d31f..fd3c3a8e5735 100644 --- a/packages/graphql-server/src/createGraphQLYoga.ts +++ b/packages/graphql-server/src/createGraphQLYoga.ts @@ -1,8 +1,10 @@ /* eslint-disable react-hooks/rules-of-hooks */ import { useDisableIntrospection } from '@envelop/disable-introspection' import { useFilterAllowedOperations } from '@envelop/filter-operation-type' -import { GraphQLSchema, OperationTypeNode } from 'graphql' -import { Plugin, useReadinessCheck, createYoga } from 'graphql-yoga' +import type { GraphQLSchema } from 'graphql' +import { OperationTypeNode } from 'graphql' +import type { Plugin } from 'graphql-yoga' +import { useReadinessCheck, createYoga } from 'graphql-yoga' import { mapRwCorsOptionsToYoga } from './cors' import { makeDirectivesForPlugin } from './directives/makeDirectives' diff --git a/packages/graphql-server/src/directives/makeDirectives.ts b/packages/graphql-server/src/directives/makeDirectives.ts index 721ec38c2c9a..faf4cc7cc8bf 100644 --- a/packages/graphql-server/src/directives/makeDirectives.ts +++ b/packages/graphql-server/src/directives/makeDirectives.ts @@ -1,13 +1,13 @@ -import { DocumentNode, ExecutableDefinitionNode } from 'graphql' +import type { DocumentNode, ExecutableDefinitionNode } from 'graphql' -import { - DirectiveType, +import type { RedwoodDirective, TransformerDirective, TransformerDirectiveFunc, ValidatorDirective, ValidatorDirectiveFunc, } from '../plugins/useRedwoodDirective' +import { DirectiveType } from '../plugins/useRedwoodDirective' /* We want directivesGlobs type to be an object with this shape: diff --git a/packages/graphql-server/src/functions/graphql.ts b/packages/graphql-server/src/functions/graphql.ts index c42b5d8f91b0..4434a1ff66c3 100644 --- a/packages/graphql-server/src/functions/graphql.ts +++ b/packages/graphql-server/src/functions/graphql.ts @@ -5,7 +5,7 @@ import type { } from 'aws-lambda' import { createGraphQLYoga } from '../createGraphQLYoga' -import { GlobalContext } from '../globalContext' +import type { GlobalContext } from '../globalContext' import { getAsyncStoreInstance } from '../globalContextStore' import type { GraphQLHandlerOptions } from '../types' diff --git a/packages/graphql-server/src/functions/useRequireAuth.ts b/packages/graphql-server/src/functions/useRequireAuth.ts index 0dde3beaa696..669a0757cf33 100644 --- a/packages/graphql-server/src/functions/useRequireAuth.ts +++ b/packages/graphql-server/src/functions/useRequireAuth.ts @@ -1,8 +1,10 @@ import type { APIGatewayEvent, Context as LambdaContext } from 'aws-lambda' -import { getAuthenticationContext, Decoder } from '@redwoodjs/api' +import type { Decoder } from '@redwoodjs/api' +import { getAuthenticationContext } from '@redwoodjs/api' -import { GlobalContext, context as globalContext } from '../globalContext' +import type { GlobalContext } from '../globalContext' +import { context as globalContext } from '../globalContext' import { getAsyncStoreInstance } from '../globalContextStore' import type { GetCurrentUser } from '../types' diff --git a/packages/graphql-server/src/makeMergedSchema.ts b/packages/graphql-server/src/makeMergedSchema.ts index 08607b8bd4fd..81f3423961ea 100644 --- a/packages/graphql-server/src/makeMergedSchema.ts +++ b/packages/graphql-server/src/makeMergedSchema.ts @@ -1,10 +1,13 @@ import { mergeTypeDefs } from '@graphql-tools/merge' +import type { IExecutableSchemaDefinition } from '@graphql-tools/schema' import { addResolversToSchema, makeExecutableSchema, - IExecutableSchemaDefinition, } from '@graphql-tools/schema' -import { IResolvers, IResolverValidationOptions } from '@graphql-tools/utils' +import type { + IResolvers, + IResolverValidationOptions, +} from '@graphql-tools/utils' import * as opentelemetry from '@opentelemetry/api' import type { GraphQLSchema, @@ -18,7 +21,7 @@ import { merge, omitBy } from 'lodash' import type { RedwoodDirective } from './plugins/useRedwoodDirective' import * as rootGqlSchema from './rootSchema' import type { RedwoodSubscription } from './subscriptions/makeSubscriptions' -import { +import type { Services, ServicesGlobImports, GraphQLTypeWithFields, diff --git a/packages/graphql-server/src/plugins/__tests__/useRedwoodDirective.test.ts b/packages/graphql-server/src/plugins/__tests__/useRedwoodDirective.test.ts index 1c6699276363..ebb3ace25273 100644 --- a/packages/graphql-server/src/plugins/__tests__/useRedwoodDirective.test.ts +++ b/packages/graphql-server/src/plugins/__tests__/useRedwoodDirective.test.ts @@ -1,14 +1,12 @@ import { useEngine } from '@envelop/core' import { assertSingleExecutionValue, createTestkit } from '@envelop/testing' +import type { FieldDefinitionNode, GraphQLDirective } from 'graphql' import * as GraphQLJS from 'graphql' -import { - FieldDefinitionNode, - getDirectiveValues, - GraphQLDirective, -} from 'graphql' -import { Plugin, createSchema } from 'graphql-yoga' - -import { GraphQLTypeWithFields } from '../../index' +import { getDirectiveValues } from 'graphql' +import type { Plugin } from 'graphql-yoga' +import { createSchema } from 'graphql-yoga' + +import type { GraphQLTypeWithFields } from '../../index' import { useRedwoodDirective, DirectiveType } from '../useRedwoodDirective' // ===== Test Setup ====== diff --git a/packages/graphql-server/src/plugins/__tests__/useRedwoodGlobalContextSetter.test.ts b/packages/graphql-server/src/plugins/__tests__/useRedwoodGlobalContextSetter.test.ts index b8322874cc4e..84da0d36fb5a 100644 --- a/packages/graphql-server/src/plugins/__tests__/useRedwoodGlobalContextSetter.test.ts +++ b/packages/graphql-server/src/plugins/__tests__/useRedwoodGlobalContextSetter.test.ts @@ -2,12 +2,8 @@ import { useEngine } from '@envelop/core' import { createTestkit } from '@envelop/testing' import * as GraphQLJS from 'graphql' -import { - GlobalContext, - context, - getAsyncStoreInstance, - setContext, -} from '../../index' +import type { GlobalContext } from '../../index' +import { context, getAsyncStoreInstance, setContext } from '../../index' import { testSchema, testQuery } from '../__fixtures__/common' import { useRedwoodGlobalContextSetter } from '../useRedwoodGlobalContextSetter' import { useRedwoodPopulateContext } from '../useRedwoodPopulateContext' diff --git a/packages/graphql-server/src/plugins/__tests__/useRedwoodLogger.test.ts b/packages/graphql-server/src/plugins/__tests__/useRedwoodLogger.test.ts index 2e69cf2ee2b4..2868cd3f2ebe 100644 --- a/packages/graphql-server/src/plugins/__tests__/useRedwoodLogger.test.ts +++ b/packages/graphql-server/src/plugins/__tests__/useRedwoodLogger.test.ts @@ -17,7 +17,8 @@ import { testFilteredQuery, testValidationErrorQuery, } from '../__fixtures__/common' -import { LoggerConfig, useRedwoodLogger } from '../useRedwoodLogger' +import type { LoggerConfig } from '../useRedwoodLogger' +import { useRedwoodLogger } from '../useRedwoodLogger' const watchFileCreated = (filename) => { return new Promise((resolve, reject) => { diff --git a/packages/graphql-server/src/plugins/useArmor.ts b/packages/graphql-server/src/plugins/useArmor.ts index aec790cf0483..33932b86ba50 100644 --- a/packages/graphql-server/src/plugins/useArmor.ts +++ b/packages/graphql-server/src/plugins/useArmor.ts @@ -3,7 +3,7 @@ import type { GraphQLError, ValidationContext } from 'graphql' import type { Logger } from '@redwoodjs/api/logger' -import { ArmorConfig } from '../types' +import type { ArmorConfig } from '../types' const armorConfigDefaultOptions: ArmorConfig = { logContext: false, diff --git a/packages/graphql-server/src/plugins/useRedwoodAuthContext.ts b/packages/graphql-server/src/plugins/useRedwoodAuthContext.ts index c957eb8f5885..dee0c33319e0 100644 --- a/packages/graphql-server/src/plugins/useRedwoodAuthContext.ts +++ b/packages/graphql-server/src/plugins/useRedwoodAuthContext.ts @@ -1,12 +1,9 @@ -import { Plugin } from 'graphql-yoga' +import type { Plugin } from 'graphql-yoga' -import { - AuthContextPayload, - getAuthenticationContext, - Decoder, -} from '@redwoodjs/api' +import type { AuthContextPayload, Decoder } from '@redwoodjs/api' +import { getAuthenticationContext } from '@redwoodjs/api' -import { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types' +import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types' /** * Envelop plugin for injecting the current user into the GraphQL Context, diff --git a/packages/graphql-server/src/plugins/useRedwoodDirective.ts b/packages/graphql-server/src/plugins/useRedwoodDirective.ts index 98f17edcc13b..66d990b86ce6 100644 --- a/packages/graphql-server/src/plugins/useRedwoodDirective.ts +++ b/packages/graphql-server/src/plugins/useRedwoodDirective.ts @@ -1,15 +1,14 @@ import { mapSchema, MapperKind } from '@graphql-tools/utils' -import { - defaultFieldResolver, +import type { DirectiveNode, DocumentNode, - getDirectiveValues, GraphQLFieldConfig, GraphQLObjectType, GraphQLResolveInfo, GraphQLSchema, } from 'graphql' -import { Plugin } from 'graphql-yoga' +import { defaultFieldResolver, getDirectiveValues } from 'graphql' +import type { Plugin } from 'graphql-yoga' import type { GlobalContext } from '../index' diff --git a/packages/graphql-server/src/plugins/useRedwoodError.ts b/packages/graphql-server/src/plugins/useRedwoodError.ts index 797293f4c52c..27dd054213fd 100644 --- a/packages/graphql-server/src/plugins/useRedwoodError.ts +++ b/packages/graphql-server/src/plugins/useRedwoodError.ts @@ -1,5 +1,5 @@ +import type { Plugin } from 'graphql-yoga' import { - Plugin, handleStreamOrSingleExecutionResult, createGraphQLError, } from 'graphql-yoga' @@ -7,7 +7,7 @@ import { import { RedwoodError } from '@redwoodjs/api' import type { Logger } from '@redwoodjs/api/logger' -import { RedwoodGraphQLContext } from '../types' +import type { RedwoodGraphQLContext } from '../types' /** * Converts RedwoodErrors to GraphQLErrors diff --git a/packages/graphql-server/src/plugins/useRedwoodGlobalContextSetter.ts b/packages/graphql-server/src/plugins/useRedwoodGlobalContextSetter.ts index 432a45423206..12f7ba2dbfd9 100644 --- a/packages/graphql-server/src/plugins/useRedwoodGlobalContextSetter.ts +++ b/packages/graphql-server/src/plugins/useRedwoodGlobalContextSetter.ts @@ -1,7 +1,7 @@ -import { Plugin } from 'graphql-yoga' +import type { Plugin } from 'graphql-yoga' import { setContext } from '../index' -import { RedwoodGraphQLContext } from '../types' +import type { RedwoodGraphQLContext } from '../types' /** * This Envelop plugin waits until the GraphQL context is done building and sets the diff --git a/packages/graphql-server/src/plugins/useRedwoodLogger.ts b/packages/graphql-server/src/plugins/useRedwoodLogger.ts index 73e6f7887ce4..f25291d76833 100644 --- a/packages/graphql-server/src/plugins/useRedwoodLogger.ts +++ b/packages/graphql-server/src/plugins/useRedwoodLogger.ts @@ -1,16 +1,17 @@ -import { +import type { DefinitionNode, ExecutionResult, - Kind, OperationDefinitionNode, } from 'graphql' -import { Plugin, handleStreamOrSingleExecutionResult } from 'graphql-yoga' +import { Kind } from 'graphql' +import type { Plugin } from 'graphql-yoga' +import { handleStreamOrSingleExecutionResult } from 'graphql-yoga' import { v4 as uuidv4 } from 'uuid' import type { Logger, LevelWithSilent } from '@redwoodjs/api/logger' import { AuthenticationError, ForbiddenError } from '../errors' -import { RedwoodGraphQLContext } from '../types' +import type { RedwoodGraphQLContext } from '../types' /** * Options for request and response information to include in the log statements diff --git a/packages/graphql-server/src/plugins/useRedwoodOpenTelemetry.ts b/packages/graphql-server/src/plugins/useRedwoodOpenTelemetry.ts index 79fb69ca199c..ff95562f927e 100644 --- a/packages/graphql-server/src/plugins/useRedwoodOpenTelemetry.ts +++ b/packages/graphql-server/src/plugins/useRedwoodOpenTelemetry.ts @@ -1,10 +1,12 @@ -import { Plugin, OnExecuteHookResult, isAsyncIterable } from '@envelop/core' +import type { Plugin, OnExecuteHookResult } from '@envelop/core' +import { isAsyncIterable } from '@envelop/core' import { useOnResolve } from '@envelop/on-resolve' -import { Attributes, SpanKind } from '@opentelemetry/api' +import type { Attributes } from '@opentelemetry/api' +import { SpanKind } from '@opentelemetry/api' import * as opentelemetry from '@opentelemetry/api' import { print } from 'graphql' -import { RedwoodOpenTelemetryConfig } from 'src/types' +import type { RedwoodOpenTelemetryConfig } from 'src/types' export enum AttributeName { EXECUTION_ERROR = 'graphql.execute.error', diff --git a/packages/graphql-server/src/plugins/useRedwoodPopulateContext.ts b/packages/graphql-server/src/plugins/useRedwoodPopulateContext.ts index 7625252fe1ce..7552ed0f9f7c 100644 --- a/packages/graphql-server/src/plugins/useRedwoodPopulateContext.ts +++ b/packages/graphql-server/src/plugins/useRedwoodPopulateContext.ts @@ -1,6 +1,6 @@ -import { Plugin } from 'graphql-yoga' +import type { Plugin } from 'graphql-yoga' -import { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types' +import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types' /** * This Envelop plugin enriches the context on a per-request basis diff --git a/packages/graphql-server/src/subscriptions/makeSubscriptions.ts b/packages/graphql-server/src/subscriptions/makeSubscriptions.ts index 9bb8e9780c9a..961cbf681746 100644 --- a/packages/graphql-server/src/subscriptions/makeSubscriptions.ts +++ b/packages/graphql-server/src/subscriptions/makeSubscriptions.ts @@ -1,4 +1,4 @@ -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' /** * We want SubscriptionsGlobs type to be an object with this shape: * diff --git a/packages/graphql-server/src/types.ts b/packages/graphql-server/src/types.ts index 546fd8f55a70..5d9ad5ec5174 100644 --- a/packages/graphql-server/src/types.ts +++ b/packages/graphql-server/src/types.ts @@ -1,21 +1,25 @@ import type { AllowedOperations } from '@envelop/filter-operation-type' import type { GraphQLArmorConfig } from '@escape.tech/graphql-armor-types' -import { IExecutableSchemaDefinition } from '@graphql-tools/schema' +import type { IExecutableSchemaDefinition } from '@graphql-tools/schema' import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda' -import { GraphQLObjectType, GraphQLInterfaceType, DocumentNode } from 'graphql' +import type { + GraphQLObjectType, + GraphQLInterfaceType, + DocumentNode, +} from 'graphql' import type { Plugin } from 'graphql-yoga' import type { AuthContextPayload, Decoder } from '@redwoodjs/api' -import { CorsConfig } from '@redwoodjs/api' +import type { CorsConfig } from '@redwoodjs/api' import type { RedwoodRealtimeOptions } from '@redwoodjs/realtime' -import { DirectiveGlobImports } from 'src/directives/makeDirectives' +import type { DirectiveGlobImports } from 'src/directives/makeDirectives' import type { useRedwoodDirectiveReturn, DirectivePluginOptions, } from './plugins/useRedwoodDirective' -import { LoggerConfig } from './plugins/useRedwoodLogger' +import type { LoggerConfig } from './plugins/useRedwoodLogger' export type Resolver = (...args: unknown[]) => unknown export type Services = { diff --git a/packages/internal/src/__tests__/validateSchemaForAuthDirectives.test.ts b/packages/internal/src/__tests__/validateSchemaForAuthDirectives.test.ts index 3d745d9e1a82..9d9fcb70ddd2 100644 --- a/packages/internal/src/__tests__/validateSchemaForAuthDirectives.test.ts +++ b/packages/internal/src/__tests__/validateSchemaForAuthDirectives.test.ts @@ -3,7 +3,7 @@ import path from 'path' import { CodeFileLoader } from '@graphql-tools/code-file-loader' import { loadTypedefs } from '@graphql-tools/load' import { mergeTypeDefs } from '@graphql-tools/merge' -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/internal/src/__tests__/validateSchemaForReservedNames.test.ts b/packages/internal/src/__tests__/validateSchemaForReservedNames.test.ts index 695337441c6a..3ce90806c2df 100644 --- a/packages/internal/src/__tests__/validateSchemaForReservedNames.test.ts +++ b/packages/internal/src/__tests__/validateSchemaForReservedNames.test.ts @@ -1,6 +1,6 @@ import path from 'path' -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' import gql from 'graphql-tag' import { validateSchema } from '../validateSchema' diff --git a/packages/internal/src/ast.ts b/packages/internal/src/ast.ts index 8d4936099f21..e14cb3ecc507 100644 --- a/packages/internal/src/ast.ts +++ b/packages/internal/src/ast.ts @@ -2,7 +2,8 @@ import fs from 'fs' import path from 'path' import { types } from '@babel/core' -import { parse as babelParse, ParserPlugin } from '@babel/parser' +import type { ParserPlugin } from '@babel/parser' +import { parse as babelParse } from '@babel/parser' import traverse from '@babel/traverse' import chalk from 'chalk' diff --git a/packages/internal/src/build/babel/api.ts b/packages/internal/src/build/babel/api.ts index 1db5a6beed86..0332dd5b8344 100644 --- a/packages/internal/src/build/babel/api.ts +++ b/packages/internal/src/build/babel/api.ts @@ -7,9 +7,9 @@ import type { PluginItem } from '@babel/core' import { getPaths } from '@redwoodjs/project-config' +import type { RegisterHookOptions } from './common' import { registerBabel, - RegisterHookOptions, CORE_JS_VERSION, RUNTIME_CORE_JS_VERSION, getCommonPlugins, diff --git a/packages/internal/src/build/babel/web.ts b/packages/internal/src/build/babel/web.ts index 568dfb2f83fb..d63d05c06612 100644 --- a/packages/internal/src/build/babel/web.ts +++ b/packages/internal/src/build/babel/web.ts @@ -6,11 +6,11 @@ import type { TransformOptions } from '@babel/core' import { getPaths } from '@redwoodjs/project-config' +import type { RegisterHookOptions } from './common' import { CORE_JS_VERSION, getCommonPlugins, registerBabel, - RegisterHookOptions, parseTypeScriptConfigFiles, getPathsFromConfig, } from './common' diff --git a/packages/internal/src/build/babelPlugins/babel-plugin-redwood-routes-auto-loader.ts b/packages/internal/src/build/babelPlugins/babel-plugin-redwood-routes-auto-loader.ts index ff4bdfef77cb..03ce0e6d3460 100644 --- a/packages/internal/src/build/babelPlugins/babel-plugin-redwood-routes-auto-loader.ts +++ b/packages/internal/src/build/babelPlugins/babel-plugin-redwood-routes-auto-loader.ts @@ -2,11 +2,11 @@ import path from 'path' import type { PluginObj, types } from '@babel/core' +import type { PagesDependency } from '@redwoodjs/project-config' import { importStatementPath, processPagesDir, getPaths, - PagesDependency, ensurePosixPath, } from '@redwoodjs/project-config' diff --git a/packages/internal/src/build/web.ts b/packages/internal/src/build/web.ts index 74abb565e04b..faf30017038c 100644 --- a/packages/internal/src/build/web.ts +++ b/packages/internal/src/build/web.ts @@ -5,7 +5,8 @@ import { removeSync } from 'fs-extra' import { getPaths } from '@redwoodjs/project-config' -import { prebuildWebFile, Flags } from './babel/web' +import type { Flags } from './babel/web' +import { prebuildWebFile } from './babel/web' // @MARK // This whole file is currently only used in testing diff --git a/packages/internal/src/generate/graphqlCodeGen.ts b/packages/internal/src/generate/graphqlCodeGen.ts index 8680f1e912a6..49f50ad37aaa 100644 --- a/packages/internal/src/generate/graphqlCodeGen.ts +++ b/packages/internal/src/generate/graphqlCodeGen.ts @@ -15,7 +15,7 @@ import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader' import { loadDocuments, loadSchemaSync } from '@graphql-tools/load' import type { LoadTypedefsOptions } from '@graphql-tools/load' import execa from 'execa' -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' import { getPaths, getConfig } from '@redwoodjs/project-config' diff --git a/packages/internal/src/generate/graphqlSchema.ts b/packages/internal/src/generate/graphqlSchema.ts index 3b6435c71eb7..d253057ef161 100644 --- a/packages/internal/src/generate/graphqlSchema.ts +++ b/packages/internal/src/generate/graphqlSchema.ts @@ -4,9 +4,11 @@ import { codegen } from '@graphql-codegen/core' import type { Types as CodegenTypes } from '@graphql-codegen/plugin-helpers' import * as schemaAstPlugin from '@graphql-codegen/schema-ast' import { CodeFileLoader } from '@graphql-tools/code-file-loader' -import { loadSchema, LoadSchemaOptions } from '@graphql-tools/load' +import type { LoadSchemaOptions } from '@graphql-tools/load' +import { loadSchema } from '@graphql-tools/load' import chalk from 'chalk' -import { DocumentNode, print } from 'graphql' +import type { DocumentNode } from 'graphql' +import { print } from 'graphql' import terminalLink from 'terminal-link' import { rootSchema } from '@redwoodjs/graphql-server' diff --git a/packages/internal/src/generate/plugins/rw-typescript-resolvers/index.ts b/packages/internal/src/generate/plugins/rw-typescript-resolvers/index.ts index 9ececef7b405..f240760a1fd1 100644 --- a/packages/internal/src/generate/plugins/rw-typescript-resolvers/index.ts +++ b/packages/internal/src/generate/plugins/rw-typescript-resolvers/index.ts @@ -1,6 +1,5 @@ +import type { Types, PluginFunction } from '@graphql-codegen/plugin-helpers' import { - Types, - PluginFunction, getCachedDocumentNodeFromSchema, oldVisit, } from '@graphql-codegen/plugin-helpers' @@ -8,7 +7,7 @@ import { TypeScriptResolversPluginConfig, plugin as originalPlugin, } from '@graphql-codegen/typescript-resolvers' -import { GraphQLSchema } from 'graphql' +import type { GraphQLSchema } from 'graphql' import { RwTypeScriptResolversVisitor } from './visitor' diff --git a/packages/internal/src/generate/plugins/rw-typescript-resolvers/visitor.ts b/packages/internal/src/generate/plugins/rw-typescript-resolvers/visitor.ts index 74a48b8d14da..6c6b0ebb9353 100644 --- a/packages/internal/src/generate/plugins/rw-typescript-resolvers/visitor.ts +++ b/packages/internal/src/generate/plugins/rw-typescript-resolvers/visitor.ts @@ -1,12 +1,10 @@ -import { - TypeScriptResolversPluginConfig, - TypeScriptResolversVisitor, -} from '@graphql-codegen/typescript-resolvers' +import type { TypeScriptResolversPluginConfig } from '@graphql-codegen/typescript-resolvers' +import { TypeScriptResolversVisitor } from '@graphql-codegen/typescript-resolvers' import { indent, DeclarationBlock, } from '@graphql-codegen/visitor-plugin-common' -import { +import type { FieldDefinitionNode, GraphQLSchema, ObjectTypeDefinitionNode, diff --git a/packages/internal/src/gql.ts b/packages/internal/src/gql.ts index 22587234d1ce..b49c88280be3 100644 --- a/packages/internal/src/gql.ts +++ b/packages/internal/src/gql.ts @@ -1,15 +1,13 @@ import { CodeFileLoader } from '@graphql-tools/code-file-loader' import { loadSchema } from '@graphql-tools/load' -import { +import type { DocumentNode, FieldNode, InlineFragmentNode, OperationDefinitionNode, OperationTypeNode, - parse, - print, - visit, } from 'graphql' +import { parse, print, visit } from 'graphql' import { rootSchema } from '@redwoodjs/graphql-server' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/internal/src/validateSchema.ts b/packages/internal/src/validateSchema.ts index 83c525005b1f..6d12ed7836c6 100644 --- a/packages/internal/src/validateSchema.ts +++ b/packages/internal/src/validateSchema.ts @@ -1,7 +1,8 @@ import { CodeFileLoader } from '@graphql-tools/code-file-loader' import { loadTypedefs } from '@graphql-tools/load' import { mergeTypeDefs } from '@graphql-tools/merge' -import { DocumentNode, Kind, ObjectTypeDefinitionNode, visit } from 'graphql' +import type { DocumentNode, ObjectTypeDefinitionNode } from 'graphql' +import { Kind, visit } from 'graphql' import { rootSchema } from '@redwoodjs/graphql-server' import { getPaths } from '@redwoodjs/project-config' diff --git a/packages/internal/src/webpackPlugins/ChunkReferencesPlugin.ts b/packages/internal/src/webpackPlugins/ChunkReferencesPlugin.ts index 94a54d1e4936..af1372d23be5 100644 --- a/packages/internal/src/webpackPlugins/ChunkReferencesPlugin.ts +++ b/packages/internal/src/webpackPlugins/ChunkReferencesPlugin.ts @@ -1,4 +1,4 @@ -import { Compiler, Chunk } from 'webpack' +import type { Compiler, Chunk } from 'webpack' export class ChunkReferencesPlugin { static defaultOptions = { diff --git a/packages/prerender/src/errors.tsx b/packages/prerender/src/errors.tsx index 611a77c62b32..ced9959e40e1 100644 --- a/packages/prerender/src/errors.tsx +++ b/packages/prerender/src/errors.tsx @@ -1,4 +1,5 @@ -import { DocumentNode, print } from 'graphql' +import type { DocumentNode } from 'graphql' +import { print } from 'graphql' export class PrerenderGqlError { message: string diff --git a/packages/prerender/src/graphql/graphql.ts b/packages/prerender/src/graphql/graphql.ts index 29374e952db1..2fcaf8b73d02 100644 --- a/packages/prerender/src/graphql/graphql.ts +++ b/packages/prerender/src/graphql/graphql.ts @@ -1,6 +1,7 @@ import path from 'path' -import { DocumentNode, print } from 'graphql' +import type { DocumentNode } from 'graphql' +import { print } from 'graphql' import { getPaths } from '@redwoodjs/project-config' // @MARK: have to do this, otherwise rwjs/web is loaded before shims diff --git a/packages/prerender/src/runPrerender.tsx b/packages/prerender/src/runPrerender.tsx index a4c17e570ea2..0888d63a373b 100644 --- a/packages/prerender/src/runPrerender.tsx +++ b/packages/prerender/src/runPrerender.tsx @@ -4,7 +4,8 @@ import path from 'path' import React from 'react' import { ApolloClient, InMemoryCache } from '@apollo/client' -import { CheerioAPI, load as loadHtml } from 'cheerio' +import type { CheerioAPI } from 'cheerio' +import { load as loadHtml } from 'cheerio' import ReactDOMServer from 'react-dom/server' import { registerApiSideBabelHook } from '@redwoodjs/internal/dist/build/babel/api' diff --git a/packages/realtime/src/graphql/plugins/useRedwoodRealtime.ts b/packages/realtime/src/graphql/plugins/useRedwoodRealtime.ts index e9e0ad34a3bb..b802fae6de32 100644 --- a/packages/realtime/src/graphql/plugins/useRedwoodRealtime.ts +++ b/packages/realtime/src/graphql/plugins/useRedwoodRealtime.ts @@ -9,7 +9,8 @@ import type { PubSub } from '@graphql-yoga/subscription' import { createPubSub } from '@graphql-yoga/subscription' import { GraphQLLiveDirective } from '@n1ru4l/graphql-live-query' import { InMemoryLiveQueryStore } from '@n1ru4l/in-memory-live-query-store' -import { execute as defaultExecute, print } from 'graphql' +import type { execute as defaultExecute } from 'graphql' +import { print } from 'graphql' /** * We want SubscriptionsGlobs type to be an object with this shape: diff --git a/packages/router/src/ActivePageContext.tsx b/packages/router/src/ActivePageContext.tsx index 5525f09de5df..2cb1aaa3aeeb 100644 --- a/packages/router/src/ActivePageContext.tsx +++ b/packages/router/src/ActivePageContext.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react' -import { LocationContextType } from './location' +import type { LocationContextType } from './location' import { createNamedContext } from './util' export type LoadingState = 'PRE_SHOW' | 'SHOW_LOADING' | 'DONE' diff --git a/packages/router/src/Set.tsx b/packages/router/src/Set.tsx index 86c6760d2f08..abebebc2d8e6 100644 --- a/packages/router/src/Set.tsx +++ b/packages/router/src/Set.tsx @@ -1,4 +1,5 @@ -import React, { ReactElement, ReactNode } from 'react' +import type { ReactElement, ReactNode } from 'react' +import React from 'react' export type WrapperType = ( props: WTProps & { children: ReactNode } diff --git a/packages/router/src/__tests__/router.test.tsx b/packages/router/src/__tests__/router.test.tsx index acb1116fa870..ec00943cbac9 100644 --- a/packages/router/src/__tests__/router.test.tsx +++ b/packages/router/src/__tests__/router.test.tsx @@ -29,7 +29,7 @@ import { } from '@testing-library/react' import '@testing-library/jest-dom/extend-expect' -import { AuthContextInterface } from '@redwoodjs/auth' +import type { AuthContextInterface } from '@redwoodjs/auth' import { Router, diff --git a/packages/router/src/active-route-loader.tsx b/packages/router/src/active-route-loader.tsx index cacbee622dd1..00ac7d47102e 100644 --- a/packages/router/src/active-route-loader.tsx +++ b/packages/router/src/active-route-loader.tsx @@ -2,7 +2,8 @@ import React, { Suspense, useEffect, useRef } from 'react' import { getAnnouncement, getFocus, resetFocus } from './a11yUtils' import { usePageLoadingContext } from './PageLoadingContext' -import { inIframe, Spec } from './util' +import type { Spec } from './util' +import { inIframe } from './util' interface Props { path: string diff --git a/packages/router/src/links.tsx b/packages/router/src/links.tsx index 14c95fca3e4b..3dcde9ef0864 100644 --- a/packages/router/src/links.tsx +++ b/packages/router/src/links.tsx @@ -1,6 +1,7 @@ import { forwardRef, useEffect } from 'react' -import { navigate, NavigateOptions } from './history' +import type { NavigateOptions } from './history' +import { navigate } from './history' import { useLocation } from './location' import { flattenSearchParams, matchPath } from './util' diff --git a/packages/router/src/location.tsx b/packages/router/src/location.tsx index 4719abeaebeb..8a8fd5b4b028 100644 --- a/packages/router/src/location.tsx +++ b/packages/router/src/location.tsx @@ -1,7 +1,8 @@ import React from 'react' import { gHistory } from './history' -import { createNamedContext, TrailingSlashesTypes } from './util' +import type { TrailingSlashesTypes } from './util' +import { createNamedContext } from './util' export interface LocationContextType { pathname: string diff --git a/packages/router/src/route-validators.tsx b/packages/router/src/route-validators.tsx index 18937f24d215..55434cbd3513 100644 --- a/packages/router/src/route-validators.tsx +++ b/packages/router/src/route-validators.tsx @@ -1,7 +1,9 @@ -import { isValidElement, ReactNode, ReactElement } from 'react' +import type { ReactNode, ReactElement } from 'react' +import { isValidElement } from 'react' -import { Route, RouteProps } from './router' -import { Spec } from './util' +import type { RouteProps } from './router' +import { Route } from './router' +import type { Spec } from './util' export type RenderMode = 'stream' | 'html' diff --git a/packages/router/src/routeParamsTypes.ts b/packages/router/src/routeParamsTypes.ts index a8ee617e6145..347407ac193f 100644 --- a/packages/router/src/routeParamsTypes.ts +++ b/packages/router/src/routeParamsTypes.ts @@ -1,4 +1,4 @@ -import { A } from 'ts-toolbelt' +import type { A } from 'ts-toolbelt' export type GenericParams = Record diff --git a/packages/router/src/router-context.tsx b/packages/router/src/router-context.tsx index 8acbb5ac2145..5fec55ce5752 100644 --- a/packages/router/src/router-context.tsx +++ b/packages/router/src/router-context.tsx @@ -1,6 +1,7 @@ import React, { useReducer, createContext, useContext } from 'react' -import { AuthContextInterface, useNoAuth } from '@redwoodjs/auth' +import type { AuthContextInterface } from '@redwoodjs/auth' +import { useNoAuth } from '@redwoodjs/auth' import type { ParamType } from './util' diff --git a/packages/router/src/router.tsx b/packages/router/src/router.tsx index e3934e82e088..8f8d5785987b 100644 --- a/packages/router/src/router.tsx +++ b/packages/router/src/router.tsx @@ -1,4 +1,5 @@ -import React, { ReactNode, ReactElement, useMemo, memo } from 'react' +import type { ReactNode, ReactElement } from 'react' +import React, { useMemo, memo } from 'react' import { ActiveRouteLoader } from './active-route-loader' import { AuthenticatedRoute } from './AuthenticatedRoute' @@ -6,17 +7,14 @@ import { Redirect } from './links' import { LocationProvider, useLocation } from './location' import { PageLoadingContextProvider } from './PageLoadingContext' import { ParamsProvider } from './params' -import { - isValidRoute, +import type { NotFoundRouteProps, - PageType, RedirectRouteProps, RenderMode, } from './route-validators' -import { - RouterContextProvider, - RouterContextProviderProps, -} from './router-context' +import { isValidRoute, PageType } from './route-validators' +import type { RouterContextProviderProps } from './router-context' +import { RouterContextProvider } from './router-context' import { SplashPage } from './splash-page' import { analyzeRoutes, @@ -24,10 +22,9 @@ import { normalizePage, parseSearch, replaceParams, - TrailingSlashesTypes, validatePath, } from './util' -import type { Wrappers } from './util' +import type { Wrappers, TrailingSlashesTypes } from './util' import type { AvailableRoutes } from './index' diff --git a/packages/router/src/util.ts b/packages/router/src/util.ts index 5b22dcf56e5d..70d28012cb8a 100644 --- a/packages/router/src/util.ts +++ b/packages/router/src/util.ts @@ -1,4 +1,5 @@ -import React, { Children, isValidElement, ReactElement, ReactNode } from 'react' +import type { ReactElement, ReactNode } from 'react' +import React, { Children, isValidElement } from 'react' import { isNotFoundRoute, @@ -6,7 +7,7 @@ import { isStandardRoute, isValidRoute, } from './route-validators' -import { PageType } from './router' +import type { PageType } from './router' import { isPrivateNode, isSetNode } from './Set' /** Create a React Context with the given name. */ diff --git a/packages/structure/src/ide.ts b/packages/structure/src/ide.ts index 11989306cd02..c88a160b2376 100644 --- a/packages/structure/src/ide.ts +++ b/packages/structure/src/ide.ts @@ -1,23 +1,25 @@ import { basename } from 'path' -import * as tsm from 'ts-morph' -import { TextDocuments } from 'vscode-languageserver' -import { TextDocument } from 'vscode-languageserver-textdocument' -import { +import type * as tsm from 'ts-morph' +import type { TextDocuments } from 'vscode-languageserver' +import type { TextDocument } from 'vscode-languageserver-textdocument' +import type { CodeLens, DocumentLink, Hover, Location, - Range, } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' -import { Host, DefaultHost } from './hosts' -import { ArrayLike, ArrayLike_normalize } from './x/Array' +import type { Host } from './hosts' +import { DefaultHost } from './hosts' +import type { ArrayLike } from './x/Array' +import { ArrayLike_normalize } from './x/Array' import { lazy, memo } from './x/decorators' import { basenameNoExt } from './x/path' import { createTSMSourceFile_cached } from './x/ts-morph' import { URL_file } from './x/URL' -import { ExtendedDiagnostic } from './x/vscode-languageserver-types' +import type { ExtendedDiagnostic } from './x/vscode-languageserver-types' export type NodeID = string diff --git a/packages/structure/src/index.ts b/packages/structure/src/index.ts index 5195d9ddbd46..ace07f1ac980 100644 --- a/packages/structure/src/index.ts +++ b/packages/structure/src/index.ts @@ -4,10 +4,8 @@ export { RWProject } from './model' export { URL_file } from './x/URL' import { DefaultHost } from './hosts' import { RWProject } from './model' -import { - ExtendedDiagnostic_format, - GetSeverityLabelFunction, -} from './x/vscode-languageserver-types' +import type { GetSeverityLabelFunction } from './x/vscode-languageserver-types' +import { ExtendedDiagnostic_format } from './x/vscode-languageserver-types' export function getProject(projectRoot: string, host = new DefaultHost()) { return new RWProject({ diff --git a/packages/structure/src/interactive_cli/command_builder.ts b/packages/structure/src/interactive_cli/command_builder.ts index b8dc5fadd463..4422ef645245 100644 --- a/packages/structure/src/interactive_cli/command_builder.ts +++ b/packages/structure/src/interactive_cli/command_builder.ts @@ -1,11 +1,11 @@ import camelcase from 'camelcase' -import { RWProject } from '../model/RWProject' +import type { RWProject } from '../model/RWProject' import { validateRoutePath } from '../util' import { lazy, memo } from '../x/decorators' import { RedwoodCommandString } from './RedwoodCommandString' -import { UI } from './ui' +import type { UI } from './ui' export interface Opts { cmd: RedwoodCommandString diff --git a/packages/structure/src/interactive_cli/dry_run.ts b/packages/structure/src/interactive_cli/dry_run.ts index bfcfffe92805..56d3c8cc33b6 100644 --- a/packages/structure/src/interactive_cli/dry_run.ts +++ b/packages/structure/src/interactive_cli/dry_run.ts @@ -5,7 +5,7 @@ import proxyquire from 'proxyquire' import { spawnCancellable } from '../x/child_process' -import { RedwoodCommandString } from './RedwoodCommandString' +import type { RedwoodCommandString } from './RedwoodCommandString' export type FileSet = { [filePath: string]: string | null } diff --git a/packages/structure/src/interactive_cli/ui.ts b/packages/structure/src/interactive_cli/ui.ts index 4c26ef2b04a2..e34d934d527a 100644 --- a/packages/structure/src/interactive_cli/ui.ts +++ b/packages/structure/src/interactive_cli/ui.ts @@ -1,6 +1,6 @@ import enquirer from 'enquirer' -import { VSCodeWindowMethods } from '../x/vscode' +import type { VSCodeWindowMethods } from '../x/vscode' export type UIPickItem = { label: string diff --git a/packages/structure/src/language_server/RWLanguageServer.ts b/packages/structure/src/language_server/RWLanguageServer.ts index 5d15dc5154c3..571f7bfdd7f9 100644 --- a/packages/structure/src/language_server/RWLanguageServer.ts +++ b/packages/structure/src/language_server/RWLanguageServer.ts @@ -1,14 +1,15 @@ +import type { InitializeParams } from 'vscode-languageserver' import { createConnection, - InitializeParams, ProposedFeatures, TextDocuments, TextDocumentSyncKind, } from 'vscode-languageserver' import { TextDocument } from 'vscode-languageserver-textdocument' -import { CodeAction } from 'vscode-languageserver-types' +import type { CodeAction } from 'vscode-languageserver-types' -import { HostWithDocumentsStore, IDEInfo } from '../ide' +import type { IDEInfo } from '../ide' +import { HostWithDocumentsStore } from '../ide' import { RWProject } from '../model' import { lazy, memo } from '../x/decorators' import { URL_toFile } from '../x/URL' diff --git a/packages/structure/src/language_server/commands.ts b/packages/structure/src/language_server/commands.ts index e87015ff55f6..87c16fdee0d6 100644 --- a/packages/structure/src/language_server/commands.ts +++ b/packages/structure/src/language_server/commands.ts @@ -1,4 +1,4 @@ -import { ExecuteCommandOptions } from 'vscode-languageserver' +import type { ExecuteCommandOptions } from 'vscode-languageserver' import { command_builder } from '../interactive_cli/command_builder' import { redwood_gen_dry_run as dry_run } from '../interactive_cli/dry_run' @@ -12,7 +12,7 @@ import { WorkspaceEdit_fromFileSet, } from '../x/vscode-languageserver-types' -import { RWLanguageServer } from './RWLanguageServer' +import type { RWLanguageServer } from './RWLanguageServer' export const redwoodjs_commands = { 'redwoodjs.cli': 'redwoodjs.cli', diff --git a/packages/structure/src/language_server/diagnostics.ts b/packages/structure/src/language_server/diagnostics.ts index e63d7a0f6b71..b04225ec9b7e 100644 --- a/packages/structure/src/language_server/diagnostics.ts +++ b/packages/structure/src/language_server/diagnostics.ts @@ -1,7 +1,7 @@ import { debounce, memo } from '../x/decorators' import { ExtendedDiagnostic_groupByUri } from '../x/vscode-languageserver-types' -import { RWLanguageServer } from './RWLanguageServer' +import type { RWLanguageServer } from './RWLanguageServer' const REFRESH_DIAGNOSTICS_INTERVAL = 5000 const REFRESH_DIAGNOSTICS_DEBOUNCE = 500 diff --git a/packages/structure/src/language_server/outline.ts b/packages/structure/src/language_server/outline.ts index b0ad7781f460..c40ea4d33087 100644 --- a/packages/structure/src/language_server/outline.ts +++ b/packages/structure/src/language_server/outline.ts @@ -5,7 +5,7 @@ import { RemoteTreeDataProvider_publishOverLSPConnection, } from '../x/vscode' -import { RWLanguageServer } from './RWLanguageServer' +import type { RWLanguageServer } from './RWLanguageServer' export class OutlineManager { constructor(public server: RWLanguageServer) {} diff --git a/packages/structure/src/language_server/xmethods.ts b/packages/structure/src/language_server/xmethods.ts index b541eb8fac30..d62ef20b0ee2 100644 --- a/packages/structure/src/language_server/xmethods.ts +++ b/packages/structure/src/language_server/xmethods.ts @@ -1,6 +1,6 @@ import { memo } from '../x/decorators' -import { RWLanguageServer } from './RWLanguageServer' +import type { RWLanguageServer } from './RWLanguageServer' /** * A set of custom methods (not included in the LSP spec) exposed to the client diff --git a/packages/structure/src/model/RWComponent.ts b/packages/structure/src/model/RWComponent.ts index 80be1d3f3f07..23c887c99e8a 100644 --- a/packages/structure/src/model/RWComponent.ts +++ b/packages/structure/src/model/RWComponent.ts @@ -3,7 +3,7 @@ import * as tsm from 'ts-morph' import { FileNode } from '../ide' import { lazy } from '../x/decorators' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' export class RWComponent extends FileNode { constructor(public filePath: string, public parent: RWProject) { diff --git a/packages/structure/src/model/RWEnvHelper.ts b/packages/structure/src/model/RWEnvHelper.ts index c6dfd8b503a3..83b5ff2ec2cd 100644 --- a/packages/structure/src/model/RWEnvHelper.ts +++ b/packages/structure/src/model/RWEnvHelper.ts @@ -3,22 +3,24 @@ import { join } from 'path' import * as dotenv from 'dotenv-defaults' import { existsSync, readFileSync } from 'fs-extra' import { pickBy } from 'lodash' -import * as tsm from 'ts-morph' -import { DiagnosticSeverity, Location, Range } from 'vscode-languageserver' +import type * as tsm from 'ts-morph' +import type { Location } from 'vscode-languageserver' +import { DiagnosticSeverity, Range } from 'vscode-languageserver' -import { BaseNode, CodeLensX, Definition, HoverX, Reference } from '../ide' +import type { CodeLensX, Definition, HoverX, Reference } from '../ide' +import { BaseNode } from '../ide' import { lazy } from '../x/decorators' import { prisma_parseEnvExpressionsInFile } from '../x/prisma' import { URL_file } from '../x/URL' import { Command_open } from '../x/vscode' +import type { ExtendedDiagnostic } from '../x/vscode-languageserver-types' import { - ExtendedDiagnostic, ExtendedDiagnostic_is, LocationLike_toHashLink, LocationLike_toLocation, } from '../x/vscode-languageserver-types' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' import { process_env_findAll } from './util/process_env' type EnvVarMap = Record diff --git a/packages/structure/src/model/RWFunction.ts b/packages/structure/src/model/RWFunction.ts index 12d691ebbdf8..397b0cac6163 100644 --- a/packages/structure/src/model/RWFunction.ts +++ b/packages/structure/src/model/RWFunction.ts @@ -1,6 +1,6 @@ import { FileNode } from '../ide' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' /** * functions exist in the /functions folder */ diff --git a/packages/structure/src/model/RWLayout.ts b/packages/structure/src/model/RWLayout.ts index 0e9d20b9a32a..7cd7f9f0206a 100644 --- a/packages/structure/src/model/RWLayout.ts +++ b/packages/structure/src/model/RWLayout.ts @@ -1,6 +1,6 @@ import { FileNode } from '../ide' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' /** * layouts live in the src/layouts folder */ diff --git a/packages/structure/src/model/RWPage.ts b/packages/structure/src/model/RWPage.ts index 3550cedffd94..0cab0858096b 100644 --- a/packages/structure/src/model/RWPage.ts +++ b/packages/structure/src/model/RWPage.ts @@ -5,7 +5,7 @@ import * as tsm from 'ts-morph' import { FileNode } from '../ide' import { lazy } from '../x/decorators' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' export class RWPage extends FileNode { constructor( diff --git a/packages/structure/src/model/RWProject.ts b/packages/structure/src/model/RWProject.ts index 7ab544b3f973..f82b169e1be1 100644 --- a/packages/structure/src/model/RWProject.ts +++ b/packages/structure/src/model/RWProject.ts @@ -5,7 +5,7 @@ import { getDMMF } from '@prisma/internals' import { getPaths, processPagesDir } from '@redwoodjs/project-config' -import { Host } from '../hosts' +import type { Host } from '../hosts' import { BaseNode } from '../ide' import { lazy, memo } from '../x/decorators' import { diff --git a/packages/structure/src/model/RWRoute.ts b/packages/structure/src/model/RWRoute.ts index fbe67fbd5f9a..5a66caa7a69a 100644 --- a/packages/structure/src/model/RWRoute.ts +++ b/packages/structure/src/model/RWRoute.ts @@ -1,10 +1,12 @@ import { basename } from 'path' import * as tsm from 'ts-morph' -import { Location, Range } from 'vscode-languageserver-types' +import type { Location } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' import { RWError } from '../errors' -import { BaseNode, Decoration, Definition, DocumentLinkX, HoverX } from '../ide' +import type { Decoration, Definition, DocumentLinkX, HoverX } from '../ide' +import { BaseNode } from '../ide' import { validateRoutePath } from '../util' import { lazy } from '../x/decorators' import { @@ -17,7 +19,7 @@ import { Range_fromNode, } from '../x/vscode-languageserver-types' -import { RWRouter } from './RWRouter' +import type { RWRouter } from './RWRouter' import { advanced_path_parser } from './util/advanced_path_parser' export class RWRoute extends BaseNode { diff --git a/packages/structure/src/model/RWRouter.ts b/packages/structure/src/model/RWRouter.ts index a7b2d777de4d..80aed75b6f8c 100644 --- a/packages/structure/src/model/RWRouter.ts +++ b/packages/structure/src/model/RWRouter.ts @@ -1,7 +1,6 @@ import * as tsm from 'ts-morph' +import type { CodeAction, CodeLens } from 'vscode-languageserver-types' import { - CodeAction, - CodeLens, Command, DiagnosticSeverity, Position, @@ -9,18 +8,19 @@ import { } from 'vscode-languageserver-types' import { RWError } from '../errors' -import { CodeLensX, FileNode } from '../ide' +import type { CodeLensX } from '../ide' +import { FileNode } from '../ide' import { iter } from '../x/Array' import { lazy, memo } from '../x/decorators' import { URL_file } from '../x/URL' +import type { ExtendedDiagnostic } from '../x/vscode-languageserver-types' import { err, - ExtendedDiagnostic, LocationLike_toLocation, Location_fromNode, } from '../x/vscode-languageserver-types' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' import { RWRoute } from './RWRoute' /** diff --git a/packages/structure/src/model/RWSDL.ts b/packages/structure/src/model/RWSDL.ts index 6d2691265d89..e40558e3561a 100644 --- a/packages/structure/src/model/RWSDL.ts +++ b/packages/structure/src/model/RWSDL.ts @@ -9,7 +9,7 @@ import { iter } from '../x/Array' import { lazy } from '../x/decorators' import { err } from '../x/vscode-languageserver-types' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' import { RWSDLField } from './RWSDLField' export class RWSDL extends FileNode { diff --git a/packages/structure/src/model/RWSDLField.ts b/packages/structure/src/model/RWSDLField.ts index 28bc57011ac3..c20973e3ddd4 100644 --- a/packages/structure/src/model/RWSDLField.ts +++ b/packages/structure/src/model/RWSDLField.ts @@ -1,27 +1,27 @@ -import { +import type { FieldDefinitionNode, ObjectTypeDefinitionNode, } from 'graphql/language/ast' +import type { CodeAction, Location } from 'vscode-languageserver-types' import { - CodeAction, DiagnosticSeverity, - Location, Position, WorkspaceChange, } from 'vscode-languageserver-types' import { RWError } from '../errors' -import { BaseNode, Implementation } from '../ide' +import type { Implementation } from '../ide' +import { BaseNode } from '../ide' import { lazy } from '../x/decorators' import { URL_file } from '../x/URL' +import type { ExtendedDiagnostic } from '../x/vscode-languageserver-types' import { - ExtendedDiagnostic, Location_fromNode, Position_fromTSMorphOffset, } from '../x/vscode-languageserver-types' -import { RWSDL } from './RWSDL' -import { RWServiceFunction } from './RWServiceFunction' +import type { RWSDL } from './RWSDL' +import type { RWServiceFunction } from './RWServiceFunction' export class RWSDLField extends BaseNode { constructor( diff --git a/packages/structure/src/model/RWService.ts b/packages/structure/src/model/RWService.ts index 449b5303a0aa..71a5967ec6f4 100644 --- a/packages/structure/src/model/RWService.ts +++ b/packages/structure/src/model/RWService.ts @@ -5,8 +5,8 @@ import { iter } from '../x/Array' import { lazy } from '../x/decorators' import { basenameNoExt } from '../x/path' -import { RWProject } from './RWProject' -import { RWSDL } from './RWSDL' +import type { RWProject } from './RWProject' +import type { RWSDL } from './RWSDL' import { RWServiceFunction } from './RWServiceFunction' export class RWService extends FileNode { diff --git a/packages/structure/src/model/RWServiceFunction.ts b/packages/structure/src/model/RWServiceFunction.ts index 34f2fc6aebfe..887022339fff 100644 --- a/packages/structure/src/model/RWServiceFunction.ts +++ b/packages/structure/src/model/RWServiceFunction.ts @@ -4,13 +4,11 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types' import { BaseNode } from '../ide' import { iter } from '../x/Array' import { lazy } from '../x/decorators' -import { - ExtendedDiagnostic, - Location_fromNode, -} from '../x/vscode-languageserver-types' +import type { ExtendedDiagnostic } from '../x/vscode-languageserver-types' +import { Location_fromNode } from '../x/vscode-languageserver-types' -import { RWSDLField } from './RWSDLField' -import { RWService } from './RWService' +import type { RWSDLField } from './RWSDLField' +import type { RWService } from './RWService' export class RWServiceFunction extends BaseNode { constructor( diff --git a/packages/structure/src/model/RWTOML.ts b/packages/structure/src/model/RWTOML.ts index 9b38e1b92e64..c12fdd66ab7e 100644 --- a/packages/structure/src/model/RWTOML.ts +++ b/packages/structure/src/model/RWTOML.ts @@ -1,11 +1,12 @@ -import { JsonMap, parse as parseTOML } from '@iarna/toml' +import type { JsonMap } from '@iarna/toml' +import { parse as parseTOML } from '@iarna/toml' import { Range } from 'vscode-languageserver-types' import { FileNode } from '../ide' import { lazy } from '../x/decorators' import { err } from '../x/vscode-languageserver-types' -import { RWProject } from './RWProject' +import type { RWProject } from './RWProject' export class RWTOML extends FileNode { constructor(public filePath: string, public parent: RWProject) { diff --git a/packages/structure/src/outline/outline.ts b/packages/structure/src/outline/outline.ts index dda8db8f625d..acf29cc41a6b 100644 --- a/packages/structure/src/outline/outline.ts +++ b/packages/structure/src/outline/outline.ts @@ -1,9 +1,10 @@ -import { FileNode } from '../ide' -import { RWProject } from '../model' -import { RWPage } from '../model/RWPage' -import { RWRoute } from '../model/RWRoute' +import type { FileNode } from '../ide' +import type { RWProject } from '../model' +import type { RWPage } from '../model/RWPage' +import type { RWRoute } from '../model/RWRoute' import { URL_file } from '../x/URL' -import { Command_cli, Command_open, TreeItem2 } from '../x/vscode' +import type { TreeItem2 } from '../x/vscode' +import { Command_cli, Command_open } from '../x/vscode' export function getOutline(project: RWProject): TreeItem2 { return { diff --git a/packages/structure/src/x/__tests__/vscode-languageserver-types-x.test.ts b/packages/structure/src/x/__tests__/vscode-languageserver-types-x.test.ts index fa7d583191a9..16ae77296f78 100644 --- a/packages/structure/src/x/__tests__/vscode-languageserver-types-x.test.ts +++ b/packages/structure/src/x/__tests__/vscode-languageserver-types-x.test.ts @@ -4,8 +4,8 @@ import { Range, } from 'vscode-languageserver-types' +import type { ExtendedDiagnostic } from '../vscode-languageserver-types' import { - ExtendedDiagnostic, ExtendedDiagnostic_format, Position_compare, Position_fromOffset, diff --git a/packages/structure/src/x/prisma.ts b/packages/structure/src/x/prisma.ts index 4e7f97fca982..7979c7051ab2 100644 --- a/packages/structure/src/x/prisma.ts +++ b/packages/structure/src/x/prisma.ts @@ -1,5 +1,6 @@ import { existsSync, readFileSync } from 'fs-extra' -import { Location, Range } from 'vscode-languageserver' +import type { Location } from 'vscode-languageserver' +import { Range } from 'vscode-languageserver' import { URL_file, URL_toFile } from './URL' import { Position_fromOffsetOrFail } from './vscode-languageserver-types' diff --git a/packages/structure/src/x/vscode-languageserver-types.ts b/packages/structure/src/x/vscode-languageserver-types.ts index 329ba297b9c6..c0f465df2182 100644 --- a/packages/structure/src/x/vscode-languageserver-types.ts +++ b/packages/structure/src/x/vscode-languageserver-types.ts @@ -1,19 +1,21 @@ import lc from 'line-column' import { groupBy, mapValues, uniqBy } from 'lodash' import * as tsm from 'ts-morph' -import { TextDocuments } from 'vscode-languageserver' -import { TextDocument } from 'vscode-languageserver-textdocument' -import { +import type { TextDocuments } from 'vscode-languageserver' +import type { TextDocument } from 'vscode-languageserver-textdocument' +import type { CodeAction, CodeActionContext, + DocumentUri, + WorkspaceEdit, +} from 'vscode-languageserver-types' +import { Diagnostic, DiagnosticSeverity, - DocumentUri, Location, Position, Range, WorkspaceChange, - WorkspaceEdit, } from 'vscode-languageserver-types' import { URL_file } from './URL' diff --git a/packages/structure/src/x/vscode-languageserver.ts b/packages/structure/src/x/vscode-languageserver.ts index bd4f02c2767e..8b93cd731cbe 100644 --- a/packages/structure/src/x/vscode-languageserver.ts +++ b/packages/structure/src/x/vscode-languageserver.ts @@ -1,4 +1,4 @@ -import { Connection } from 'vscode-languageserver' +import type { Connection } from 'vscode-languageserver' /** * will monkey patch the connection object diff --git a/packages/structure/src/x/vscode.ts b/packages/structure/src/x/vscode.ts index 11dd57f551de..9eaff026d702 100644 --- a/packages/structure/src/x/vscode.ts +++ b/packages/structure/src/x/vscode.ts @@ -4,9 +4,10 @@ // we only use it in type declarations // (we can't use "import type" since we need to do use it in some typeof expressions) import { memoize } from 'lodash' -import * as vscode from 'vscode' -import { Connection as LSPConnection } from 'vscode-languageserver' -import { Command, Location } from 'vscode-languageserver-types' +import type * as vscode from 'vscode' +import type { Connection as LSPConnection } from 'vscode-languageserver' +import type { Command } from 'vscode-languageserver-types' +import { Location } from 'vscode-languageserver-types' import { lazy, memo } from '../x/decorators' diff --git a/packages/studio/backend/fastify/plugins/withApiProxy.ts b/packages/studio/backend/fastify/plugins/withApiProxy.ts index 88fa93ecfeab..e07846cae68a 100644 --- a/packages/studio/backend/fastify/plugins/withApiProxy.ts +++ b/packages/studio/backend/fastify/plugins/withApiProxy.ts @@ -1,5 +1,6 @@ -import httpProxy, { FastifyHttpProxyOptions } from '@fastify/http-proxy' -import { FastifyInstance } from 'fastify' +import type { FastifyHttpProxyOptions } from '@fastify/http-proxy' +import httpProxy from '@fastify/http-proxy' +import type { FastifyInstance } from 'fastify' export interface ApiProxyOptions { apiUrl: string diff --git a/packages/studio/backend/fastify/react.ts b/packages/studio/backend/fastify/react.ts index 0f67a3ea0786..5602d685c6a3 100644 --- a/packages/studio/backend/fastify/react.ts +++ b/packages/studio/backend/fastify/react.ts @@ -1,7 +1,7 @@ import path from 'path' import fastifyStatic from '@fastify/static' -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' export default async function routes(fastify: FastifyInstance, _options: any) { fastify.register(fastifyStatic, { diff --git a/packages/studio/backend/fastify/spanIngester.ts b/packages/studio/backend/fastify/spanIngester.ts index 7b1f1e5a9c7f..8653777166d5 100644 --- a/packages/studio/backend/fastify/spanIngester.ts +++ b/packages/studio/backend/fastify/spanIngester.ts @@ -1,4 +1,4 @@ -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' import { getDatabase } from '../database' import { retypeSpan } from '../services/span' diff --git a/packages/studio/backend/fastify/yoga.ts b/packages/studio/backend/fastify/yoga.ts index 36f4b3d491a5..e91bf11ac8bf 100644 --- a/packages/studio/backend/fastify/yoga.ts +++ b/packages/studio/backend/fastify/yoga.ts @@ -1,6 +1,6 @@ -import { FastifyInstance } from 'fastify' +import type { FastifyInstance } from 'fastify' import type { FastifyRequest, FastifyReply } from 'fastify' -import { YogaServerInstance } from 'graphql-yoga' +import type { YogaServerInstance } from 'graphql-yoga' export default async function routes( fastify: FastifyInstance, diff --git a/packages/studio/backend/migrations.ts b/packages/studio/backend/migrations.ts index 99afb1569d4e..e580c9bb2d38 100644 --- a/packages/studio/backend/migrations.ts +++ b/packages/studio/backend/migrations.ts @@ -1,5 +1,5 @@ import type { Database } from 'sqlite' -import sqlite3 from 'sqlite3' +import type sqlite3 from 'sqlite3' import { getDatabase } from './database' diff --git a/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesBarChart.tsx b/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesBarChart.tsx index 1a7352125692..c3e90bd57795 100644 --- a/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesBarChart.tsx +++ b/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesBarChart.tsx @@ -1,15 +1,8 @@ import React, { useState } from 'react' import { useQuery, gql } from '@apollo/client' -import { - Color, - Card, - Select, - SelectItem, - Flex, - BarChart, - Title, -} from '@tremor/react' +import type { Color } from '@tremor/react' +import { Card, Select, SelectItem, Flex, BarChart, Title } from '@tremor/react' import LoadingSpinner from '../Components/LoadingSpinner' import ErrorPanel from '../Components/Panels/ErrorPanel' diff --git a/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesChart.tsx b/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesChart.tsx index 7e43ab6112d0..ca101ad8ad1d 100644 --- a/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesChart.tsx +++ b/packages/studio/frontend/src/Charts/SpanTypeTimeSeriesChart.tsx @@ -1,15 +1,8 @@ import React, { useState } from 'react' import { useQuery, gql } from '@apollo/client' -import { - Color, - Card, - Select, - SelectItem, - Flex, - LineChart, - Title, -} from '@tremor/react' +import type { Color } from '@tremor/react' +import { Card, Select, SelectItem, Flex, LineChart, Title } from '@tremor/react' import LoadingSpinner from '../Components/LoadingSpinner' import ErrorPanel from '../Components/Panels/ErrorPanel' diff --git a/packages/studio/frontend/src/Components/RedwoodGraphiQL/RedwoodGraphiQL.tsx b/packages/studio/frontend/src/Components/RedwoodGraphiQL/RedwoodGraphiQL.tsx index 01b9e6e1f04f..842f61e27f14 100644 --- a/packages/studio/frontend/src/Components/RedwoodGraphiQL/RedwoodGraphiQL.tsx +++ b/packages/studio/frontend/src/Components/RedwoodGraphiQL/RedwoodGraphiQL.tsx @@ -2,19 +2,13 @@ import 'json-bigint-patch' import React, { useMemo, useState } from 'react' import { useExplorerPlugin } from '@graphiql/plugin-explorer' -import { Fetcher, FetcherOpts, FetcherParams } from '@graphiql/toolkit' -import { - LoadFromUrlOptions, - SubscriptionProtocol, - UrlLoader, -} from '@graphql-tools/url-loader' -import { - GraphiQL, - GraphiQLInterface, - GraphiQLProps, - GraphiQLProvider, -} from 'graphiql' -import { DocumentNode, Kind, parse } from 'graphql' +import type { Fetcher, FetcherOpts, FetcherParams } from '@graphiql/toolkit' +import type { LoadFromUrlOptions } from '@graphql-tools/url-loader' +import { SubscriptionProtocol, UrlLoader } from '@graphql-tools/url-loader' +import type { GraphiQLProps } from 'graphiql' +import { GraphiQL, GraphiQLInterface, GraphiQLProvider } from 'graphiql' +import type { DocumentNode } from 'graphql' +import { Kind, parse } from 'graphql' import { useUrlSearchParams } from 'use-url-search-params' import 'graphiql/graphiql.css' diff --git a/packages/testing/src/api/directive.ts b/packages/testing/src/api/directive.ts index 28514d537ca2..478f01ce2ef9 100644 --- a/packages/testing/src/api/directive.ts +++ b/packages/testing/src/api/directive.ts @@ -1,4 +1,4 @@ -import { A } from 'ts-toolbelt' +import type { A } from 'ts-toolbelt' import type { DirectiveParams, diff --git a/packages/testing/src/api/scenario.ts b/packages/testing/src/api/scenario.ts index f08c0bb25733..bdd5f2f63a7d 100644 --- a/packages/testing/src/api/scenario.ts +++ b/packages/testing/src/api/scenario.ts @@ -1,4 +1,4 @@ -import { A } from 'ts-toolbelt' +import type { A } from 'ts-toolbelt' /** * Use this function to define your scenario. diff --git a/packages/testing/src/web/MockRouter.tsx b/packages/testing/src/web/MockRouter.tsx index feb1e66913d6..96b5f4c3acd8 100644 --- a/packages/testing/src/web/MockRouter.tsx +++ b/packages/testing/src/web/MockRouter.tsx @@ -1,11 +1,12 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import React from 'react' +import type React from 'react' // Bypass the `main` field in `package.json` because we alias `@redwoodjs/router` // for jest and Storybook. Not doing so would cause an infinite loop. // See: ./packages/testing/config/jest/web/jest-preset.js // @ts-ignore -import { isRoute, RouterProps } from '@redwoodjs/router/dist/router' +import type { RouterProps } from '@redwoodjs/router/dist/router' +import { isRoute } from '@redwoodjs/router/dist/router' import { flattenAll, replaceParams } from '@redwoodjs/router/dist/util' // @ts-ignore export * from '@redwoodjs/router/dist/index' diff --git a/packages/vite/src/buildFeServer.ts b/packages/vite/src/buildFeServer.ts index 9267602c1428..d9d5ec767b7a 100644 --- a/packages/vite/src/buildFeServer.ts +++ b/packages/vite/src/buildFeServer.ts @@ -1,7 +1,8 @@ import fs from 'fs/promises' import path from 'path' -import { build as esbuildBuild, PluginBuild } from 'esbuild' +import type { PluginBuild } from 'esbuild' +import { build as esbuildBuild } from 'esbuild' import type { Manifest as ViteBuildManifest } from 'vite' import { getRouteHookBabelPlugins } from '@redwoodjs/internal' @@ -12,7 +13,7 @@ import { getProjectRoutes } from '@redwoodjs/internal/dist/routes' import { getAppRouteHook, getConfig, getPaths } from '@redwoodjs/project-config' import { buildRscFeServer } from './buildRscFeServer' -import { RWRouteManifest } from './types' +import type { RWRouteManifest } from './types' import { ensureProcessDirWeb } from './utils' export interface BuildOptions { diff --git a/packages/vite/src/buildRscFeServer.ts b/packages/vite/src/buildRscFeServer.ts index e618bcc4034b..fbce125e5276 100644 --- a/packages/vite/src/buildRscFeServer.ts +++ b/packages/vite/src/buildRscFeServer.ts @@ -5,10 +5,10 @@ import react from '@vitejs/plugin-react' import { build as viteBuild } from 'vite' import type { Manifest as ViteBuildManifest } from 'vite' -import { RouteSpec } from '@redwoodjs/internal/dist/routes' +import type { RouteSpec } from '@redwoodjs/internal/dist/routes' import { rscBuild } from './rscBuild' -import { RWRouteManifest } from './types' +import type { RWRouteManifest } from './types' import { serverBuild } from './waku-lib/build-server' import { rscIndexPlugin } from './waku-lib/vite-plugin-rsc' diff --git a/packages/vite/src/fully-react/rwRscGlobal.ts b/packages/vite/src/fully-react/rwRscGlobal.ts index 1a54d996ecc8..1af3ba4fb6ba 100644 --- a/packages/vite/src/fully-react/rwRscGlobal.ts +++ b/packages/vite/src/fully-react/rwRscGlobal.ts @@ -1,4 +1,4 @@ -import { RwRscServerGlobal } from './RwRscServerGlobal' +import type { RwRscServerGlobal } from './RwRscServerGlobal' export { RwRscServerGlobal } from './RwRscServerGlobal' export { DevRwRscServerGlobal } from './DevRwRscServerGlobal' export { ProdRwRscServerGlobal } from './ProdRwRscServerGlobal' diff --git a/packages/vite/src/plugins/vite-plugin-jsx-loader.ts b/packages/vite/src/plugins/vite-plugin-jsx-loader.ts index 3349e4f6a712..f650a07acfc9 100644 --- a/packages/vite/src/plugins/vite-plugin-jsx-loader.ts +++ b/packages/vite/src/plugins/vite-plugin-jsx-loader.ts @@ -1,4 +1,5 @@ -import { PluginOption, transformWithEsbuild } from 'vite' +import type { PluginOption } from 'vite' +import { transformWithEsbuild } from 'vite' /** * diff --git a/packages/vite/src/runFeServer.ts b/packages/vite/src/runFeServer.ts index 3954cb5e6f9d..0f5b22cfbd18 100644 --- a/packages/vite/src/runFeServer.ts +++ b/packages/vite/src/runFeServer.ts @@ -16,7 +16,7 @@ import { getConfig, getPaths } from '@redwoodjs/project-config' import { createReactStreamingHandler } from './streaming/createReactStreamingHandler' import { registerFwGlobals } from './streaming/registerGlobals' -import { RWRouteManifest } from './types' +import type { RWRouteManifest } from './types' /** * TODO (STREAMING) diff --git a/packages/vite/src/streaming/streamHelpers.ts b/packages/vite/src/streaming/streamHelpers.ts index a51ccf727daf..ed72f5d11b3e 100644 --- a/packages/vite/src/streaming/streamHelpers.ts +++ b/packages/vite/src/streaming/streamHelpers.ts @@ -7,11 +7,11 @@ import { renderToPipeableStream, renderToString } from 'react-dom/server' import type { TagDescriptor } from '@redwoodjs/web' // @TODO (ESM), use exports field. Cannot import from web because of index exports +import type { RenderCallback } from '@redwoodjs/web/dist/components/ServerInject' import { ServerHtmlProvider, ServerInjectedHtml, createInjector, - RenderCallback, } from '@redwoodjs/web/dist/components/ServerInject' interface RenderToStreamArgs { diff --git a/packages/vite/src/streaming/triggerRouteHooks.ts b/packages/vite/src/streaming/triggerRouteHooks.ts index 285bcd0c6cd3..e1d1471f9ba9 100644 --- a/packages/vite/src/streaming/triggerRouteHooks.ts +++ b/packages/vite/src/streaming/triggerRouteHooks.ts @@ -1,5 +1,5 @@ -import { Request } from 'express' -import { ViteDevServer } from 'vite' +import type { Request } from 'express' +import type { ViteDevServer } from 'vite' import type { MetaHook, diff --git a/packages/vite/src/waku-lib/rsc-handler-worker.ts b/packages/vite/src/waku-lib/rsc-handler-worker.ts index 31efb10c4991..9bdaa6ff0a29 100644 --- a/packages/vite/src/waku-lib/rsc-handler-worker.ts +++ b/packages/vite/src/waku-lib/rsc-handler-worker.ts @@ -1,7 +1,7 @@ // TODO (RSC) Take ownership of this file and move it out ouf the waku-lib folder // import fs from 'node:fs' import path from 'node:path' -import { Writable } from 'node:stream' +import type { Writable } from 'node:stream' import { parentPort } from 'node:worker_threads' import { createElement } from 'react' @@ -11,7 +11,7 @@ import { createServer } from 'vite' import { getPaths } from '@redwoodjs/project-config' -import { defineEntries } from '../entries' +import type { defineEntries } from '../entries' // import type { unstable_GetCustomModules } from '../waku-server' import { configFileConfig, resolveConfig } from './config' diff --git a/packages/web/src/apollo/index.tsx b/packages/web/src/apollo/index.tsx index d7060fdd6876..baf9cafeefb5 100644 --- a/packages/web/src/apollo/index.tsx +++ b/packages/web/src/apollo/index.tsx @@ -22,7 +22,8 @@ const { setLogVerbosity: apolloSetLogVerbosity, } = apolloClient -import { UseAuth, useNoAuth } from '@redwoodjs/auth' +import type { UseAuth } from '@redwoodjs/auth' +import { useNoAuth } from '@redwoodjs/auth' import './typeOverride' import { diff --git a/packages/web/src/apollo/sseLink.tsx b/packages/web/src/apollo/sseLink.tsx index f168b6e28b69..7d3be3da95c9 100644 --- a/packages/web/src/apollo/sseLink.tsx +++ b/packages/web/src/apollo/sseLink.tsx @@ -1,12 +1,9 @@ import type { HttpOptions } from '@apollo/client' -import { - ApolloLink, - Operation, - FetchResult, - Observable, -} from '@apollo/client/core' +import type { Operation, FetchResult } from '@apollo/client/core' +import { ApolloLink, Observable } from '@apollo/client/core' import { print } from 'graphql' -import { createClient, ClientOptions, Client } from 'graphql-sse' +import type { ClientOptions, Client } from 'graphql-sse' +import { createClient } from 'graphql-sse' interface SSELinkOptions extends Partial { url: string auth: { authProviderType: string; tokenFn: () => Promise } diff --git a/packages/web/src/apollo/suspense.tsx b/packages/web/src/apollo/suspense.tsx index fdbd508b619a..937952140779 100644 --- a/packages/web/src/apollo/suspense.tsx +++ b/packages/web/src/apollo/suspense.tsx @@ -12,9 +12,9 @@ import type { HttpOptions, InMemoryCacheConfig, setLogVerbosity, + ApolloLink, } from '@apollo/client' import { - ApolloLink, setLogVerbosity as apolloSetLogVerbosity, useMutation, useSubscription, @@ -26,7 +26,8 @@ import { useSuspenseQuery, } from '@apollo/experimental-nextjs-app-support/ssr' -import { UseAuth, useNoAuth } from '@redwoodjs/auth' +import type { UseAuth } from '@redwoodjs/auth' +import { useNoAuth } from '@redwoodjs/auth' import './typeOverride' import { diff --git a/packages/web/src/components/CellCacheContext.tsx b/packages/web/src/components/CellCacheContext.tsx index 9f9e3712face..c18ba01807d7 100644 --- a/packages/web/src/components/CellCacheContext.tsx +++ b/packages/web/src/components/CellCacheContext.tsx @@ -1,6 +1,6 @@ import React, { createContext, useContext } from 'react' -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' export interface QueryInfo { query: DocumentNode diff --git a/packages/web/src/components/FetchConfigProvider.tsx b/packages/web/src/components/FetchConfigProvider.tsx index 17459d6f67ce..b79e992c3d07 100644 --- a/packages/web/src/components/FetchConfigProvider.tsx +++ b/packages/web/src/components/FetchConfigProvider.tsx @@ -1,6 +1,7 @@ import React from 'react' -import { UseAuth, useNoAuth } from '@redwoodjs/auth' +import type { UseAuth } from '@redwoodjs/auth' +import { useNoAuth } from '@redwoodjs/auth' export const getApiGraphQLUrl = () => { return globalThis.RWJS_API_GRAPHQL_URL diff --git a/packages/web/src/components/GraphQLHooksProvider.tsx b/packages/web/src/components/GraphQLHooksProvider.tsx index db9e985cb586..8933a4045d63 100644 --- a/packages/web/src/components/GraphQLHooksProvider.tsx +++ b/packages/web/src/components/GraphQLHooksProvider.tsx @@ -1,4 +1,4 @@ -import { OperationVariables } from '@apollo/client' +import type { OperationVariables } from '@apollo/client' import type { DocumentNode } from 'graphql' type DefaultUseQueryType = < diff --git a/packages/web/src/components/ServerInject.tsx b/packages/web/src/components/ServerInject.tsx index 1e1819243dfd..ae5e5b214c71 100644 --- a/packages/web/src/components/ServerInject.tsx +++ b/packages/web/src/components/ServerInject.tsx @@ -1,4 +1,5 @@ -import React, { Fragment, ReactNode, useContext, useId } from 'react' +import type { ReactNode } from 'react' +import React, { Fragment, useContext, useId } from 'react' /** * diff --git a/packages/web/src/components/createCell.tsx b/packages/web/src/components/createCell.tsx index 88bc7e5123fc..1b6f80728d92 100644 --- a/packages/web/src/components/createCell.tsx +++ b/packages/web/src/components/createCell.tsx @@ -1,6 +1,7 @@ -import { ComponentProps, JSXElementConstructor, Suspense } from 'react' +import type { ComponentProps, JSXElementConstructor } from 'react' +import { Suspense } from 'react' -import { OperationVariables } from '@apollo/client' +import type { OperationVariables } from '@apollo/client' import type { DocumentNode } from 'graphql' import type { A } from 'ts-toolbelt' diff --git a/packages/web/src/graphql.ts b/packages/web/src/graphql.ts index b2ba47035eb3..baef34c3c177 100644 --- a/packages/web/src/graphql.ts +++ b/packages/web/src/graphql.ts @@ -1,4 +1,4 @@ -import { DocumentNode } from 'graphql' +import type { DocumentNode } from 'graphql' /** * Given a query like the one below this function will return diff --git a/packages/web/src/routeHooks.types.ts b/packages/web/src/routeHooks.types.ts index b282ec3db667..4337e669336c 100644 --- a/packages/web/src/routeHooks.types.ts +++ b/packages/web/src/routeHooks.types.ts @@ -1,4 +1,4 @@ -import { TagDescriptor } from './components/htmlTags' +import type { TagDescriptor } from './components/htmlTags' export type RouteHookOutput = { meta: TagDescriptor[] From 500dec7c93029db0d81141783d89a2466bf48829 Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Mon, 28 Aug 2023 23:33:29 -0400 Subject: [PATCH 03/11] fix(eslint): fix `@typescript-eslint/consistent-type-imports` errors ``` /code/redwood/packages/vite/src/fully-react/find-styles.ts 6:9 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 7:9 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 8:13 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 14:28 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports ``` --- packages/vite/src/fully-react/find-styles.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/fully-react/find-styles.ts b/packages/vite/src/fully-react/find-styles.ts index cdab15e02f0e..81b7903a3583 100644 --- a/packages/vite/src/fully-react/find-styles.ts +++ b/packages/vite/src/fully-react/find-styles.ts @@ -3,15 +3,15 @@ import path from 'node:path' import type { ModuleNode, ViteDevServer } from 'vite' async function find_deps( - vite: import('vite').ViteDevServer, - node: import('vite').ModuleNode, - deps: Set + vite: ViteDevServer, + node: ModuleNode, + deps: Set ) { // since `ssrTransformResult.deps` contains URLs instead of `ModuleNode`s, this process is asynchronous. // instead of using `await`, we resolve all branches in parallel. const branches: Promise[] = [] - async function add(node: import('vite').ModuleNode) { + async function add(node: ModuleNode) { if (!deps.has(node)) { deps.add(node) await find_deps(vite, node, deps) From 44f8dd2a8868b74237033a32ed0c6fade9d39c4c Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 13:24:06 -0400 Subject: [PATCH 04/11] =?UTF-8?q?chore:=20=F0=9F=A4=B7=F0=9F=8F=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/eslint-config/package.json | 1 + yarn.lock | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 2c398ec5ac2f..9e1cffe6c2c8 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -15,6 +15,7 @@ "@babel/core": "7.22.10", "@babel/eslint-parser": "7.22.10", "@babel/eslint-plugin": "7.22.10", + "@redwoodjs/babel-config": "0.0.1", "@redwoodjs/eslint-plugin": "6.0.7", "@redwoodjs/internal": "6.0.7", "@redwoodjs/project-config": "6.0.7", diff --git a/yarn.lock b/yarn.lock index 041c4b855536..6954ec916c1e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7864,6 +7864,31 @@ __metadata: languageName: unknown linkType: soft +"@redwoodjs/babel-config@npm:0.0.1": + version: 0.0.1 + resolution: "@redwoodjs/babel-config@npm:0.0.1" + dependencies: + "@babel/core": 7.22.10 + "@babel/plugin-transform-class-properties": 7.22.5 + "@babel/plugin-transform-private-methods": 7.22.5 + "@babel/plugin-transform-private-property-in-object": 7.22.5 + "@babel/plugin-transform-runtime": 7.22.10 + "@babel/preset-env": 7.22.10 + "@babel/preset-react": 7.22.5 + "@babel/preset-typescript": 7.22.5 + "@babel/register": 7.22.5 + "@babel/runtime-corejs3": 7.22.10 + "@redwoodjs/project-config": 6.0.7 + "@redwoodjs/structure": 6.0.7 + babel-plugin-auto-import: 1.1.0 + babel-plugin-graphql-tag: 3.3.0 + babel-plugin-module-resolver: 5.0.0 + core-js: 3.32.0 + fast-glob: 3.3.1 + checksum: ae1250523289a72d0cf2105213846597e76471543a9be80155eb7adc444377729e4e370638a10f4b3e9a0074c12217c2f79ba4e5696e3229725c568a64739772 + languageName: node + linkType: hard + "@redwoodjs/cli-data-migrate@workspace:packages/cli-packages/dataMigrate": version: 0.0.0-use.local resolution: "@redwoodjs/cli-data-migrate@workspace:packages/cli-packages/dataMigrate" @@ -8121,6 +8146,7 @@ __metadata: "@babel/core": 7.22.10 "@babel/eslint-parser": 7.22.10 "@babel/eslint-plugin": 7.22.10 + "@redwoodjs/babel-config": 0.0.1 "@redwoodjs/eslint-plugin": 6.0.7 "@redwoodjs/internal": 6.0.7 "@redwoodjs/project-config": 6.0.7 From aa72a983368ed29fe0823eb1e7d69e7675c0baa1 Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 13:24:19 -0400 Subject: [PATCH 05/11] chore: run `yarn lint:fix` --- packages/cli-packages/dataMigrate/src/commands/up.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli-packages/dataMigrate/src/commands/up.ts b/packages/cli-packages/dataMigrate/src/commands/up.ts index 5f966fd53c1f..b998c4a55e49 100644 --- a/packages/cli-packages/dataMigrate/src/commands/up.ts +++ b/packages/cli-packages/dataMigrate/src/commands/up.ts @@ -4,7 +4,7 @@ import type { Argv } from 'yargs' import { recordTelemetryAttributes } from '@redwoodjs/cli-helpers' import { getPaths } from '@redwoodjs/project-config' -import { DataMigrateUpOptions } from '../types' +import type { DataMigrateUpOptions } from '../types' export const command = 'up' export const description = From 1ab00a66dec3738722cf7afa94eef24d1a6f2805 Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 13:46:26 -0400 Subject: [PATCH 06/11] =?UTF-8?q?Revert=20"chore:=20=F0=9F=A4=B7?= =?UTF-8?q?=F0=9F=8F=BC"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 44f8dd2a8868b74237033a32ed0c6fade9d39c4c. --- packages/eslint-config/package.json | 1 - yarn.lock | 26 -------------------------- 2 files changed, 27 deletions(-) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 9e1cffe6c2c8..2c398ec5ac2f 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -15,7 +15,6 @@ "@babel/core": "7.22.10", "@babel/eslint-parser": "7.22.10", "@babel/eslint-plugin": "7.22.10", - "@redwoodjs/babel-config": "0.0.1", "@redwoodjs/eslint-plugin": "6.0.7", "@redwoodjs/internal": "6.0.7", "@redwoodjs/project-config": "6.0.7", diff --git a/yarn.lock b/yarn.lock index 6954ec916c1e..041c4b855536 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7864,31 +7864,6 @@ __metadata: languageName: unknown linkType: soft -"@redwoodjs/babel-config@npm:0.0.1": - version: 0.0.1 - resolution: "@redwoodjs/babel-config@npm:0.0.1" - dependencies: - "@babel/core": 7.22.10 - "@babel/plugin-transform-class-properties": 7.22.5 - "@babel/plugin-transform-private-methods": 7.22.5 - "@babel/plugin-transform-private-property-in-object": 7.22.5 - "@babel/plugin-transform-runtime": 7.22.10 - "@babel/preset-env": 7.22.10 - "@babel/preset-react": 7.22.5 - "@babel/preset-typescript": 7.22.5 - "@babel/register": 7.22.5 - "@babel/runtime-corejs3": 7.22.10 - "@redwoodjs/project-config": 6.0.7 - "@redwoodjs/structure": 6.0.7 - babel-plugin-auto-import: 1.1.0 - babel-plugin-graphql-tag: 3.3.0 - babel-plugin-module-resolver: 5.0.0 - core-js: 3.32.0 - fast-glob: 3.3.1 - checksum: ae1250523289a72d0cf2105213846597e76471543a9be80155eb7adc444377729e4e370638a10f4b3e9a0074c12217c2f79ba4e5696e3229725c568a64739772 - languageName: node - linkType: hard - "@redwoodjs/cli-data-migrate@workspace:packages/cli-packages/dataMigrate": version: 0.0.0-use.local resolution: "@redwoodjs/cli-data-migrate@workspace:packages/cli-packages/dataMigrate" @@ -8146,7 +8121,6 @@ __metadata: "@babel/core": 7.22.10 "@babel/eslint-parser": 7.22.10 "@babel/eslint-plugin": 7.22.10 - "@redwoodjs/babel-config": 0.0.1 "@redwoodjs/eslint-plugin": 6.0.7 "@redwoodjs/internal": 6.0.7 "@redwoodjs/project-config": 6.0.7 From 0a80bfb7c96a516be216906eeaf2f87d658358ef Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 16:00:21 -0400 Subject: [PATCH 07/11] fix: move rule out of `shared.js` was mean just for `RWFW` see: https://github.com/redwoodjs/redwood/pull/9082#discussion_r1309279582 --- .eslintrc.js | 1 + packages/eslint-config/shared.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 25071d1a45ee..9b55fe3e057f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -33,6 +33,7 @@ module.exports = { rules: { '@typescript-eslint/no-explicit-any': 'off', curly: 'error', + '@typescript-eslint/consistent-type-imports': 'error', }, env: { // We use the most modern environment available. Then we rely on Babel to diff --git a/packages/eslint-config/shared.js b/packages/eslint-config/shared.js index 3e4e02658f2d..ae75aebcafc0 100644 --- a/packages/eslint-config/shared.js +++ b/packages/eslint-config/shared.js @@ -143,7 +143,6 @@ module.exports = { ], }, ], - '@typescript-eslint/consistent-type-imports': 'error', }, overrides: [ { From ba7571bc9c54bd4afaa6bc430f06c1813754b8df Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 16:25:34 -0400 Subject: [PATCH 08/11] chore: rebuild test fixture ran `yarn rebuild-test-project-fixture` --- .../api/src/directives/requireAuth/requireAuth.ts | 6 ++---- __fixtures__/test-project/web/package.json | 2 +- .../web/src/components/Author/Author.stories.tsx | 6 +----- .../web/src/pages/BlogPostPage/BlogPostPage.stories.tsx | 6 +----- .../web/src/pages/WaterfallPage/WaterfallPage.stories.tsx | 4 +--- __fixtures__/test-project/web/vite.config.ts | 3 ++- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/__fixtures__/test-project/api/src/directives/requireAuth/requireAuth.ts b/__fixtures__/test-project/api/src/directives/requireAuth/requireAuth.ts index 59daccb5b79f..77b31a70ae07 100644 --- a/__fixtures__/test-project/api/src/directives/requireAuth/requireAuth.ts +++ b/__fixtures__/test-project/api/src/directives/requireAuth/requireAuth.ts @@ -1,9 +1,7 @@ import gql from 'graphql-tag' -import { - createValidatorDirective, - ValidatorDirectiveFunc, -} from '@redwoodjs/graphql-server' +import type { ValidatorDirectiveFunc } from '@redwoodjs/graphql-server' +import { createValidatorDirective } from '@redwoodjs/graphql-server' import { requireAuth as applicationRequireAuth } from 'src/lib/auth' diff --git a/__fixtures__/test-project/web/package.json b/__fixtures__/test-project/web/package.json index e6a8bd5c7ff6..57400c477040 100644 --- a/__fixtures__/test-project/web/package.json +++ b/__fixtures__/test-project/web/package.json @@ -23,7 +23,7 @@ "devDependencies": { "@redwoodjs/vite": "6.0.7", "autoprefixer": "^10.4.15", - "postcss": "^8.4.28", + "postcss": "^8.4.29", "postcss-loader": "^7.3.3", "prettier-plugin-tailwindcss": "0.4.1", "tailwindcss": "^3.3.3" diff --git a/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx b/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx index 5c0f8da3d9c8..d4088a3ac6ce 100644 --- a/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx +++ b/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx @@ -27,8 +27,4 @@ const author = { fullName: 'Story User', } -export const Primary: Story = { - render: () => { - return - } -} +export const Primary: Story = {} diff --git a/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx b/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx index 43074d5880a5..6f7867b5c317 100644 --- a/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx +++ b/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx @@ -10,8 +10,4 @@ export default meta type Story = StoryObj -export const Primary: Story = { - render: (args) => { - return - } -} +export const Primary: Story = {} diff --git a/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx b/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx index ee6a1601562c..b97c5e54151f 100644 --- a/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx +++ b/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx @@ -10,6 +10,4 @@ export default meta type Story = StoryObj -export const Primary: Story = { - render: (args) => , -} +export const Primary: Story = {} diff --git a/__fixtures__/test-project/web/vite.config.ts b/__fixtures__/test-project/web/vite.config.ts index 9f02cb335e2a..f7885f0a1336 100644 --- a/__fixtures__/test-project/web/vite.config.ts +++ b/__fixtures__/test-project/web/vite.config.ts @@ -1,6 +1,7 @@ import dns from 'dns' -import { defineConfig, UserConfig } from 'vite' +import type { UserConfig } from 'vite' +import { defineConfig } from 'vite' // See: https://vitejs.dev/config/server-options.html#server-host // So that Vite will load on local instead of 127.0.0.1 From 9d65f1098c24797546c1d91896e58f7a29104aea Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Tue, 29 Aug 2023 22:39:54 -0400 Subject: [PATCH 09/11] revert: keep the stories in test fixture the way they are see also: * https://github.com/redwoodjs/redwood/pull/9082#pullrequestreview-1601281234 * https://github.com/redwoodjs/redwood/pull/9082#discussion_r1309354228 * https://github.com/redwoodjs/redwood/pull/9082/files/ba7571bc9c54bd4afaa6bc430f06c1813754b8df#r1309354325 * https://github.com/redwoodjs/redwood/pull/9082/files/ba7571bc9c54bd4afaa6bc430f06c1813754b8df#r1309354387 --- .../web/src/components/Author/Author.stories.tsx | 6 +++++- .../web/src/pages/BlogPostPage/BlogPostPage.stories.tsx | 6 +++++- .../web/src/pages/WaterfallPage/WaterfallPage.stories.tsx | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx b/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx index d4088a3ac6ce..5c0f8da3d9c8 100644 --- a/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx +++ b/__fixtures__/test-project/web/src/components/Author/Author.stories.tsx @@ -27,4 +27,8 @@ const author = { fullName: 'Story User', } -export const Primary: Story = {} +export const Primary: Story = { + render: () => { + return + } +} diff --git a/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx b/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx index 6f7867b5c317..43074d5880a5 100644 --- a/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx +++ b/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx @@ -10,4 +10,8 @@ export default meta type Story = StoryObj -export const Primary: Story = {} +export const Primary: Story = { + render: (args) => { + return + } +} diff --git a/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx b/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx index b97c5e54151f..ee6a1601562c 100644 --- a/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx +++ b/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx @@ -10,4 +10,6 @@ export default meta type Story = StoryObj -export const Primary: Story = {} +export const Primary: Story = { + render: (args) => , +} From e1dea96b3448c20787406d0810ffa57a5c328365 Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Wed, 30 Aug 2023 23:40:11 -0400 Subject: [PATCH 10/11] chore(eslint): run `yarn lint:fix` --- .../src/plugins/babel-plugin-redwood-mock-cell-data.ts | 2 +- packages/web/src/components/cell/cellTypes.tsx | 2 +- packages/web/src/components/cell/createCell.tsx | 2 +- packages/web/src/components/cell/createSuspendingCell.tsx | 8 +++++--- packages/web/src/components/cell/isCellEmpty.tsx | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/babel-config/src/plugins/babel-plugin-redwood-mock-cell-data.ts b/packages/babel-config/src/plugins/babel-plugin-redwood-mock-cell-data.ts index 51ea30fd19e9..e7d6dcaca809 100644 --- a/packages/babel-config/src/plugins/babel-plugin-redwood-mock-cell-data.ts +++ b/packages/babel-config/src/plugins/babel-plugin-redwood-mock-cell-data.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' -import { types } from '@babel/core' +import type { types } from '@babel/core' import type { PluginObj } from '@babel/core' import { parse as babelParse } from '@babel/parser' import type { ParserPlugin } from '@babel/parser' diff --git a/packages/web/src/components/cell/cellTypes.tsx b/packages/web/src/components/cell/cellTypes.tsx index fa352cc3805d..91e903b45e3b 100644 --- a/packages/web/src/components/cell/cellTypes.tsx +++ b/packages/web/src/components/cell/cellTypes.tsx @@ -1,4 +1,4 @@ -import { ComponentProps, JSXElementConstructor } from 'react' +import type { ComponentProps, JSXElementConstructor } from 'react' import type { ApolloClient, diff --git a/packages/web/src/components/cell/createCell.tsx b/packages/web/src/components/cell/createCell.tsx index 74f5479559b1..41ffd5d9dc34 100644 --- a/packages/web/src/components/cell/createCell.tsx +++ b/packages/web/src/components/cell/createCell.tsx @@ -5,7 +5,7 @@ import { getOperationName } from '../../graphql' import { useQuery } from '../GraphQLHooksProvider' import { useCellCacheContext } from './CellCacheContext' -import { CreateCellProps } from './cellTypes' +import type { CreateCellProps } from './cellTypes' import { createSuspendingCell } from './createSuspendingCell' import { isDataEmpty } from './isCellEmpty' diff --git a/packages/web/src/components/cell/createSuspendingCell.tsx b/packages/web/src/components/cell/createSuspendingCell.tsx index e4574ff7b435..d65c27b6c8d4 100644 --- a/packages/web/src/components/cell/createSuspendingCell.tsx +++ b/packages/web/src/components/cell/createSuspendingCell.tsx @@ -1,14 +1,16 @@ import { Suspense } from 'react' -import { QueryReference, useApolloClient } from '@apollo/client' +import type { QueryReference } from '@apollo/client' +import { useApolloClient } from '@apollo/client' import { useBackgroundQuery, useReadQuery } from '../GraphQLHooksProvider' /** * This is part of how we let users swap out their GraphQL client while staying compatible with Cells. */ -import { CellErrorBoundary, FallbackProps } from './CellErrorBoundary' -import { +import type { FallbackProps } from './CellErrorBoundary' +import { CellErrorBoundary } from './CellErrorBoundary' +import type { CreateCellProps, DataObject, SuperSuccessProps, diff --git a/packages/web/src/components/cell/isCellEmpty.tsx b/packages/web/src/components/cell/isCellEmpty.tsx index 1615c1674252..ff866bee78fd 100644 --- a/packages/web/src/components/cell/isCellEmpty.tsx +++ b/packages/web/src/components/cell/isCellEmpty.tsx @@ -1,4 +1,4 @@ -import { DataObject } from './cellTypes' +import type { DataObject } from './cellTypes' /** * The default `isEmpty` implementation. Checks if any of the field is `null` or an empty array. From a3ad87d271b882b724f10539618fa3d7283382ea Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Sat, 2 Sep 2023 10:29:35 -0400 Subject: [PATCH 11/11] chore(eslint): run `yarn lint:fix` --- packages/mailer/core/src/__tests__/mailer.test.ts | 2 +- packages/mailer/handlers/in-memory/src/index.ts | 4 ++-- packages/mailer/renderers/mjml-react/src/index.ts | 4 ++-- packages/mailer/renderers/react-email/src/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/mailer/core/src/__tests__/mailer.test.ts b/packages/mailer/core/src/__tests__/mailer.test.ts index f5f34709f693..b7dd65541818 100644 --- a/packages/mailer/core/src/__tests__/mailer.test.ts +++ b/packages/mailer/core/src/__tests__/mailer.test.ts @@ -1,7 +1,7 @@ import { AbstractMailHandler } from '../handler' import { Mailer } from '../mailer' import { AbstractMailRenderer } from '../renderer' -import { +import type { MailRenderedContent, MailSendOptionsComplete, MailUtilities, diff --git a/packages/mailer/handlers/in-memory/src/index.ts b/packages/mailer/handlers/in-memory/src/index.ts index dc3aa7648d95..4928d2fadefd 100644 --- a/packages/mailer/handlers/in-memory/src/index.ts +++ b/packages/mailer/handlers/in-memory/src/index.ts @@ -1,10 +1,10 @@ -import { +import type { MailSendOptionsComplete, - AbstractMailHandler, MailUtilities, MailRenderedContent, MailResult, } from '@redwoodjs/mailer-core' +import { AbstractMailHandler } from '@redwoodjs/mailer-core' export type InMemoryMail = { textContent: MailRenderedContent['text'] diff --git a/packages/mailer/renderers/mjml-react/src/index.ts b/packages/mailer/renderers/mjml-react/src/index.ts index f7128de386ed..7d6244a0caf3 100644 --- a/packages/mailer/renderers/mjml-react/src/index.ts +++ b/packages/mailer/renderers/mjml-react/src/index.ts @@ -1,12 +1,12 @@ import { renderToMjml } from '@faire/mjml-react/utils/renderToMjml' import mjml2html from 'mjml' -import { +import type { MailRenderedContent, MailUtilities, - AbstractMailRenderer, MailRendererOptions, } from '@redwoodjs/mailer-core' +import { AbstractMailRenderer } from '@redwoodjs/mailer-core' export type SupportedOutputFormats = 'html' export type RendererOptions = MailRendererOptions & diff --git a/packages/mailer/renderers/react-email/src/index.ts b/packages/mailer/renderers/react-email/src/index.ts index 2e9cffee9a6f..98f08413494b 100644 --- a/packages/mailer/renderers/react-email/src/index.ts +++ b/packages/mailer/renderers/react-email/src/index.ts @@ -1,11 +1,11 @@ import { render as reactEmailRender } from '@react-email/render' -import { +import type { MailRenderedContent, MailUtilities, - AbstractMailRenderer, MailRendererOptions, } from '@redwoodjs/mailer-core' +import { AbstractMailRenderer } from '@redwoodjs/mailer-core' export type SupportedOutputFormats = 'both' | 'html' | 'text' export type RendererOptions = MailRendererOptions &