From 4ac3e1c1ade203613b26ac8a8792fef954f81e22 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Fri, 2 Sep 2022 18:50:33 +0300 Subject: [PATCH 1/7] add tests --- lib/rules/at-rule-no-unknown/__tests__/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/rules/at-rule-no-unknown/__tests__/index.js b/lib/rules/at-rule-no-unknown/__tests__/index.js index a25337b566..cf38979eea 100644 --- a/lib/rules/at-rule-no-unknown/__tests__/index.js +++ b/lib/rules/at-rule-no-unknown/__tests__/index.js @@ -10,6 +10,12 @@ testRule({ { code: "@charset 'UTF-8';", }, + { + code: '@container (min-width: 700px)', + }, + { + code: '@CONTAINER (min-width: 500px)', + }, { code: "@CHARSET 'UTF-8';", }, From 52748aee4f319f4ab0dc31052e05836fc1887bf0 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Fri, 2 Sep 2022 18:50:45 +0300 Subject: [PATCH 2/7] add container to atrules --- lib/reference/atKeywords.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/reference/atKeywords.js b/lib/reference/atKeywords.js index 70b7364cd7..1ba44d59f0 100644 --- a/lib/reference/atKeywords.js +++ b/lib/reference/atKeywords.js @@ -48,6 +48,7 @@ const atKeywords = uniteSets(pageMarginAtKeywords, [ 'supports', 'swash', 'viewport', + 'container', ]); module.exports = { From 7bfb7d44cc067b67e5cb112f8f751b236619d1ec Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Fri, 2 Sep 2022 19:30:19 +0300 Subject: [PATCH 3/7] add units --- lib/reference/units.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/reference/units.js b/lib/reference/units.js index a4de9e3bbd..8839f1c75f 100644 --- a/lib/reference/units.js +++ b/lib/reference/units.js @@ -39,6 +39,13 @@ const lengthUnits = new Set([ 'mozmm', // Flexible length units 'fr', + // Container queries units + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', ]); const units = uniteSets(lengthUnits, [ From 6fde55c7148b9335db4a8bad4dbd5b6b3757da1f Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Fri, 2 Sep 2022 19:31:22 +0300 Subject: [PATCH 4/7] fix units --- lib/reference/units.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/reference/units.js b/lib/reference/units.js index 8839f1c75f..1ec2f8ea35 100644 --- a/lib/reference/units.js +++ b/lib/reference/units.js @@ -39,18 +39,17 @@ const lengthUnits = new Set([ 'mozmm', // Flexible length units 'fr', - // Container queries units +]); + +const units = uniteSets(lengthUnits, [ + // Relative length units + '%', 'cqw', 'cqh', 'cqi', 'cqb', 'cqmin', 'cqmax', -]); - -const units = uniteSets(lengthUnits, [ - // Relative length units - '%', // Time length units 's', 'ms', From 4e13d1cc81c32b23400692c8fba138fc87307df7 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Fri, 2 Sep 2022 19:33:51 +0300 Subject: [PATCH 5/7] fix units again --- lib/reference/units.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/reference/units.js b/lib/reference/units.js index 1ec2f8ea35..fb7da5ad2f 100644 --- a/lib/reference/units.js +++ b/lib/reference/units.js @@ -10,6 +10,12 @@ const lengthUnits = new Set([ 'rem', 'rlh', 'lh', + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', // Viewport-percentage lengths 'dvh', 'dvmax', @@ -44,12 +50,6 @@ const lengthUnits = new Set([ const units = uniteSets(lengthUnits, [ // Relative length units '%', - 'cqw', - 'cqh', - 'cqi', - 'cqb', - 'cqmin', - 'cqmax', // Time length units 's', 'ms', From 2ed33a8da0be785c5d5edd2756e92e8606e78c5e Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sat, 3 Sep 2022 13:20:25 +0300 Subject: [PATCH 6/7] fixes --- lib/reference/atKeywords.js | 2 +- lib/reference/units.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/reference/atKeywords.js b/lib/reference/atKeywords.js index 1ba44d59f0..40fecce563 100644 --- a/lib/reference/atKeywords.js +++ b/lib/reference/atKeywords.js @@ -28,6 +28,7 @@ const atKeywords = uniteSets(pageMarginAtKeywords, [ 'apply', 'character-variant', 'charset', + 'container', 'counter-style', 'custom-media', 'custom-selector', @@ -48,7 +49,6 @@ const atKeywords = uniteSets(pageMarginAtKeywords, [ 'supports', 'swash', 'viewport', - 'container', ]); module.exports = { diff --git a/lib/reference/units.js b/lib/reference/units.js index fb7da5ad2f..b7ee630b0a 100644 --- a/lib/reference/units.js +++ b/lib/reference/units.js @@ -10,12 +10,6 @@ const lengthUnits = new Set([ 'rem', 'rlh', 'lh', - 'cqw', - 'cqh', - 'cqi', - 'cqb', - 'cqmin', - 'cqmax', // Viewport-percentage lengths 'dvh', 'dvmax', @@ -45,6 +39,13 @@ const lengthUnits = new Set([ 'mozmm', // Flexible length units 'fr', + // Container query units + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', ]); const units = uniteSets(lengthUnits, [ From af1e0b25737c204c3a25efb9226fd9dd9695bcf5 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Sat, 3 Sep 2022 19:33:36 +0900 Subject: [PATCH 7/7] Add changelog entry --- .changeset/spicy-toes-rule.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spicy-toes-rule.md diff --git a/.changeset/spicy-toes-rule.md b/.changeset/spicy-toes-rule.md new file mode 100644 index 0000000000..dcb2edbebd --- /dev/null +++ b/.changeset/spicy-toes-rule.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `*-no-unknown` false positives for container queries