Skip to content

Commit

Permalink
Fix declaration-block-no-redundant-longhand-properties autofix for …
Browse files Browse the repository at this point in the history
…`grid-column`/`grid-row` (#8023)

Co-authored-by: Masafumi Koba <[email protected]>
  • Loading branch information
ryo-manba and ybiquitous authored Oct 11, 2024
1 parent 3fca687 commit 99030ac
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-dryers-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `declaration-block-no-redundant-longhand-properties` autofix for `grid-column`/`grid-row`
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,45 @@ testRule({
description: 'explicit grid-row test',
message: messages.expected('grid-row'),
},
{
code: stripIndent`
a {
grid-row-start: 1;
grid-row-end: 2;
grid-column-start: 3;
grid-column-end: 4;
}
`,
fixed: stripIndent`
a {
grid-row: 1 / 2;
grid-column: 3 / 4;
}
`,
description: 'combination of grid-row and grid-column test',
warnings: [
{ column: 2, endColumn: 14, endLine: 3, line: 3, message: messages.expected('grid-row') },
{ column: 2, endColumn: 17, endLine: 5, line: 5, message: messages.expected('grid-area') },
{
column: 2,
endColumn: 17,
endLine: 5,
line: 5,
message: messages.expected('grid-column'),
},
],
},
{
code: stripIndent`
a {
grid-column: line-outer-left / line-outer-right;
grid-row: line-inner-top / line-inner-bottom;
}
`,
skip: true,
description: 'TODO: explicit grid-area test',
message: messages.expected('grid-area'),
},
{
code: 'a { border-top-left-radius: 1em; border-top-right-radius: 2em; border-bottom-right-radius: 3em; border-bottom-left-radius: 4em; }',
fixed: 'a { border-radius: 1em 2em 3em 4em; }',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ const haveConflicts = [
'border-right',
'border-bottom',
'border-left',
'grid-column',
'grid-row',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ const haveConflicts = [
'border-right',
'border-bottom',
'border-left',
'grid-column',
'grid-row',
];

/**
Expand Down

0 comments on commit 99030ac

Please sign in to comment.