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

Change Knip ignoreExportsUsedInFile to false and fix #6721

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions support-frontend/assets/components/button/_sharedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { classNameWithModifiers } from 'helpers/utilities/utilities';
import './button.scss';

// ----- PropTypes ----- //
export const Appearances = {
const Appearances = {
primary: 'primary',
secondary: 'secondary',
tertiary: 'tertiary',
Expand All @@ -17,7 +17,7 @@ export const Appearances = {
greyHollow: 'greyHollow',
disabled: 'disabled',
};
export const Sides = {
const Sides = {
right: 'right',
left: 'left',
};
Expand Down Expand Up @@ -83,5 +83,5 @@ export const defaultProps = {
modifierClasses: [],
};
SharedButton.defaultProps = { ...defaultProps };
export type { SharedButtonPropTypes, IconSide, Appearance };
export type { SharedButtonPropTypes };
export default SharedButton;
2 changes: 1 addition & 1 deletion support-frontend/assets/components/button/anchorButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SharedButton, { defaultProps } from './_sharedButton';
import './button.scss';

// ----- Render ----- //
export type PropTypes = SharedButtonPropTypes & {
type PropTypes = SharedButtonPropTypes & {
'aria-label'?: string | null | undefined;
href: string;
onClick?: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type TierUnlocks = {
countryGroupId: CountryGroupId;
};

export type CheckListData = {
type CheckListData = {
isChecked: boolean;
text?: JSX.Element;
maybeGreyedOut?: SerializedStyles;
Expand Down
2 changes: 1 addition & 1 deletion support-frontend/assets/components/content/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'helpers/types/option';
import './content.scss';

// ---- Types ----- //
export const Appearances = {
const Appearances = {
white: 'white',
grey: 'grey',
highlight: 'highlight',
Expand Down
7 changes: 1 addition & 6 deletions support-frontend/assets/components/csr/csrMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,4 @@ const useCsrCustomerData = (
const csrUserName = (csrCustomerData: CsrCustomerData): string =>
`${csrCustomerData.csr.firstName} ${csrCustomerData.csr.lastName}`;

export {
useCsrCustomerData,
isSalesforceDomain,
csrUserName,
parseCustomerData,
};
export { useCsrCustomerData, csrUserName, parseCustomerData };
2 changes: 1 addition & 1 deletion support-frontend/assets/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const backdrop = css`
width: 100%;
`;

export type PropTypes = {
type PropTypes = {
closeDialog: () => void;
styled?: boolean;
open?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const mapDispatchToProps = {

const connector = connect(mapStateToProps, mapDispatchToProps);

export type PropTypes = ConnectedProps<typeof connector> & {
type PropTypes = ConnectedProps<typeof connector> & {
allErrors: Array<Record<string, string>>;
buttonText: string;
submissionErrorHeading: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
Quarterly,
} from 'helpers/productPrice/billingPeriods';
import type { FulfilmentOptions } from 'helpers/productPrice/fulfilmentOptions';
import {
Domestic,
NoFulfilmentOptions,
} from 'helpers/productPrice/fulfilmentOptions';
import { Domestic } from 'helpers/productPrice/fulfilmentOptions';
import { NoProductOptions } from 'helpers/productPrice/productOptions';
import type { ProductPrices } from 'helpers/productPrice/productPrices';
import { getPromotion } from 'helpers/productPrice/promotions';
Expand Down Expand Up @@ -176,24 +173,4 @@ function GuardianWeeklyFooter({
);
}

function DigitalFooter({
productPrices,
orderIsAGift,
country,
}: FooterWithPromoTermsProps): JSX.Element {
const termsConditionsLink = orderIsAGift
? 'https://www.theguardian.com/help/2020/nov/24/gift-digital-subscriptions-terms-and-conditions'
: 'https://www.theguardian.com/info/2014/aug/06/guardian-observer-digital-subscriptions-terms-conditions';

return (
<FooterWithPromoTerms
productPrices={productPrices}
orderIsAGift={orderIsAGift}
country={country}
fulfillmentOption={NoFulfilmentOptions}
termsConditionsLink={termsConditionsLink}
/>
);
}

export { DigitalFooter, GuardianWeeklyFooter };
export { GuardianWeeklyFooter };
4 changes: 2 additions & 2 deletions support-frontend/assets/components/headers/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Links from '../links/links';
import MobileMenuToggler from './mobileMenuToggler';
import './header.scss';

export type PropTypes = {
type PropTypes = {
utility?: JSX.Element;
countryGroupId: CountryGroupId;
display?: 'navigation' | 'checkout' | 'guardianLogo' | void;
};
export type State = {
type State = {
isTestUser: boolean | null | undefined;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type Position = {
y: number;
};

export type PropTypes = {
type PropTypes = {
onClose: () => void;
utility: ReactNode;
links: ReactNode;
Expand Down
4 changes: 2 additions & 2 deletions support-frontend/assets/components/page/heroRoundel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
import type { ReactElement, ReactNode } from 'react';
import { digitalSubscriptionsBlue } from 'stylesheets/emotion/colours';

export const roundelSizeMob = 100;
export const roundelSize = 180;
const roundelSizeMob = 100;
const roundelSize = 180;

const heroRoundelStyles = css`
display: flex;
Expand Down
9 changes: 2 additions & 7 deletions support-frontend/assets/components/page/pageTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const header = css`
}
}
`;
export const pageTitle = css`
const pageTitle = css`
${titlepiece42};
font-weight: bold;
z-index: 10;
Expand All @@ -88,7 +88,7 @@ export const pageTitle = css`
}
`;

function PageTitle({
export function PageTitle({
title,
theme,
cssOverrides,
Expand All @@ -103,8 +103,3 @@ function PageTitle({
</div>
);
}

PageTitle.defaultProps = {
cssOverrides: '',
};
export default PageTitle;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
import { routes } from 'helpers/urls/routes';
import { logException } from 'helpers/utilities/logger';

export type PayPalButtonControls = {
type PayPalButtonControls = {
enable?: () => void;
disable?: () => void;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const tabPanelStyles = css`
}
`;

export type TabProps = {
type TabProps = {
id: ContributionType;
labelText: string;
selected: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,3 @@ export function PersonalDetails({
</div>
);
}

export default PersonalDetails;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that this was available as both a default and a named export!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah an odd one

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ProductPrice } from 'helpers/productPrice/productPrices';
import { showPrice } from 'helpers/productPrice/productPrices';
import { getAppliedPromo, hasDiscount } from 'helpers/productPrice/promotions';

export type PropTypes = {
type PropTypes = {
productPrice: ProductPrice;
billingPeriod: BillingPeriod;
className: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,4 @@ ProductPageHeroHeader.defaultProps = {
orderIsAGift: false,
giftImage: null,
};
export { HeroWrapper, HeroHeading, ProductPageHeroHeader };
export default ProductPageHero;
export { HeroWrapper };
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const inlineContainer = css`
}
`;

export type StripeCardFormProps = {
type StripeCardFormProps = {
onCardNumberChange: (event: StripeCardNumberElementChangeEvent) => void;
onExpiryChange: (event: StripeCardExpiryElementChangeEvent) => void;
onCvcChange: (event: StripeCardCvcElementChangeEvent) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Text from 'components/text/text';

export const cancellationCopy = {
const cancellationCopy = {
title: 'You can cancel any time',
body: 'There is no set time on your agreement with us so you can end your subscription whenever you wish',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const paragraphWithButton = css`
${textSans17};
`;

export type PropTypes = {
type PropTypes = {
firstName: string;
setFirstName: (firstName: string) => void;
lastName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'helpers/subscriptionsForms/formFields';
const marginBotom = css`
margin-bottom: ${space[6]}px;
`;
export type PropTypes = {
type PropTypes = {
firstNameGiftRecipient: string;
setFirstNameGift: (firstName: string) => void;
lastNameGiftRecipient: string;
Expand Down Expand Up @@ -57,41 +57,4 @@ function PersonalDetailsGift(props: PropTypes): JSX.Element {
);
}

function PersonalDetailsDigitalGift(props: PropTypes): JSX.Element {
return (
<div>
<TextInput
cssOverrides={marginBotom}
id="firstNameGiftRecipient"
data-qm-masking="blocklist"
label="First name"
type="text"
value={props.firstNameGiftRecipient}
onChange={(e) => props.setFirstNameGift(e.target.value)}
error={firstError('firstNameGiftRecipient', props.formErrors)}
/>
<TextInput
cssOverrides={marginBotom}
id="lastNameGiftRecipient"
data-qm-masking="blocklist"
label="Last name"
type="text"
value={props.lastNameGiftRecipient}
onChange={(e) => props.setLastNameGift(e.target.value)}
error={firstError('lastNameGiftRecipient', props.formErrors)}
/>
<TextInput
cssOverrides={marginBotom}
id="emailGiftRecipient"
data-qm-masking="blocklist"
label="Email"
type="email"
onChange={(e) => props.setEmailGift(e.target.value)}
value={props.emailGiftRecipient}
error={firstError('emailGiftRecipient', props.formErrors)}
/>
</div>
);
}

export { PersonalDetailsGift, PersonalDetailsDigitalGift };
export { PersonalDetailsGift };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline export perhaps here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally yes but there are a lot of those! And I used knip --fix so I didn't go back and fix

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from './composedStripeElements';

// Types
export type StripeFormPropTypes = {
type StripeFormPropTypes = {
allErrors: Array<FormError<FormField>>;
stripeKey: string;
submitForm: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const btnStyleOverrides = css`
margin-bottom: ${space[5]}px;
`;

export type AddressCtaProp = {
type AddressCtaProp = {
copy: string;
address: string;
hasArrow?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const firstColumnContainer = css`
}
`;

export interface ThankYouModulesProps {
interface ThankYouModulesProps {
isSignedIn?: boolean;
showNewspaperArchiveBenefit: boolean;
thankYouModules: ThankYouModuleType[];
Expand Down
8 changes: 2 additions & 6 deletions support-frontend/assets/helpers/abTests/abtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ export type Audience = {
breakpoint?: BreakpointRange;
};

export type AudienceType =
| IsoCountry
| CountryGroupId
| 'ALL'
| 'CONTRIBUTIONS_ONLY';
type AudienceType = IsoCountry | CountryGroupId | 'ALL' | 'CONTRIBUTIONS_ONLY';

export type Audiences = {
type Audiences = {
[key in AudienceType]?: Audience;
};

Expand Down
2 changes: 1 addition & 1 deletion support-frontend/assets/helpers/abTests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type NonEmptyAmountsTestArray = [
...AmountsTestWithVariants[],
];

export const FALLBACK_AMOUNTS: NonEmptyAmountsTestArray = [
const FALLBACK_AMOUNTS: NonEmptyAmountsTestArray = [
{
testName: 'FALLBACK_AMOUNTS__GBPCountries',
liveTestName: '',
Expand Down
Loading
Loading