diff --git a/.changeset/sixty-lies-repair.md b/.changeset/sixty-lies-repair.md new file mode 100644 index 0000000000..097422549a --- /dev/null +++ b/.changeset/sixty-lies-repair.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `declaration-block-no-redundant-longhand-properties` autofix for `border-width` shorthand diff --git a/lib/reference/properties.js b/lib/reference/properties.js index c873b8f8c7..b0eb13b963 100644 --- a/lib/reference/properties.js +++ b/lib/reference/properties.js @@ -180,9 +180,9 @@ const longhandSubPropertiesOfShorthandProperties = new Map([ new Set([ // prettier-ignore 'border-top-width', + 'border-right-width', 'border-bottom-width', 'border-left-width', - 'border-right-width', ]), ], [ diff --git a/lib/rules/declaration-block-no-redundant-longhand-properties/__tests__/index.js b/lib/rules/declaration-block-no-redundant-longhand-properties/__tests__/index.js index 740fb7c7dd..5724525e42 100644 --- a/lib/rules/declaration-block-no-redundant-longhand-properties/__tests__/index.js +++ b/lib/rules/declaration-block-no-redundant-longhand-properties/__tests__/index.js @@ -206,6 +206,12 @@ testRule({ description: 'autofixer should not mangle css functions with comma separated values', message: messages.expected('transition'), }, + { + code: 'a { border-top-width: 0px; border-right-width: 1px; border-bottom-width: 2px; border-left-width: 3px; }', + fixed: 'a { border-width: 0px 1px 2px 3px; }', + description: 'explicit border-width test', + message: messages.expected('border-width'), + }, ], });