Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1d1cb5c
chore(eslint): propose common rule creator
alizedebray Sep 1, 2025
c118b5a
feat(eslint): add automigration rules to update spacing utilities
leagrdv Sep 15, 2025
9bfeee4
update to handle class name map for future migration rules
leagrdv Sep 16, 2025
1feb7c1
move breakpoints to the util
leagrdv Sep 16, 2025
894d67c
feat(eslint): add automigration rules to update sizing utilities
leagrdv Sep 16, 2025
e7d29b7
common invalid/valid data generated tester
leagrdv Sep 16, 2025
eecd074
remove console.log
leagrdv Sep 16, 2025
fb4adbc
Merge branch 'main' into 6020-migration-rules-for-the-sizing-utilities
leagrdv Sep 17, 2025
be8462e
fix merge issues
leagrdv Sep 17, 2025
01bee63
feat(eslint): automigration rules to update gutter utilities
leagrdv Sep 17, 2025
3a940e4
refacto to avoid code duplication
leagrdv Sep 17, 2025
50063b8
add common data
leagrdv Sep 19, 2025
0fea1ad
feat(eslint): automigration for the gap utilities
leagrdv Sep 19, 2025
d27647f
Merge branch 'main' into 6020-migration-rules-for-the-sizing-utilities
leagrdv Sep 19, 2025
a729731
Merge branch 'main' into 6020-migration-rules-for-the-sizing-utilities
leagrdv Sep 25, 2025
86beea0
Merge branch '6020-migration-rules-for-the-sizing-utilities' into 601…
leagrdv Sep 25, 2025
5450291
Merge branch 'main' into 6014-migration-rules-for-the-gutter-utility
leagrdv Sep 26, 2025
e6da05c
Merge branch 'main' into 6014-migration-rules-for-the-gutter-utility
leagrdv Sep 26, 2025
be959ed
Merge branch 'main' into 6014-migration-rules-for-the-gutter-utility
leagrdv Oct 3, 2025
b94eae9
rework common functions
leagrdv Oct 3, 2025
43168ae
Merge branch 'main' into 6014-migration-rules-for-the-gutter-utility
leagrdv Oct 3, 2025
e127f74
Merge branch '6014-migration-rules-for-the-gutter-utility' into 6015-…
leagrdv Oct 3, 2025
4b57d77
update based on changes on two phase rule
leagrdv Oct 3, 2025
ae6c3d1
Merge branch '6014-migration-rules-for-the-gutter-utility' into 6015-…
leagrdv Oct 3, 2025
83016bc
Merge branch 'main' into 6015-migration-rules-for-the-gap-utility
leagrdv Oct 3, 2025
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
5 changes: 5 additions & 0 deletions .changeset/slow-swans-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Added information in the migration guide regarding the update on the gap utility classes.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ export class MigrationV99Component extends LitElement {
<li><code>*-5</code> is now <code>*-48</code></li>
</ul>
</li>
<li class="mb-16">
<p>
The gap classes naming (<code>gap-*</code>, <code>row-gap-*</code>,
<code>column-gap-*</code>) has changed to pixel-based names
<span class="tag tag-sm tag-danger">breaking</span> <span class="tag tag-sm tag-info">🪄 migration rule</span>
</p>
<ul>
<li><code>*-1</code> is now <code>*-4</code></li>
<li><code>*-2</code> is now <code>*-8</code></li>
<li><code>*-3</code> is now <code>*-16</code></li>
<li><code>*-4</code> is now <code>*-24</code></li>
<li><code>*-5</code> is now <code>*-48</code></li>
</ul>
</li>
</ul>

<h5>Utilities</h5>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `no-deprecated-gap-utilities`

Flags all deprecated bootstrap gap utility classes and replaces them with the new ones.

- Type: problem
- 🔧 Supports autofix (--fix)

## Class list

The classes that are handled by this rule are the following ones:

- Starts with one of those gap class names: `gap-*`, `column-gap-*`, `row-gap-*`
- Then, has either no breakpoint or one of the following breakpoint: `*sm-*`,`*md-*`,`*lg-*`, `*xl-*`
- Ends with one of the following class values: `*1`, `*2`, `*3`, `*4`, `*5`

## Rule Options

This rule does not have any configuration options.

## Example

### ❌ Invalid Code

```html
<div class="gap-3">Content</div>
<div class="column-gap-sm-5">Content</div>
<div class="row-gap-lg-1">Content</div>
```

### ✅ Valid Code

```html
<div class="gap-8">Content</div>
<div class="column-gap-sm-16">Content</div>
<div class="row-gap-lg-24">Content</div>
```
7 changes: 5 additions & 2 deletions packages/eslint/src/rules/html/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import noUnnumberedBorderRadiusRule, {
import { rules as noDeprecatedSpacingUtilities } from './no-deprecated-spacing-utilities';
import { rules as noDeprecatedGutterUtilities } from './no-deprecated-gutter-utilities';
import { rules as noDeprecatedSizingUtilities } from './no-deprecated-sizing-utilities';
import { rules as noDeprecatedGapUtilities } from './no-deprecated-gap-utilities';
import noFormTextRule, { name as noFormTextRuleName } from './no-form-text';
import noDeprecatedFontWeightRule, {
name as noDeprecatedFontWeightRuleName,
Expand Down Expand Up @@ -34,10 +35,12 @@ export const htmlMigrationRules = {
[noDeprecatedSpacingUtilities[1].name]: noDeprecatedSpacingUtilities[1].rule,
[noDeprecatedSizingUtilities[0].name]: noDeprecatedSizingUtilities[0].rule,
[noDeprecatedSizingUtilities[0].name]: noDeprecatedSizingUtilities[1].rule,
[noFormTextRuleName]: noFormTextRule,
[noDeprecatedFontWeightRuleName]: noDeprecatedFontWeightRule,
[noDeprecatedGutterUtilities[0].name]: noDeprecatedGutterUtilities[0].rule,
[noDeprecatedGutterUtilities[1].name]: noDeprecatedGutterUtilities[1].rule,
[noDeprecatedGapUtilities[0].name]: noDeprecatedGapUtilities[0].rule,
[noDeprecatedGapUtilities[1].name]: noDeprecatedGapUtilities[1].rule,
[noFormTextRuleName]: noFormTextRule,
[noDeprecatedFontWeightRuleName]: noDeprecatedFontWeightRule,
[noDeprecatedShadowUtilitiesRuleName]: noDeprecatedShadowUtilitiesRule,
[noDeprecatedHClearfixName]: noDeprecatedHClearfix,
[noDeprecatedHVisuallyhiddenRuleName]: noDeprecatedHVisuallyhiddenRule,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { bootstrapSizeMap } from '../../../utils/common-data';
import {
arrayToMap,
createTwoPhasesClassUpdateRule,
setUpClassesMutations,
TwoPhasesData,
} from '../../../utils/two-phases-classes-update';

// Class names
const classNames = ['gap-', 'column-gap-', 'row-gap-'];

export const data: TwoPhasesData = setUpClassesMutations(
arrayToMap(classNames),
bootstrapSizeMap,
'deprecatedGapUtilities',
);

export const rules = createTwoPhasesClassUpdateRule({
name: 'no-deprecated-gap-utilities',
phases: [
{
...data.phases[0],
description:
'Flags deprecated bootstrap gap utility classes and replaces them with final ones with a temporary name (phase 1).',
},
{
...data.phases[1],
description:
'Flags deprecated bootstrap gap utility classes and replaces the temporary class names with the final ones.',
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { rules, data } from '../../../../src/rules/html/migrations/no-deprecated-gap-utilities';
import { generatedDataTester } from '../../../utils/generated-data-tester';

const validClasses = ['gap-sm-16', 'column-gap-md-48', 'row-gap-md-24'];

generatedDataTester(rules[0].name, rules[0].rule, data.phases[0].mutations, validClasses);
generatedDataTester(rules[1].name, rules[1].rule, data.phases[1].mutations, validClasses);