diff --git a/.changeset/flat-bananas-hug.md b/.changeset/flat-bananas-hug.md new file mode 100644 index 0000000000..4a196291da --- /dev/null +++ b/.changeset/flat-bananas-hug.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `selector-type-no-unknown` false positives for experimental and deprecated HTML tags diff --git a/lib/reference/selectors.cjs b/lib/reference/selectors.cjs index c956f7a5b3..456a9a377c 100644 --- a/lib/reference/selectors.cjs +++ b/lib/reference/selectors.cjs @@ -10,6 +10,7 @@ const deprecatedHtmlTypeSelectors = new Set([ 'applet', 'basefont', 'big', + 'bgsound', 'blink', 'center', 'content', @@ -17,14 +18,17 @@ const deprecatedHtmlTypeSelectors = new Set([ 'font', 'frame', 'frameset', - 'hgroup', 'isindex', 'keygen', 'listing', 'marquee', + 'multicol', + 'nextid', 'nobr', 'noembed', + 'noframes', 'plaintext', + 'param', 'spacer', 'strike', 'tt', @@ -35,7 +39,13 @@ const deprecatedHtmlTypeSelectors = new Set([ /** @type {Set} */ const standardHtmlTypeSelectors = new Set(htmlTags); -const htmlTypeSelectors = uniteSets(deprecatedHtmlTypeSelectors, standardHtmlTypeSelectors); +const experimentalHtmlTypeSelectors = new Set(['fencedframe', 'listbox', 'portal', 'selectlist']); + +const htmlTypeSelectors = uniteSets( + deprecatedHtmlTypeSelectors, + standardHtmlTypeSelectors, + experimentalHtmlTypeSelectors, +); const mixedCaseSvgTypeSelectors = new Set([ 'altGlyph', diff --git a/lib/reference/selectors.mjs b/lib/reference/selectors.mjs index 345f9de9b8..2774f2b192 100644 --- a/lib/reference/selectors.mjs +++ b/lib/reference/selectors.mjs @@ -7,6 +7,7 @@ const deprecatedHtmlTypeSelectors = new Set([ 'applet', 'basefont', 'big', + 'bgsound', 'blink', 'center', 'content', @@ -14,14 +15,17 @@ const deprecatedHtmlTypeSelectors = new Set([ 'font', 'frame', 'frameset', - 'hgroup', 'isindex', 'keygen', 'listing', 'marquee', + 'multicol', + 'nextid', 'nobr', 'noembed', + 'noframes', 'plaintext', + 'param', 'spacer', 'strike', 'tt', @@ -32,7 +36,13 @@ const deprecatedHtmlTypeSelectors = new Set([ /** @type {Set} */ const standardHtmlTypeSelectors = new Set(htmlTags); -export const htmlTypeSelectors = uniteSets(deprecatedHtmlTypeSelectors, standardHtmlTypeSelectors); +const experimentalHtmlTypeSelectors = new Set(['fencedframe', 'listbox', 'portal', 'selectlist']); + +export const htmlTypeSelectors = uniteSets( + deprecatedHtmlTypeSelectors, + standardHtmlTypeSelectors, + experimentalHtmlTypeSelectors, +); export const mixedCaseSvgTypeSelectors = new Set([ 'altGlyph', diff --git a/lib/rules/selector-type-no-unknown/__tests__/index.mjs b/lib/rules/selector-type-no-unknown/__tests__/index.mjs index 9b15bd9b49..350d3643fb 100644 --- a/lib/rules/selector-type-no-unknown/__tests__/index.mjs +++ b/lib/rules/selector-type-no-unknown/__tests__/index.mjs @@ -84,6 +84,9 @@ testRule({ code: 'circle {}', description: 'svg tags', }, + { + code: 'fencedframe, listbox, portal, selectlist {}', + }, { code: 'foreignObject {}', description: 'case-sensitive svg tags', diff --git a/lib/utils/isCustomElement.cjs b/lib/utils/isCustomElement.cjs index 746308e315..e5b12966a5 100644 --- a/lib/utils/isCustomElement.cjs +++ b/lib/utils/isCustomElement.cjs @@ -3,7 +3,6 @@ 'use strict'; const svgTags = require('svg-tags'); -const selectors = require('../reference/selectors.cjs'); const mathMLTags = require('./mathMLTags.cjs'); /** @@ -31,10 +30,6 @@ function isCustomElement(selector) { return false; } - if (selectors.htmlTypeSelectors.has(selectorLowerCase)) { - return false; - } - if (mathMLTags.includes(selectorLowerCase)) { return false; } diff --git a/lib/utils/isCustomElement.mjs b/lib/utils/isCustomElement.mjs index 5870a76d0e..81e5e454d2 100644 --- a/lib/utils/isCustomElement.mjs +++ b/lib/utils/isCustomElement.mjs @@ -1,6 +1,5 @@ import svgTags from 'svg-tags'; -import { htmlTypeSelectors } from '../reference/selectors.mjs'; import mathMLTags from './mathMLTags.mjs'; /** @@ -28,10 +27,6 @@ export default function isCustomElement(selector) { return false; } - if (htmlTypeSelectors.has(selectorLowerCase)) { - return false; - } - if (mathMLTags.includes(selectorLowerCase)) { return false; }