-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
Size Change: -15.6 kB (-0.66%) Total Size: 2.35 MB
ℹ️ View Unchanged
|
return 'per year'; | ||
} | ||
|
||
function getCustomAmountA11yHint( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this would be a useful thing to dig into where it was used and potentially add to our checkout again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah perhaps worth adding a card for (to investigate and fix if needed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👏
There's a lot of unused code removed in here! It's kind of hard to be sure reviewing it but if TS is happy then I think we can be confident 👍
@@ -132,5 +132,3 @@ export function PersonalDetails({ | |||
</div> | |||
); | |||
} | |||
|
|||
export default PersonalDetails; |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah an odd one
Seen on PROD (merged by @andrewHEguardian 9 minutes and 39 seconds ago)
Sentry Release: support-client-side, support |
} | ||
|
||
export { PersonalDetailsGift, PersonalDetailsDigitalGift }; | ||
export { PersonalDetailsGift }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline export perhaps here?
There was a problem hiding this comment.
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
@@ -12,8 +12,8 @@ export type { ActiveProductKey }; | |||
|
|||
export const productCatalog = window.guardian.productCatalog; | |||
|
|||
export type SupporterPlusVariants = 'control' | 'v1' | 'v2'; | |||
export type ContributionVariants = 'control' | 'v1' | 'v2Annual' | 'v2Monthly'; | |||
type SupporterPlusVariants = 'control' | 'v1' | 'v2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake in yesterday's PR, its working :)
@@ -8,7 +8,7 @@ module.exports = { | |||
// ! signals that this is production code https://knip.dev/features/production-mode | |||
entry: [...flattenedEntryPoints, 'scripts/build-ssr-content.tsx!'], | |||
project: ['**/*.{js,jsx,ts,tsx,scss}!'], | |||
ignoreExportsUsedInFile: true, | |||
ignoreExportsUsedInFile: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the reason all these export
s are removed and this will pick it up going forwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A LOT in there. Might be worth splitting the simple export removals first in a standalone PR and then remainder after (or as batches). The Smoke and Cron tests pass, abtests also so would presume its ready.
What are you doing in this PR?
Changing the Knip config to not ignore unused exports if they're used within the same file. The main motivation for doing this is that there is a Knip issue where combining
ignoreExportsUsedInFile: true
andexport { foo }
notation doesn't detect unused exports. This PR fixes the unnecessaryexport
statements and removes the completely unused exports (and subsequent unused code)