Skip to content

Conversation

leagrdv
Copy link
Contributor

@leagrdv leagrdv commented Sep 17, 2025

📄 Description

Automigration rules for the gutter utility + two phase rules refactoring

@leagrdv leagrdv requested a review from a team as a code owner September 17, 2025 14:34
@leagrdv leagrdv added the 🚂 PR train PR which follows another one. label Sep 17, 2025
@leagrdv leagrdv requested a review from a team as a code owner September 17, 2025 14:34
@leagrdv leagrdv requested review from alizedebray and removed request for a team September 17, 2025 14:34
Copy link

changeset-bot bot commented Sep 17, 2025

🦋 Changeset detected

Latest commit: be959ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@swisspost/design-system-documentation Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Sep 17, 2025

Related Previews

@leagrdv leagrdv linked an issue Sep 19, 2025 that may be closed by this pull request
4 tasks
Base automatically changed from 6020-migration-rules-for-the-sizing-utilities to main September 26, 2025 10:48
@leagrdv leagrdv removed the 🚂 PR train PR which follows another one. label Sep 26, 2025
Comment on lines +81 to +86
export function createTwoPhasesRules(
data: TwoPhasesData,
name: string,
descriptionPhase1: string,
descriptionPhase2: string,
): {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this function signature to something like this:

Suggested change
export function createTwoPhasesRules(
data: TwoPhasesData,
name: string,
descriptionPhase1: string,
descriptionPhase2: string,
): {
type RuleType = Rule.RuleMetaData['type'];
type RuleMessages = Rule.RuleMetaData['messages'];
interface RuleConfigBase {
name: string;
type?: RuleType;
}
interface PhaseConfig<T>{
description: string;
messages: T;
mutations: Record<keyof T, [string] | [string, string]>;
}
interface TwoPhaseRuleConfig<T, U> extends RuleConfigBase {
phases: [PhaseConfig<T>, PhaseConfig<U>];
}
const createTwoPhasesClassUpdateRule = <T extends RuleMessages, U extends RuleMessages>(
config: TwoPhaseRuleConfig<T, U>
): {

This way, descriptions are included into the phase data and we ensure message keys and mutation keys are always matching.

Then the RuleConfig interface could be turned into:

type SinglePhaseRuleConfig<T> = RuleConfigBase & PhaseConfig<T>;

Copy link

sonarqubecloud bot commented Oct 3, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration rules for the gutter utility
3 participants