Skip to content

Commit

Permalink
chore: enable tsconfig verbatimModuleSyntax and fix type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Feb 14, 2025
1 parent e232ce7 commit ef726d2
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"verbatimModuleSyntax": false, // @todo Enable this.
"verbatimModuleSyntax": true,

// Language and Environment
"jsx": "react",
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/blocks/core-media-text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type ComponentProps, PropsWithChildren } from 'react';
import React, { type ComponentProps, type PropsWithChildren } from 'react';
import {
type BlockData,
cn,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config/snapwp-config-manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use snapWPConfig';
import { isValidUrl, generateGraphqlUrl } from '@/utils';
import { Logger } from '@/logger';
import { BlockDefinitions } from '@/props';
import type { BlockDefinitions } from '@/props';

export interface SnapWPEnv {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getConfig,
setConfig,
getGraphqlUrl,
SnapWPEnv,
type SnapWPEnv,
} from '@/config/snapwp-config-manager';
const SnapWPConfigManager = _private.SnapWPConfigManager!;

Expand Down
8 changes: 4 additions & 4 deletions packages/next/src/components/image.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {
CSSProperties,
ImgHTMLAttributes,
PropsWithoutRef,
type CSSProperties,
type ImgHTMLAttributes,
type PropsWithoutRef,
} from 'react';
import NextImage, { ImageProps } from 'next/image';
import NextImage, { type ImageProps } from 'next/image';
import { cn } from '@snapwp/core';
import { getConfig } from '@snapwp/core/config';

Expand Down
8 changes: 4 additions & 4 deletions packages/next/src/components/link.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {
AnchorHTMLAttributes,
CSSProperties,
PropsWithChildren,
type AnchorHTMLAttributes,
type CSSProperties,
type PropsWithChildren,
} from 'react';
import { replaceHostUrl } from '@snapwp/core';
import { getConfig } from '@snapwp/core/config';
import NextLink, { LinkProps } from 'next/link';
import NextLink, { type LinkProps } from 'next/link';

interface LinkInterface {
href: string;
Expand Down
10 changes: 7 additions & 3 deletions packages/next/src/middleware/cors.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { NextResponse } from 'next/server';
import type { NextFetchEvent, NextMiddleware, NextRequest } from 'next/server';
import {
NextResponse,
type NextFetchEvent,
type NextMiddleware,
type NextRequest,
} from 'next/server';
import { getConfig } from '@snapwp/core/config';
import { MiddlewareFactory } from './utils';
import type { MiddlewareFactory } from './utils';

/**
* Facilitates proxying resources from WP resources. Any request with `corsProxyPrefix`
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/middleware/current-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type NextRequest, NextFetchEvent, NextMiddleware } from 'next/server';
import { MiddlewareFactory } from './utils';
import type { NextFetchEvent, NextRequest, NextMiddleware } from 'next/server';
import type { MiddlewareFactory } from './utils';

/**
* Middleware function for Next.js
Expand Down
8 changes: 4 additions & 4 deletions packages/next/src/middleware/proxies.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
type NextRequest,
NextMiddleware,
NextFetchEvent,
NextResponse,
type NextRequest,
type NextMiddleware,
type NextFetchEvent,
} from 'next/server';
import { MiddlewareFactory } from './utils';
import { getConfig } from '@snapwp/core/config';
import { addTrailingSlash } from '@snapwp/core';
import type { MiddlewareFactory } from './utils';

/**
* Middleware function for Next.js
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/middleware/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextMiddleware, NextResponse } from 'next/server';
import { NextResponse, type NextMiddleware } from 'next/server';
import { proxies } from './proxies';
import { currentPath as cm } from './current-path';
import { corsProxyMiddleware } from './cors';
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/root-layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren } from 'react';
import React, { type PropsWithChildren } from 'react';
import { QueryEngine } from '@snapwp/query';
import { GlobalHead } from './global-head';

Expand All @@ -25,7 +25,7 @@ export async function RootLayout( {
<head>
<GlobalHead { ...globalHeadProps } />
</head>
{ /* suppressHydrationWarning is addes to suppress warnings when classes for body are updated on the client */ }
{ /* suppressHydrationWarning is added to suppress warnings when classes for body are updated on the client */ }
<body suppressHydrationWarning={ true }>{ children }</body>
</html>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/query/src/query-engine/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { getGraphqlUrl, getConfig } from '@snapwp/core/config';
import { TemplateData, GlobalHeadProps } from '@snapwp/core';
import {
GetCurrentTemplateDocument,
GetGlobalStylesDocument,
} from '@graphqlTypes/graphql';
import {
ApolloClient,
InMemoryCache,
NormalizedCacheObject,
type NormalizedCacheObject,
} from '@apollo/client';
import parseTemplate from '@/utils/parse-template';
import parseGlobalStyles from '@/utils/parse-global-styles';
import type { TemplateData, GlobalHeadProps } from '@snapwp/core';

/**
* Singleton class to handle GraphQL queries using Apollo.
Expand Down
6 changes: 3 additions & 3 deletions packages/query/src/utils/parse-global-styles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ApolloQueryResult } from '@apollo/client';
import { GetGlobalStylesQuery } from '@graphqlTypes/graphql';
import {
type GlobalHeadProps,
GlobalStylesParseError,
Logger,
type GlobalHeadProps,
} from '@snapwp/core';
import type { ApolloQueryResult } from '@apollo/client';
import type { GetGlobalStylesQuery } from '@graphqlTypes/graphql';

/**
* Parses template query data into props for rendering a template.
Expand Down
12 changes: 6 additions & 6 deletions packages/query/src/utils/parse-template.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ApolloQueryResult } from '@apollo/client';
import { GetCurrentTemplateQuery } from '@graphqlTypes/graphql';
import {
BlockData,
Logger,
TemplateParseError,
type BlockData,
type EnqueuedScriptProps,
type StyleSheetProps,
type ScriptModuleProps,
TemplateData,
TemplateParseError,
type StyleSheetProps,
type TemplateData,
} from '@snapwp/core';
import type { ApolloQueryResult } from '@apollo/client';
import type { GetCurrentTemplateQuery } from '@graphqlTypes/graphql';

/**
* Parses template query data into props for rendering a template.
Expand Down

0 comments on commit ef726d2

Please sign in to comment.