Skip to content

Commit 99030ac

Browse files
Fix declaration-block-no-redundant-longhand-properties autofix for grid-column/grid-row (#8023)
Co-authored-by: Masafumi Koba <[email protected]>
1 parent 3fca687 commit 99030ac

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

.changeset/heavy-dryers-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stylelint": patch
3+
---
4+
5+
Fixed: `declaration-block-no-redundant-longhand-properties` autofix for `grid-column`/`grid-row`

lib/rules/declaration-block-no-redundant-longhand-properties/__tests__/index.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,45 @@ testRule({
692692
description: 'explicit grid-row test',
693693
message: messages.expected('grid-row'),
694694
},
695+
{
696+
code: stripIndent`
697+
a {
698+
grid-row-start: 1;
699+
grid-row-end: 2;
700+
grid-column-start: 3;
701+
grid-column-end: 4;
702+
}
703+
`,
704+
fixed: stripIndent`
705+
a {
706+
grid-row: 1 / 2;
707+
grid-column: 3 / 4;
708+
}
709+
`,
710+
description: 'combination of grid-row and grid-column test',
711+
warnings: [
712+
{ column: 2, endColumn: 14, endLine: 3, line: 3, message: messages.expected('grid-row') },
713+
{ column: 2, endColumn: 17, endLine: 5, line: 5, message: messages.expected('grid-area') },
714+
{
715+
column: 2,
716+
endColumn: 17,
717+
endLine: 5,
718+
line: 5,
719+
message: messages.expected('grid-column'),
720+
},
721+
],
722+
},
723+
{
724+
code: stripIndent`
725+
a {
726+
grid-column: line-outer-left / line-outer-right;
727+
grid-row: line-inner-top / line-inner-bottom;
728+
}
729+
`,
730+
skip: true,
731+
description: 'TODO: explicit grid-area test',
732+
message: messages.expected('grid-area'),
733+
},
695734
{
696735
code: 'a { border-top-left-radius: 1em; border-top-right-radius: 2em; border-bottom-right-radius: 3em; border-bottom-left-radius: 4em; }',
697736
fixed: 'a { border-radius: 1em 2em 3em 4em; }',

lib/rules/declaration-block-no-redundant-longhand-properties/index.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ const haveConflicts = [
190190
'border-right',
191191
'border-bottom',
192192
'border-left',
193+
'grid-column',
194+
'grid-row',
193195
];
194196

195197
/**

lib/rules/declaration-block-no-redundant-longhand-properties/index.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ const haveConflicts = [
187187
'border-right',
188188
'border-bottom',
189189
'border-left',
190+
'grid-column',
191+
'grid-row',
190192
];
191193

192194
/**

0 commit comments

Comments
 (0)