From d881c9df941d22a8cdc52bbd13e1b1900b0f95f8 Mon Sep 17 00:00:00 2001 From: Fedya Petrakov Date: Mon, 15 Jan 2024 11:58:08 +0300 Subject: [PATCH] Fix `declaration-property-value-no-unknown` false negatives for `@starting-style` (#7461) Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> --- .changeset/cyan-mice-enjoy.md | 5 +++++ lib/reference/atKeywords.cjs | 9 ++------- lib/reference/atKeywords.mjs | 9 ++------- .../__tests__/index.mjs | 11 +++++++++++ 4 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 .changeset/cyan-mice-enjoy.md diff --git a/.changeset/cyan-mice-enjoy.md b/.changeset/cyan-mice-enjoy.md new file mode 100644 index 0000000000..3559e81067 --- /dev/null +++ b/.changeset/cyan-mice-enjoy.md @@ -0,0 +1,5 @@ +--- +"stylelint": minor +--- + +Fixed: `declaration-property-value-no-unknown` false negatives for `@starting-style` diff --git a/lib/reference/atKeywords.cjs b/lib/reference/atKeywords.cjs index ebad8fe164..394b981d7b 100644 --- a/lib/reference/atKeywords.cjs +++ b/lib/reference/atKeywords.cjs @@ -10,6 +10,7 @@ const nestingSupportedAtKeywords = new Set([ 'layer', 'media', 'scope', + 'starting-style', 'supports', ]); @@ -34,12 +35,11 @@ const pageMarginAtKeywords = new Set([ ]); // https://developer.mozilla.org/en/docs/Web/CSS/At-rule -const atKeywords = uniteSets(pageMarginAtKeywords, [ +const atKeywords = uniteSets(nestingSupportedAtKeywords, pageMarginAtKeywords, [ 'annotation', 'apply', 'character-variant', 'charset', - 'container', 'counter-style', 'custom-media', 'custom-selector', @@ -48,19 +48,14 @@ const atKeywords = uniteSets(pageMarginAtKeywords, [ 'font-feature-values', 'import', 'keyframes', - 'layer', - 'media', 'namespace', 'nest', 'ornaments', 'page', 'property', 'scroll-timeline', - 'scope', - 'starting-style', 'styleset', 'stylistic', - 'supports', 'swash', 'viewport', ]); diff --git a/lib/reference/atKeywords.mjs b/lib/reference/atKeywords.mjs index b64b82277f..bec1ce256c 100644 --- a/lib/reference/atKeywords.mjs +++ b/lib/reference/atKeywords.mjs @@ -6,6 +6,7 @@ export const nestingSupportedAtKeywords = new Set([ 'layer', 'media', 'scope', + 'starting-style', 'supports', ]); @@ -30,12 +31,11 @@ const pageMarginAtKeywords = new Set([ ]); // https://developer.mozilla.org/en/docs/Web/CSS/At-rule -export const atKeywords = uniteSets(pageMarginAtKeywords, [ +export const atKeywords = uniteSets(nestingSupportedAtKeywords, pageMarginAtKeywords, [ 'annotation', 'apply', 'character-variant', 'charset', - 'container', 'counter-style', 'custom-media', 'custom-selector', @@ -44,19 +44,14 @@ export const atKeywords = uniteSets(pageMarginAtKeywords, [ 'font-feature-values', 'import', 'keyframes', - 'layer', - 'media', 'namespace', 'nest', 'ornaments', 'page', 'property', 'scroll-timeline', - 'scope', - 'starting-style', 'styleset', 'stylistic', - 'supports', 'swash', 'viewport', ]); diff --git a/lib/rules/declaration-property-value-no-unknown/__tests__/index.mjs b/lib/rules/declaration-property-value-no-unknown/__tests__/index.mjs index faac2462f3..10d14fbd73 100644 --- a/lib/rules/declaration-property-value-no-unknown/__tests__/index.mjs +++ b/lib/rules/declaration-property-value-no-unknown/__tests__/index.mjs @@ -11,6 +11,9 @@ testRule({ { code: 'a { top: 0; }', }, + { + code: 'a { @starting-style { opacity: 0; } }', + }, { code: 'a { @media screen { top: 0; } }', }, @@ -148,6 +151,14 @@ testRule({ endLine: 1, endColumn: 33, }, + { + code: 'a { @starting-style { padding: auto; } }', + message: messages.rejected('padding', 'auto'), + line: 1, + column: 32, + endLine: 1, + endColumn: 36, + }, { code: 'a { top: red; }', message: messages.rejected('top', 'red'),