From ece78beb87434368601aeddf6d25390960a29c88 Mon Sep 17 00:00:00 2001 From: Matthew Wang Date: Thu, 22 Jun 2023 17:31:24 -0700 Subject: [PATCH] Fix `declaration-block-no-redundant-longhand-properties` autofix for for `border-radius` shorthand --- .changeset/violet-otters-rule.md | 5 +++++ lib/reference/properties.js | 2 +- .../__tests__/index.js | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/violet-otters-rule.md diff --git a/.changeset/violet-otters-rule.md b/.changeset/violet-otters-rule.md new file mode 100644 index 0000000000..415f354a06 --- /dev/null +++ b/.changeset/violet-otters-rule.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `declaration-block-no-redundant-longhand-properties` autofix for `border-radius` shorthand diff --git a/lib/reference/properties.js b/lib/reference/properties.js index c873b8f8c7..2d3f6f3520 100644 --- a/lib/reference/properties.js +++ b/lib/reference/properties.js @@ -141,8 +141,8 @@ const longhandSubPropertiesOfShorthandProperties = new Map([ 'border-radius', new Set([ // prettier-ignore - 'border-top-right-radius', 'border-top-left-radius', + 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', ]), 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..cf4c2e8696 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-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; }', + description: 'explicit border-radius test', + message: messages.expected('border-radius'), + }, ], });