Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update-resources script #2171

Open
wants to merge 8 commits into
base: v10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/check-for-resources-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check for utils resources update
on:
workflow_dispatch: null
schedule:
- cron: 0 0 * * 0 # At 00:00 on Sunday, see https://crontab.guru/#0_0_*_*_0

permissions:
contents: write
pull-requests: write

jobs:
check-for-resources-update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Packages
run: npm install
- name: Update
run: npm run update-resources
- uses: peter-evans/create-pull-request@v7
with:
commit-message: Updates resources with latest
branch: update-unicode-alias
branch-suffix: timestamp
title: Updates resources with latest
8 changes: 3 additions & 5 deletions lib/utils/deprecated-html-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
"big",
"blink",
"center",
"command",
"content",
"dir",
"element",
"font",
"frame",
"frameset",
"image",
"isindex",
"keygen",
"listing",
Expand All @@ -24,8 +20,10 @@
"nobr",
"noembed",
"noframes",
"param",
"plaintext",
"shadow",
"rb",
"rtc",
"spacer",
"strike",
"tt",
Expand Down
164 changes: 80 additions & 84 deletions lib/utils/html-elements.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,116 @@
[
"html",
"body",
"base",
"head",
"link",
"meta",
"style",
"title",
"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",
"fencedframe",
"fieldset",
"figcaption",
"figure",
"footer",
"header",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hgroup",
"nav",
"section",
"div",
"dd",
"dl",
"dt",
"figcaption",
"figure",
"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",
"portal",
"pre",
"ul",
"a",
"b",
"abbr",
"bdi",
"bdo",
"br",
"cite",
"code",
"data",
"dfn",
"em",
"i",
"kbd",
"mark",
"progress",
"q",
"rp",
"rt",
"rtc",
"ruby",
"s",
"samp",
"script",
"search",
"section",
"select",
"slot",
"small",
"source",
"span",
"strong",
"style",
"sub",
"summary",
"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",
"template",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"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"
"track",
"u",
"ul",
"var",
"video",
"wbr"
]
14 changes: 11 additions & 3 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ module.exports = {
* Get the Vue component definition type from given node
* Vue.component('xxx', {}) || component('xxx', {})
* @param {ObjectExpression} node Node to check
* @returns {'component' | 'mixin' | 'extend' | 'createApp' | 'defineComponent' | null}
* @returns {'component' | 'mixin' | 'extend' | 'createApp' | 'defineComponent' | 'defineNuxtComponent' | null}
*/
getVueComponentDefinitionType,
/**
Expand Down Expand Up @@ -2755,7 +2755,7 @@ function isVueComponentFile(node, path) {
* Get the Vue component definition type from given node
* Vue.component('xxx', {}) || component('xxx', {})
* @param {ObjectExpression} node Node to check
* @returns {'component' | 'mixin' | 'extend' | 'createApp' | 'defineComponent' | null}
* @returns {'component' | 'mixin' | 'extend' | 'createApp' | 'defineComponent' | 'defineNuxtComponent' | null}
*/
function getVueComponentDefinitionType(node) {
const parent = getParent(node)
Expand Down Expand Up @@ -2811,6 +2811,12 @@ function getVueComponentDefinitionType(node) {
const isDestructedVueComponent = isObjectArgument(parent)
return isDestructedVueComponent ? 'defineComponent' : null
}
if (callee.name === 'defineNuxtComponent') {
// for Nuxt 3.x
// defineNuxtComponent({})
const isDestructedVueComponent = isObjectArgument(parent)
return isDestructedVueComponent ? 'defineNuxtComponent' : null
}
}
}

Expand Down Expand Up @@ -2955,7 +2961,9 @@ function isSFCObject(context, node) {
}
const { callee } = parent
if (
(callee.type === 'Identifier' && callee.name === 'defineComponent') ||
(callee.type === 'Identifier' &&
(callee.name === 'defineComponent' ||
callee.name === 'defineNuxtComponent')) ||
(callee.type === 'MemberExpression' &&
callee.object.type === 'Identifier' &&
callee.object.name === 'Vue' &&
Expand Down
6 changes: 0 additions & 6 deletions lib/utils/svg-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
"animate",
"animateMotion",
"animateTransform",
"audio",
"canvas",
"circle",
"clipPath",
"defs",
"desc",
"discard",
"ellipse",
"feBlend",
"feColorMatrix",
Expand Down Expand Up @@ -39,7 +36,6 @@
"filter",
"foreignObject",
"g",
"iframe",
"image",
"line",
"linearGradient",
Expand All @@ -64,8 +60,6 @@
"textPath",
"title",
"tspan",
"unknown",
"use",
"video",
"view"
]
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"preversion": "npm test && git add .",
"version": "env-cmd -e version npm run update && npm run lint -- --fix && git add .",
"update": "node ./tools/update.js",
"update-resources": "node ./tools/update-resources.js",
"docs:watch": "vitepress dev docs",
"predocs:build": "npm run update",
"docs:build": "vitepress build docs"
Expand Down Expand Up @@ -90,6 +91,7 @@
"eslint-plugin-vue": "file:.",
"espree": "^9.6.1",
"events": "^3.3.0",
"jsdom": "^22.0.0",
"markdownlint-cli": "^0.42.0",
"mocha": "^10.7.3",
"nyc": "^17.1.0",
Expand Down
12 changes: 0 additions & 12 deletions tests/lib/rules/no-reserved-component-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@ const invalidElements = [
'menuitem',
'summary',
'Summary',
'content',
'Content',
'element',
'Element',
'shadow',
'Shadow',
'template',
'Template',
'slot',
Expand All @@ -278,8 +272,6 @@ const invalidElements = [
'Defs',
'desc',
'Desc',
'discard',
'Discard',
'ellipse',
'Ellipse',
'feBlend',
Expand Down Expand Up @@ -351,8 +343,6 @@ const invalidElements = [
'textPath',
'tspan',
'Tspan',
'unknown',
'Unknown',
'use',
'Use',
'view',
Expand All @@ -373,8 +363,6 @@ const invalidElements = [
'Blink',
'center',
'Center',
'command',
'Command',
FloEdelmann marked this conversation as resolved.
Show resolved Hide resolved
'dir',
'Dir',
'font',
Expand Down
Loading