diff --git a/lib/utils/deprecated-html-elements.json b/lib/utils/deprecated-html-elements.json
index daf23f512..129b9354f 100644
--- a/lib/utils/deprecated-html-elements.json
+++ b/lib/utils/deprecated-html-elements.json
@@ -1 +1,36 @@
-["acronym","applet","basefont","bgsound","big","blink","center","command","content","dir","element","font","frame","frameset","image","isindex","keygen","listing","marquee","menuitem","multicol","nextid","nobr","noembed","noframes","plaintext","shadow","spacer","strike","tt","xmp"]
\ No newline at end of file
+[
+ "acronym",
+ "applet",
+ "basefont",
+ "bgsound",
+ "big",
+ "blink",
+ "center",
+ "command",
+ "content",
+ "dir",
+ "element",
+ "font",
+ "frame",
+ "frameset",
+ "image",
+ "isindex",
+ "keygen",
+ "listing",
+ "marquee",
+ "menuitem",
+ "multicol",
+ "nextid",
+ "nobr",
+ "noembed",
+ "noframes",
+ "param",
+ "plaintext",
+ "rb",
+ "rtc",
+ "shadow",
+ "spacer",
+ "strike",
+ "tt",
+ "xmp"
+]
diff --git a/lib/utils/html-elements.json b/lib/utils/html-elements.json
index 721f7876d..cd30177fa 100644
--- a/lib/utils/html-elements.json
+++ b/lib/utils/html-elements.json
@@ -1 +1,113 @@
-["html","body","base","head","link","meta","style","title","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","nav","section","div","dd","dl","dt","figcaption","figure","hr","img","li","main","ol","p","pre","ul","a","b","abbr","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","map","track","video","embed","object","param","source","canvas","script","noscript","del","ins","caption","col","colgroup","table","thead","tbody","tfoot","td","th","tr","button","datalist","fieldset","form","input","label","legend","meter","optgroup","option","output","progress","select","textarea","details","dialog","menu","menuitem","summary","content","element","shadow","template","slot","blockquote","iframe","noframes","picture"]
+[
+ "a",
+ "abbr",
+ "address",
+ "area",
+ "article",
+ "aside",
+ "audio",
+ "b",
+ "base",
+ "bdi",
+ "bdo",
+ "blockquote",
+ "body",
+ "br",
+ "button",
+ "canvas",
+ "caption",
+ "cite",
+ "code",
+ "col",
+ "colgroup",
+ "data",
+ "datalist",
+ "dd",
+ "del",
+ "details",
+ "dfn",
+ "dialog",
+ "div",
+ "dl",
+ "dt",
+ "em",
+ "embed",
+ "fieldset",
+ "figcaption",
+ "figure",
+ "footer",
+ "form",
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "head",
+ "header",
+ "hgroup",
+ "hr",
+ "html",
+ "i",
+ "iframe",
+ "img",
+ "input",
+ "ins",
+ "kbd",
+ "label",
+ "legend",
+ "li",
+ "link",
+ "main",
+ "map",
+ "mark",
+ "menu",
+ "meta",
+ "meter",
+ "nav",
+ "noscript",
+ "object",
+ "ol",
+ "optgroup",
+ "option",
+ "output",
+ "p",
+ "picture",
+ "pre",
+ "progress",
+ "q",
+ "rp",
+ "rt",
+ "ruby",
+ "s",
+ "samp",
+ "script",
+ "section",
+ "select",
+ "slot",
+ "small",
+ "source",
+ "span",
+ "strong",
+ "style",
+ "sub",
+ "summary",
+ "sup",
+ "table",
+ "tbody",
+ "td",
+ "template",
+ "textarea",
+ "tfoot",
+ "th",
+ "thead",
+ "time",
+ "title",
+ "tr",
+ "track",
+ "u",
+ "ul",
+ "var",
+ "video",
+ "wbr"
+]
diff --git a/lib/utils/svg-elements.json b/lib/utils/svg-elements.json
index aaee2e6f3..f214aad24 100644
--- a/lib/utils/svg-elements.json
+++ b/lib/utils/svg-elements.json
@@ -1 +1,65 @@
-["a","animate","animateMotion","animateTransform","audio","canvas","circle","clipPath","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","iframe","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","unknown","use","video","view"]
+[
+ "a",
+ "animate",
+ "animateMotion",
+ "animateTransform",
+ "circle",
+ "clipPath",
+ "defs",
+ "desc",
+ "ellipse",
+ "feBlend",
+ "feColorMatrix",
+ "feComponentTransfer",
+ "feComposite",
+ "feConvolveMatrix",
+ "feDiffuseLighting",
+ "feDisplacementMap",
+ "feDistantLight",
+ "feDropShadow",
+ "feFlood",
+ "feFuncA",
+ "feFuncB",
+ "feFuncG",
+ "feFuncR",
+ "feGaussianBlur",
+ "feImage",
+ "feMerge",
+ "feMergeNode",
+ "feMorphology",
+ "feOffset",
+ "fePointLight",
+ "feSpecularLighting",
+ "feSpotLight",
+ "feTile",
+ "feTurbulence",
+ "filter",
+ "foreignObject",
+ "g",
+ "image",
+ "line",
+ "linearGradient",
+ "marker",
+ "mask",
+ "metadata",
+ "mpath",
+ "path",
+ "pattern",
+ "polygon",
+ "polyline",
+ "radialGradient",
+ "rect",
+ "script",
+ "set",
+ "stop",
+ "style",
+ "svg",
+ "switch",
+ "symbol",
+ "text",
+ "textPath",
+ "title",
+ "tspan",
+ "use",
+ "view"
+]
diff --git a/package.json b/package.json
index a1b04d855..89ed35344 100644
--- a/package.json
+++ b/package.json
@@ -89,7 +89,7 @@
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.6.2",
- "typescript": "^4.9.3",
+ "typescript": "^5.0.4",
"vitepress": "^1.0.0-alpha.29"
}
}
diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js
index d9114810b..3ddc74dca 100644
--- a/tests/lib/rules/no-reserved-component-names.js
+++ b/tests/lib/rules/no-reserved-component-names.js
@@ -279,8 +279,6 @@ const invalidElements = [
'Defs',
'desc',
'Desc',
- 'discard',
- 'Discard',
'ellipse',
'Ellipse',
'feBlend',
@@ -352,8 +350,6 @@ const invalidElements = [
'textPath',
'tspan',
'Tspan',
- 'unknown',
- 'Unknown',
'use',
'Use',
'view',
diff --git a/tools/update-resources.js b/tools/update-resources.js
new file mode 100644
index 000000000..42ae300c9
--- /dev/null
+++ b/tools/update-resources.js
@@ -0,0 +1,81 @@
+'use strict'
+
+const fs = require('fs')
+
+const libDomDTsText = fs.readFileSync(
+ require.resolve('typescript/lib/lib.dom.d.ts'),
+ 'utf8'
+)
+
+// ------------------------------------------------------------------------------
+// Update deprecated-html-elements.json
+// ------------------------------------------------------------------------------
+updateDeprecatedHTMLElements()
+function updateDeprecatedHTMLElements() {
+ const DEPRECATED_HTML_ELEMENTS_PATH = require.resolve(
+ '../lib/utils/deprecated-html-elements.json'
+ )
+ const elements = new Set()
+ const deprecatedHtmlElementTagNameMapText =
+ /interface\s+HTMLElementDeprecatedTagNameMap\s+\{([\s\S]*?)\}/u.exec(
+ libDomDTsText
+ )
+ const strPattern = /"([^"]+)"/gu
+ let result
+ while ((result = strPattern.exec(deprecatedHtmlElementTagNameMapText))) {
+ elements.add(result[1])
+ }
+ fs.writeFileSync(
+ DEPRECATED_HTML_ELEMENTS_PATH,
+ `${JSON.stringify([...elements].sort(), null, 2)}\n`,
+ 'utf8'
+ )
+}
+
+// ------------------------------------------------------------------------------
+// Update html-elements.json
+// ------------------------------------------------------------------------------
+updateHTMLElements()
+function updateHTMLElements() {
+ const HTML_ELEMENTS_PATH = require.resolve('../lib/utils/html-elements.json')
+ const elements = new Set()
+ const deprecatedHtmlElements = new Set(
+ require('../lib/utils/deprecated-html-elements.json')
+ )
+ const htmlElementTagNameMapText =
+ /interface\s+HTMLElementTagNameMap\s+\{([\s\S]*?)\}/u.exec(libDomDTsText)
+ const strPattern = /"([^"]+)"/gu
+ let result
+ while ((result = strPattern.exec(htmlElementTagNameMapText))) {
+ if (deprecatedHtmlElements.has(result[1])) {
+ continue
+ }
+ elements.add(result[1])
+ }
+ fs.writeFileSync(
+ HTML_ELEMENTS_PATH,
+ `${JSON.stringify([...elements].sort(), null, 2)}\n`,
+ 'utf8'
+ )
+}
+
+// ------------------------------------------------------------------------------
+// Update svg-elements.json
+// ------------------------------------------------------------------------------
+updateSVGElements()
+function updateSVGElements() {
+ const SVG_ELEMENTS_PATH = require.resolve('../lib/utils/svg-elements.json')
+ const elements = new Set()
+ const svgElementTagNameMapText =
+ /interface\s+SVGElementTagNameMap\s+\{([\s\S]*?)\}/u.exec(libDomDTsText)
+ const strPattern = /"([^"]+)"/gu
+ let result
+ while ((result = strPattern.exec(svgElementTagNameMapText))) {
+ elements.add(result[1])
+ }
+ fs.writeFileSync(
+ SVG_ELEMENTS_PATH,
+ `${JSON.stringify([...elements].sort(), null, 2)}\n`,
+ 'utf8'
+ )
+}
diff --git a/tools/update.js b/tools/update.js
index 266aedbcc..60b1cef58 100644
--- a/tools/update.js
+++ b/tools/update.js
@@ -10,6 +10,7 @@ require('./update-lib-configs')
require('./update-lib-index')
require('./update-docs')
require('./update-docs-rules-index')
+require('./update-resources')
if (process.env.IN_VERSION_SCRIPT) {
require('./update-vue3-export-names')