Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use bundler module resolution in TSConfig #11373

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dotcom-rendering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@guardian/ophan-tracker-js": "2.1.1",
"@guardian/shimport": "1.0.2",
"@guardian/source-foundations": "14.2.2",
"@guardian/source-react-components": "22.1.0",
"@guardian/source-react-components-development-kitchen": "19.0.0",
"@guardian/source-react-components": "23.0.1",
"@guardian/source-react-components-development-kitchen": "20.0.1",
"@guardian/support-dotcom-components": "2.1.1",
"@guardian/tsconfig": "0.2.0",
"@playwright/test": "1.40.1",
Expand Down
6 changes: 3 additions & 3 deletions dotcom-rendering/src/components/FollowButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@emotion/react';
import type { EmotionJSX } from '@emotion/react/types/jsx-namespace';
import type { JSX } from '@emotion/react/jsx-runtime';
import { space, textSans15 } from '@guardian/source-foundations';
import {
SvgCheckmark,
Expand All @@ -11,8 +11,8 @@ import { palette } from '../palette';

type IconProps = {
isFollowing?: boolean;
iconIsFollowing: EmotionJSX.Element;
iconIsNotFollowing: EmotionJSX.Element;
iconIsFollowing: JSX.Element;
iconIsNotFollowing: JSX.Element;
};

const FollowIcon = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file was migrated from:
* https://github.com/guardian/support-dotcom-components/blob/9c3eae7cb0b159db4a1c40679d6b37710b0bb937/packages/modules/src/types.ts#L12
*/
import type { EmotionJSX } from '@emotion/react/types/jsx-namespace';
import type { JSX } from '@emotion/react/jsx-runtime';

// This type can be used in place of React.FC<T> which was previously widespread
// in this codebase but is no longer recommended. In many cases it's possible to
Expand All @@ -17,4 +17,4 @@ import type { EmotionJSX } from '@emotion/react/types/jsx-namespace';

export type ReactComponent<GenericProps = Record<string, never>> = (
props: GenericProps,
) => EmotionJSX.Element;
) => JSX.Element;
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
* This file was migrated from:
* https://github.com/guardian/support-dotcom-components/blob/a482b35a25ca59f66501c4de02de817046206298/packages/modules/src/modules/shared/ModuleWrapper.tsx
*/
import type { EmotionJSX } from '@emotion/react/types/jsx-namespace';
import type { JSX } from '@emotion/react/jsx-runtime';
import type { ReactComponent } from '../lib/ReactComponent';

export function withParsedProps<
ModuleProps extends EmotionJSX.IntrinsicAttributes,
>(
export function withParsedProps<ModuleProps extends JSX.IntrinsicAttributes>(
Module: ReactComponent<ModuleProps>,
validate: (props: unknown) => props is ModuleProps,
): ReactComponent<unknown> {
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"lib": ["esnext", "es2015", "dom"],
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
Expand Down
1 change: 0 additions & 1 deletion dotcom-rendering/webpack/webpack.config.dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = {
// webpack-hot-server-middleware needs to run after webpack-dev-middleware
middlewares.push({
name: 'server',
// @ts-expect-error -- it’s a MultiCompiler
middleware: webpackHotServerMiddleware(devServer.compiler, {
chunkName: 'server',
}),
Expand Down
1 change: 0 additions & 1 deletion dotcom-rendering/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const commonConfigs = ({ platform }) => ({
...(DEV
? // DEV plugins
[
// @ts-expect-error -- somehow the type declaration isn’t playing nice
new WebpackMessages({
name: platform,
}),
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@
"prettier": "3.0.3",
"tslib": "2.6.2"
},
"packageManager": "pnpm@8.15.7"
"packageManager": "pnpm@8.15.7",
"pnpm": {
"patchedDependencies": {
"@guardian/support-dotcom-components@2.1.1": "patches/@guardian__support-dotcom-components@2.1.1.patch"
}
}
}
58 changes: 58 additions & 0 deletions patches/@guardian__support-dotcom-components@2.1.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/dist/shared/src/types/props/banner.d.ts b/dist/shared/src/types/props/banner.d.ts
mxdvl marked this conversation as resolved.
Show resolved Hide resolved
index d2f4dc973a9639b837eae8d79746f841006247d0..b1fdb7d3ac81c8cf98efe56e7f78080874357abc 100644
--- a/dist/shared/src/types/props/banner.d.ts
+++ b/dist/shared/src/types/props/banner.d.ts
@@ -1,4 +1,5 @@
-import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
+
+
import { Cta, SecondaryCta, TickerSettings, Tracking } from './shared';
import { OphanComponentEvent } from '../ophan';
import * as z from 'zod';
@@ -102,7 +103,7 @@ export declare const bannerContentSchema: z.ZodObject<{
type: import("./shared").SecondaryCtaType.ContributionsReminder;
} | undefined;
}>;
-export interface BannerProps extends EmotionJSX.IntrinsicAttributes {
+export interface BannerProps extends JSX.IntrinsicAttributes {
tracking: Tracking;
bannerChannel: BannerChannel;
content?: BannerContent;
diff --git a/dist/shared/src/types/props/epic.d.ts b/dist/shared/src/types/props/epic.d.ts
index cbf676de646eed52b884ea891688d6d509bcee82..b2e4698a2567c6041c0a189dfd80d35486f6b407 100644
--- a/dist/shared/src/types/props/epic.d.ts
+++ b/dist/shared/src/types/props/epic.d.ts
@@ -1,4 +1,4 @@
-import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
+import type { JSX } from '@emotion/react/jsx-runtime';
import * as z from 'zod';
import { Stage, Tracking } from './shared';
import { OphanComponentEvent } from '../ophan';
@@ -7,7 +7,7 @@ export type ArticleCountType = 'for52Weeks' | 'forTargetedWeeks';
export type ArticleCounts = {
[type in ArticleCountType]: number;
};
-export interface EpicProps extends EmotionJSX.IntrinsicAttributes {
+export interface EpicProps extends JSX.IntrinsicAttributes {
variant: EpicVariant;
tracking: Tracking;
countryCode?: string;
diff --git a/dist/shared/src/types/props/header.d.ts b/dist/shared/src/types/props/header.d.ts
index cdb021c85d8b68a867e3bda690cc15174fba7e66..9532cff79854993d0b2e406eb16aa85da2b15ce5 100644
--- a/dist/shared/src/types/props/header.d.ts
+++ b/dist/shared/src/types/props/header.d.ts
@@ -1,4 +1,4 @@
-import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
+import { JSX } from '@emotion/react/jsx-runtime';
import * as z from 'zod';
import { OphanComponentEvent } from '../ophan';
import { Tracking, Cta } from './shared';
@@ -58,7 +58,7 @@ export declare const headerContentSchema: z.ZodObject<{
} | undefined;
benefits?: string[] | undefined;
}>;
-export interface HeaderProps extends EmotionJSX.IntrinsicAttributes {
+export interface HeaderProps extends JSX.IntrinsicAttributes {
content: HeaderContent;
tracking: Tracking;
mobileContent?: HeaderContent;
48 changes: 27 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.