diff --git a/packages/@markuplint/astro-parser/package.json b/packages/@markuplint/astro-parser/package.json index 8198d0d30..baf849d0b 100644 --- a/packages/@markuplint/astro-parser/package.json +++ b/packages/@markuplint/astro-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/astro-parser", - "version": "4.0.1", + "version": "4.0.2", "description": "astro parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,8 +21,8 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "astro-eslint-parser": "^0.16.2" }, "devDependencies": { diff --git a/packages/@markuplint/astro-parser/src/parser.spec.ts b/packages/@markuplint/astro-parser/src/parser.spec.ts index 5d9f8416c..fa84fb3a0 100644 --- a/packages/@markuplint/astro-parser/src/parser.spec.ts +++ b/packages/@markuplint/astro-parser/src/parser.spec.ts @@ -638,4 +638,10 @@ describe('Issue', () => { '[1:23]>[1:29](22,28)div: ', ]); }); + + test('#1451', () => { + expect(parse('
').nodeList[0].elementType).toBe('html'); + expect(parse('').nodeList[0].elementType).toBe('web-component'); + expect(parse('
').nodeList[0].elementType).toBe('authored'); + }); }); diff --git a/packages/@markuplint/astro-parser/src/parser.ts b/packages/@markuplint/astro-parser/src/parser.ts index 620dd5f4f..3c347a69e 100644 --- a/packages/@markuplint/astro-parser/src/parser.ts +++ b/packages/@markuplint/astro-parser/src/parser.ts @@ -263,6 +263,18 @@ class AstroParser extends Parser { }; } + /** + * > Variable names must be capitalized. For example, use `Element`, not `element`. + * > Otherwise, Astro will try to render your variable name as a literal HTML tag. + * + * @see https://docs.astro.build/en/basics/astro-syntax/#dynamic-html + * @param nodeName + * @param defaultPattern + */ + detectElementType(nodeName: string) { + return super.detectElementType(nodeName, /^[A-Z]/); + } + #updateScopeNS( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types originNode: Node, diff --git a/packages/@markuplint/cli-utils/package.json b/packages/@markuplint/cli-utils/package.json index f150802bc..da40c2d8f 100644 --- a/packages/@markuplint/cli-utils/package.json +++ b/packages/@markuplint/cli-utils/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/cli-utils", - "version": "4.0.0", + "version": "4.0.1", "description": "Utilities for CLI of Markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/create-rule/package.json b/packages/@markuplint/create-rule/package.json index 6f620a2ba..28377159a 100644 --- a/packages/@markuplint/create-rule/package.json +++ b/packages/@markuplint/create-rule/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/create-rule", - "version": "4.0.2", + "version": "4.0.3", "description": "Rule generator for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -25,8 +25,8 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/cli-utils": "4.0.0", - "@markuplint/ml-core": "4.0.2", + "@markuplint/cli-utils": "4.0.1", + "@markuplint/ml-core": "4.0.3", "glob": "^10.3.6", "prettier": "^3.2.5", "ts-node": "^10.9.2", diff --git a/packages/@markuplint/ejs-parser/package.json b/packages/@markuplint/ejs-parser/package.json index 17767c7b0..e6f6d1e75 100644 --- a/packages/@markuplint/ejs-parser/package.json +++ b/packages/@markuplint/ejs-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/ejs-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "EJS parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/erb-parser/package.json b/packages/@markuplint/erb-parser/package.json index 5d644196b..7fc41c75b 100644 --- a/packages/@markuplint/erb-parser/package.json +++ b/packages/@markuplint/erb-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/erb-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "eRuby template parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/esm-adapter/package.json b/packages/@markuplint/esm-adapter/package.json index 3c61c575a..186e0484e 100644 --- a/packages/@markuplint/esm-adapter/package.json +++ b/packages/@markuplint/esm-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/esm-adapter", - "version": "4.0.0", + "version": "4.0.1", "description": "A library for utilizing ESM-converted Markuplint modules through a subprocess from a CJS environment", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/file-resolver/package.json b/packages/@markuplint/file-resolver/package.json index 5dcfc99ce..9f3b07a86 100644 --- a/packages/@markuplint/file-resolver/package.json +++ b/packages/@markuplint/file-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/file-resolver", - "version": "4.0.2", + "version": "4.0.3", "description": "The file resolver of markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -27,14 +27,14 @@ "@types/node": "20.11.17" }, "dependencies": { - "@markuplint/html-parser": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/ml-config": "4.0.0", - "@markuplint/ml-core": "4.0.2", - "@markuplint/ml-spec": "4.0.0", - "@markuplint/parser-utils": "4.0.0", - "@markuplint/selector": "4.0.0", - "@markuplint/shared": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/ml-config": "4.0.1", + "@markuplint/ml-core": "4.0.3", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/parser-utils": "4.0.1", + "@markuplint/selector": "4.0.1", + "@markuplint/shared": "4.0.1", "cosmiconfig": "^9.0.0", "debug": "^4.3.4", "glob": "^10.3.6", diff --git a/packages/@markuplint/html-parser/package.json b/packages/@markuplint/html-parser/package.json index cfe820e69..1d37ad082 100644 --- a/packages/@markuplint/html-parser/package.json +++ b/packages/@markuplint/html-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/html-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "HTML parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -25,8 +25,8 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "parse5": "7.1.2", "type-fest": "^4.10.2" } diff --git a/packages/@markuplint/html-spec/package.json b/packages/@markuplint/html-spec/package.json index bdd57ef7f..d1d48629d 100644 --- a/packages/@markuplint/html-spec/package.json +++ b/packages/@markuplint/html-spec/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/html-spec", - "version": "4.0.1", + "version": "4.0.2", "description": "A specification of HTML Living Standard for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -17,10 +17,10 @@ "gen:prettier": "prettier --write index.json" }, "devDependencies": { - "@markuplint/spec-generator": "4.0.0", - "@markuplint/test-tools": "4.0.0" + "@markuplint/spec-generator": "4.0.1", + "@markuplint/test-tools": "4.0.1" }, "dependencies": { - "@markuplint/ml-spec": "4.0.0" + "@markuplint/ml-spec": "4.0.1" } } diff --git a/packages/@markuplint/i18n/package.json b/packages/@markuplint/i18n/package.json index f2b3c7a3d..184e800e7 100644 --- a/packages/@markuplint/i18n/package.json +++ b/packages/@markuplint/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/i18n", - "version": "4.0.0", + "version": "4.0.1", "description": "Internationalization for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/jsx-parser/package.json b/packages/@markuplint/jsx-parser/package.json index 84490c2a7..c92c8401e 100644 --- a/packages/@markuplint/jsx-parser/package.json +++ b/packages/@markuplint/jsx-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/jsx-parser", - "version": "4.0.2", + "version": "4.0.3", "description": "JSX parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "@typescript-eslint/types": "^6.21.0", "@typescript-eslint/typescript-estree": "^6.21.0" } diff --git a/packages/@markuplint/jsx-parser/src/index.spec.ts b/packages/@markuplint/jsx-parser/src/index.spec.ts index d10dccae4..b3f014e92 100644 --- a/packages/@markuplint/jsx-parser/src/index.spec.ts +++ b/packages/@markuplint/jsx-parser/src/index.spec.ts @@ -618,4 +618,10 @@ const C = () => { };`); expect(nodeListToDebugMaps(doc.nodeList, true)).toStrictEqual(['[9:10]>[9:17](148,155)div: ']); }); + + test('#1451', () => { + expect(parse('
').nodeList[0].elementType).toBe('html'); + expect(parse('').nodeList[0].elementType).toBe('web-component'); + expect(parse('
').nodeList[0].elementType).toBe('authored'); + }); }); diff --git a/packages/@markuplint/jsx-parser/src/parser.ts b/packages/@markuplint/jsx-parser/src/parser.ts index 79d72dcb3..ab45eff4f 100644 --- a/packages/@markuplint/jsx-parser/src/parser.ts +++ b/packages/@markuplint/jsx-parser/src/parser.ts @@ -1,5 +1,5 @@ import type { JSXComment, JSXNode } from './jsx.js'; -import type { ElementType, MLASTNodeTreeItem, MLASTParentNode } from '@markuplint/ml-ast'; +import type { MLASTNodeTreeItem, MLASTParentNode } from '@markuplint/ml-ast'; import type { ChildToken, Token } from '@markuplint/parser-utils'; import { getNamespace } from '@markuplint/html-parser'; @@ -289,14 +289,17 @@ class JSXParser extends Parser { }); } - detectElementType(nodeName: string): ElementType { - return super.detectElementType( - nodeName, - /** - * @see https://reactjs.org/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized - */ - /^[A-Z]|\./, - ); + /** + * > We recommend naming components with a capital letter. + * > If you do have a component that starts with a lowercase letter, + * > assign it to a capitalized variable before using it in JSX. + * + * @see https://reactjs.org/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized + * @param nodeName + * @returns + */ + detectElementType(nodeName: string) { + return super.detectElementType(nodeName, /^[A-Z]|\./); } } diff --git a/packages/@markuplint/liquid-parser/package.json b/packages/@markuplint/liquid-parser/package.json index 7f5a4c6b5..6eaa5ae9c 100644 --- a/packages/@markuplint/liquid-parser/package.json +++ b/packages/@markuplint/liquid-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/liquid-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "Liquid template parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/ml-ast/package.json b/packages/@markuplint/ml-ast/package.json index 6fe060b0a..d660fecc0 100644 --- a/packages/@markuplint/ml-ast/package.json +++ b/packages/@markuplint/ml-ast/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/ml-ast", - "version": "4.0.0", + "version": "4.0.1", "description": "The markuplint AST types.", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/ml-config/package.json b/packages/@markuplint/ml-config/package.json index 3e7d7e840..4fd543055 100644 --- a/packages/@markuplint/ml-config/package.json +++ b/packages/@markuplint/ml-config/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/ml-config", - "version": "4.0.0", + "version": "4.0.1", "description": "JSON Schema and TypeScript types of markuplint configure JSON", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -24,9 +24,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-ast": "4.0.0", - "@markuplint/selector": "4.0.0", - "@markuplint/shared": "4.0.0", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/selector": "4.0.1", + "@markuplint/shared": "4.0.1", "@types/mustache": "^4.2.5", "deepmerge": "^4.3.1", "is-plain-object": "^5.0.0", diff --git a/packages/@markuplint/ml-core/package.json b/packages/@markuplint/ml-core/package.json index 51a47928a..6c20b0a17 100644 --- a/packages/@markuplint/ml-core/package.json +++ b/packages/@markuplint/ml-core/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/ml-core", - "version": "4.0.2", + "version": "4.0.3", "description": "The core module of markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -29,14 +29,14 @@ }, "dependencies": { "@markuplint/config-presets": "4.0.1", - "@markuplint/html-parser": "4.0.0", - "@markuplint/html-spec": "4.0.1", - "@markuplint/i18n": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/ml-config": "4.0.0", - "@markuplint/ml-spec": "4.0.0", - "@markuplint/parser-utils": "4.0.0", - "@markuplint/selector": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/html-spec": "4.0.2", + "@markuplint/i18n": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/ml-config": "4.0.1", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/parser-utils": "4.0.1", + "@markuplint/selector": "4.0.1", "@types/debug": "^4.1.12", "debug": "^4.3.4", "is-plain-object": "^5.0.0", diff --git a/packages/@markuplint/ml-spec/package.json b/packages/@markuplint/ml-spec/package.json index fac9ccf98..110e02233 100644 --- a/packages/@markuplint/ml-spec/package.json +++ b/packages/@markuplint/ml-spec/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/ml-spec", - "version": "4.0.0", + "version": "4.0.1", "description": "Types and schema that specs of the Markup languages for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -32,14 +32,14 @@ "schema:prettier": "prettier --write \"./schemas/*.json\" \"./src/types/*.ts\" --log-level warn" }, "dependencies": { - "@markuplint/ml-ast": "4.0.0", - "@markuplint/types": "4.0.0", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/types": "4.0.1", "dom-accessibility-api": "^0.6.3", "is-plain-object": "^5.0.0", "type-fest": "^4.10.2" }, "devDependencies": { - "@markuplint/test-tools": "4.0.0", + "@markuplint/test-tools": "4.0.1", "json-schema-to-typescript": "13.1.2" } } diff --git a/packages/@markuplint/mustache-parser/package.json b/packages/@markuplint/mustache-parser/package.json index edd193b48..af1731c44 100644 --- a/packages/@markuplint/mustache-parser/package.json +++ b/packages/@markuplint/mustache-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/mustache-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "The mustache template parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/nunjucks-parser/package.json b/packages/@markuplint/nunjucks-parser/package.json index 0a3aa8731..199e5528b 100644 --- a/packages/@markuplint/nunjucks-parser/package.json +++ b/packages/@markuplint/nunjucks-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/nunjucks-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "Nunjucks template parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/parser-utils/package.json b/packages/@markuplint/parser-utils/package.json index 1d3bc8706..f1598117c 100644 --- a/packages/@markuplint/parser-utils/package.json +++ b/packages/@markuplint/parser-utils/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/parser-utils", - "version": "4.0.0", + "version": "4.0.1", "description": "Utility module for markuplint parser plugin", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -27,9 +27,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-ast": "4.0.0", - "@markuplint/ml-spec": "4.0.0", - "@markuplint/types": "4.0.0", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/types": "4.0.1", "@types/uuid": "^9.0.8", "debug": "^4.3.4", "espree": "^10.0.0", diff --git a/packages/@markuplint/php-parser/package.json b/packages/@markuplint/php-parser/package.json index 456226460..70daaf70b 100644 --- a/packages/@markuplint/php-parser/package.json +++ b/packages/@markuplint/php-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/php-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "PHP parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/pug-parser/package.json b/packages/@markuplint/pug-parser/package.json index dbb52aadb..fa608af8e 100644 --- a/packages/@markuplint/pug-parser/package.json +++ b/packages/@markuplint/pug-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/pug-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "Pug parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "pug-lexer": "^5.0.1", "pug-parser": "^6.0.0" } diff --git a/packages/@markuplint/react-spec/package.json b/packages/@markuplint/react-spec/package.json index a747d6ed7..ed557415b 100644 --- a/packages/@markuplint/react-spec/package.json +++ b/packages/@markuplint/react-spec/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/react-spec", - "version": "4.0.0", + "version": "4.0.1", "description": "Extended specification for tags and attributes in React", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,6 +21,6 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-spec": "4.0.0" + "@markuplint/ml-spec": "4.0.1" } } diff --git a/packages/@markuplint/rule-textlint/package.json b/packages/@markuplint/rule-textlint/package.json index 4b2790123..04900b33c 100644 --- a/packages/@markuplint/rule-textlint/package.json +++ b/packages/@markuplint/rule-textlint/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/rule-textlint", - "version": "4.0.2", + "version": "4.0.3", "description": "The rule plugin that adapts textlint in markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -20,11 +20,11 @@ "clean": "tsc --build --clean" }, "devDependencies": { - "markuplint": "4.0.2", + "markuplint": "4.0.3", "textlint-rule-prh": "5" }, "dependencies": { - "@markuplint/ml-core": "4.0.2", + "@markuplint/ml-core": "4.0.3", "@textlint/kernel": "13", "textlint-plugin-html": "^1.0.0" } diff --git a/packages/@markuplint/rules/package.json b/packages/@markuplint/rules/package.json index caf9a530f..069185e3b 100644 --- a/packages/@markuplint/rules/package.json +++ b/packages/@markuplint/rules/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/rules", - "version": "4.0.2", + "version": "4.0.3", "description": "Built-in rules of markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -25,12 +25,12 @@ "./lib/permitted-contents/debug.js": "./lib/permitted-contents/debug.browser.js" }, "dependencies": { - "@markuplint/html-spec": "4.0.1", - "@markuplint/ml-core": "4.0.2", - "@markuplint/ml-spec": "4.0.0", - "@markuplint/selector": "4.0.0", - "@markuplint/shared": "4.0.0", - "@markuplint/types": "4.0.0", + "@markuplint/html-spec": "4.0.2", + "@markuplint/ml-core": "4.0.3", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/selector": "4.0.1", + "@markuplint/shared": "4.0.1", + "@markuplint/types": "4.0.1", "@types/debug": "^4.1.12", "@ungap/structured-clone": "^1.2.0", "ansi-colors": "^4.1.3", diff --git a/packages/@markuplint/rules/src/permitted-contents/index.spec.ts b/packages/@markuplint/rules/src/permitted-contents/index.spec.ts index 1bbac9bd4..2f48c2e7d 100644 --- a/packages/@markuplint/rules/src/permitted-contents/index.spec.ts +++ b/packages/@markuplint/rules/src/permitted-contents/index.spec.ts @@ -1501,4 +1501,29 @@ describe('Issues', () => { const sourceCode = 'Text'; expect((await mlRuleTest(rule, sourceCode)).violations).toStrictEqual([]); }); + + test('#1451', async () => { + const astro = { parser: { '.*': '@markuplint/astro-parser' } }; + const jsx = { parser: { '.*': '@markuplint/jsx-parser' } }; + const pug = { parser: { '.*': '@markuplint/pug-parser' } }; + const svelte = { parser: { '.*': '@markuplint/svelte-parser' } }; + const vue = { parser: { '.*': '@markuplint/vue-parser' } }; + + expect((await mlRuleTest(rule, '
')).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
')).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
', astro)).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
', astro)).violations.length).toBe(0); + expect((await mlRuleTest(rule, '
', jsx)).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
', jsx)).violations.length).toBe(0); + expect((await mlRuleTest(rule, 'span: div', pug)).violations.length).toBe(1); + expect((await mlRuleTest(rule, 'span: Div', pug)).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
', svelte)).violations.length).toBe(1); + expect((await mlRuleTest(rule, '
', svelte)).violations.length).toBe(0); + expect((await mlRuleTest(rule, '', vue)).violations.length).toBe( + 1, + ); + expect((await mlRuleTest(rule, '', vue)).violations.length).toBe( + 0, + ); + }); }); diff --git a/packages/@markuplint/selector/package.json b/packages/@markuplint/selector/package.json index 7620ef947..70a978666 100644 --- a/packages/@markuplint/selector/package.json +++ b/packages/@markuplint/selector/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/selector", - "version": "4.0.0", + "version": "4.0.1", "description": "Extended W3C Selectors matcher", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -25,7 +25,7 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-spec": "4.0.0", + "@markuplint/ml-spec": "4.0.1", "@types/debug": "^4.1.12", "debug": "^4.3.4", "postcss-selector-parser": "^6.0.15", diff --git a/packages/@markuplint/selector/src/is.ts b/packages/@markuplint/selector/src/is.ts index fb90ef6ee..9f4e1c4d2 100644 --- a/packages/@markuplint/selector/src/is.ts +++ b/packages/@markuplint/selector/src/is.ts @@ -12,6 +12,15 @@ export function isNonDocumentTypeChildNode( return 'previousElementSibling' in node && 'nextElementSibling' in node; } +/** + * Checks if the given element is a pure HTML element. + * + * If a pure HTML element, `localName` returns lowercase, + * `nodeName` returns uppercase. + * + * @param el The element to check. + * @returns Returns true if the element is a pure HTML element, otherwise returns false. + */ export function isPureHTMLElement( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types el: Element, diff --git a/packages/@markuplint/shared/package.json b/packages/@markuplint/shared/package.json index 8267d0572..dfb9f5a15 100644 --- a/packages/@markuplint/shared/package.json +++ b/packages/@markuplint/shared/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/shared", - "version": "4.0.0", + "version": "4.0.1", "description": "Shared functions for Markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/smarty-parser/package.json b/packages/@markuplint/smarty-parser/package.json index 30a5e91fb..8a1952b78 100644 --- a/packages/@markuplint/smarty-parser/package.json +++ b/packages/@markuplint/smarty-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/smarty-parser", - "version": "4.0.0", + "version": "4.0.1", "description": "Smarty parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0" + "@markuplint/html-parser": "4.0.1" }, "devDependencies": { - "@markuplint/parser-utils": "4.0.0" + "@markuplint/parser-utils": "4.0.1" } } diff --git a/packages/@markuplint/spec-generator/package.json b/packages/@markuplint/spec-generator/package.json index e2229102b..76e01236b 100644 --- a/packages/@markuplint/spec-generator/package.json +++ b/packages/@markuplint/spec-generator/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/spec-generator", - "version": "4.0.0", + "version": "4.0.1", "description": "Generates @markuplint/html-spec", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -30,8 +30,8 @@ "strip-json-comments": "^5.0.1" }, "devDependencies": { - "@markuplint/ml-spec": "4.0.0", - "@markuplint/test-tools": "4.0.0", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/test-tools": "4.0.1", "@types/cli-progress": "^3.11.5", "type-fest": "^4.10.2" } diff --git a/packages/@markuplint/svelte-parser/package.json b/packages/@markuplint/svelte-parser/package.json index 7003ec123..79bd7211b 100644 --- a/packages/@markuplint/svelte-parser/package.json +++ b/packages/@markuplint/svelte-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/svelte-parser", - "version": "4.0.1", + "version": "4.0.2", "description": "Svelte parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -24,9 +24,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "svelte": "^4.2.10" } } diff --git a/packages/@markuplint/svelte-parser/src/index.spec.ts b/packages/@markuplint/svelte-parser/src/index.spec.ts index 3deb770a9..d54782465 100644 --- a/packages/@markuplint/svelte-parser/src/index.spec.ts +++ b/packages/@markuplint/svelte-parser/src/index.spec.ts @@ -714,4 +714,10 @@ describe('Issues', () => { '[13:1]>[13:6](142,147)#ps:/if: {/if}', ]); }); + + test('#1451', () => { + expect(parse('
').nodeList[0].elementType).toBe('html'); + expect(parse('').nodeList[0].elementType).toBe('web-component'); + expect(parse('
').nodeList[0].elementType).toBe('authored'); + }); }); diff --git a/packages/@markuplint/svelte-parser/src/parser.ts b/packages/@markuplint/svelte-parser/src/parser.ts index fc46c38e6..8927a36be 100644 --- a/packages/@markuplint/svelte-parser/src/parser.ts +++ b/packages/@markuplint/svelte-parser/src/parser.ts @@ -241,8 +241,16 @@ class SvelteParser extends Parser { }; } + /** + * > A lowercase tag, like `
`, denotes a regular HTML element. + * A capitalised tag, such as `` or ``, indicates a component. + * + * @see https://svelte.io/docs/basic-markup#tags + * @param nodeName + * @returns + */ detectElementType(nodeName: string) { - return super.detectElementType(nodeName, /[.A-Z]/); + return super.detectElementType(nodeName, /^[A-Z]|\./); } visitExpression( diff --git a/packages/@markuplint/svelte-spec/package.json b/packages/@markuplint/svelte-spec/package.json index 9e64c82b8..ce7982b5e 100644 --- a/packages/@markuplint/svelte-spec/package.json +++ b/packages/@markuplint/svelte-spec/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/svelte-spec", - "version": "4.0.1", + "version": "4.0.2", "description": "Extended specification for tags and attributes in Svelte", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,6 +21,6 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-spec": "4.0.0" + "@markuplint/ml-spec": "4.0.1" } } diff --git a/packages/@markuplint/test-tools/package.json b/packages/@markuplint/test-tools/package.json index e5d6b7bf5..d4e92833b 100644 --- a/packages/@markuplint/test-tools/package.json +++ b/packages/@markuplint/test-tools/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/test-tools", - "version": "4.0.0", + "version": "4.0.1", "description": "A private package for testing in this repository", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/types/package.json b/packages/@markuplint/types/package.json index d32ae1376..3e78f12a6 100644 --- a/packages/@markuplint/types/package.json +++ b/packages/@markuplint/types/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/types", - "version": "4.0.0", + "version": "4.0.1", "description": "Type declaration and value checker", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", diff --git a/packages/@markuplint/vue-parser/package.json b/packages/@markuplint/vue-parser/package.json index 129cec776..474caf377 100644 --- a/packages/@markuplint/vue-parser/package.json +++ b/packages/@markuplint/vue-parser/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/vue-parser", - "version": "4.0.1", + "version": "4.0.2", "description": "Vue parser for markuplint", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,9 +21,9 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/html-parser": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/parser-utils": "4.0.0", + "@markuplint/html-parser": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/parser-utils": "4.0.1", "vue-eslint-parser": "^9.4.2" } } diff --git a/packages/@markuplint/vue-parser/src/index.spec.ts b/packages/@markuplint/vue-parser/src/index.spec.ts index 99ae924f6..8b82c2e3b 100644 --- a/packages/@markuplint/vue-parser/src/index.spec.ts +++ b/packages/@markuplint/vue-parser/src/index.spec.ts @@ -602,4 +602,10 @@ h3 { '[15:9]>[16:1](374,375)#text: ⏎', ]); }); + + test('#1451', () => { + expect(parse('').nodeList[0].elementType).toBe('html'); + expect(parse('').nodeList[0].elementType).toBe('web-component'); + expect(parse('').nodeList[0].elementType).toBe('authored'); + }); }); diff --git a/packages/@markuplint/vue-parser/src/parser.ts b/packages/@markuplint/vue-parser/src/parser.ts index 7bcff6cf2..a4f99543f 100644 --- a/packages/@markuplint/vue-parser/src/parser.ts +++ b/packages/@markuplint/vue-parser/src/parser.ts @@ -256,15 +256,30 @@ class VueParser extends Parser { return attr; } + /** + * > In SFCs, it's recommended to use `PascalCase` tag names + * > for child components to differentiate from native HTML elements. + * > Although native HTML tag names are case-insensitive, + * > Vue SFC is a compiled format so we are able to use case-sensitive tag names in it. + * > We are also able to use `/>` to close a tag. + * + * @see https://vuejs.org/guide/essentials/component-basics#using-a-component + * @see https://vuejs.org/api/built-in-components.html + * @see https://vuejs.org/api/built-in-special-elements.html#built-in-special-elements + * @param nodeName + * @returns + */ detectElementType(nodeName: string) { return super.detectElementType(nodeName, [ - 'component', - 'slot', + // Built-in components 'Transition', 'TransitionGroup', 'KeepAlive', 'Teleport', 'Suspense', + // Special elements + 'component', + 'slot', // Backward compatibility /^[A-Z]/, ]); diff --git a/packages/@markuplint/vue-spec/package.json b/packages/@markuplint/vue-spec/package.json index b87ef6771..d87ae7b1b 100644 --- a/packages/@markuplint/vue-spec/package.json +++ b/packages/@markuplint/vue-spec/package.json @@ -1,6 +1,6 @@ { "name": "@markuplint/vue-spec", - "version": "4.0.0", + "version": "4.0.1", "description": "Extended specification for tags and attributes in Vue", "repository": "git@github.com:markuplint/markuplint.git", "author": "Yusuke Hirao ", @@ -21,6 +21,6 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/ml-spec": "4.0.0" + "@markuplint/ml-spec": "4.0.1" } } diff --git a/packages/markuplint/package.json b/packages/markuplint/package.json index f6f05d655..25b59759a 100644 --- a/packages/markuplint/package.json +++ b/packages/markuplint/package.json @@ -1,6 +1,6 @@ { "name": "markuplint", - "version": "4.0.2", + "version": "4.0.3", "description": "An HTML linter for all markup developers", "author": "Yusuke Hirao", "license": "MIT", @@ -25,17 +25,17 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@markuplint/cli-utils": "4.0.0", - "@markuplint/file-resolver": "4.0.2", - "@markuplint/html-parser": "4.0.0", - "@markuplint/html-spec": "4.0.1", - "@markuplint/i18n": "4.0.0", - "@markuplint/ml-ast": "4.0.0", - "@markuplint/ml-config": "4.0.0", - "@markuplint/ml-core": "4.0.2", - "@markuplint/ml-spec": "4.0.0", - "@markuplint/rules": "4.0.2", - "@markuplint/shared": "4.0.0", + "@markuplint/cli-utils": "4.0.1", + "@markuplint/file-resolver": "4.0.3", + "@markuplint/html-parser": "4.0.1", + "@markuplint/html-spec": "4.0.2", + "@markuplint/i18n": "4.0.1", + "@markuplint/ml-ast": "4.0.1", + "@markuplint/ml-config": "4.0.1", + "@markuplint/ml-core": "4.0.3", + "@markuplint/ml-spec": "4.0.1", + "@markuplint/rules": "4.0.3", + "@markuplint/shared": "4.0.1", "@types/debug": "^4.1.12", "chokidar": "^3.6.0", "debug": "^4.3.4", diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 6f68f2ffc..752760ae6 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 4.0.3 + +- Depends: `markuplint@4.0.3` + ## 4.0.2 - Depends: `markuplint@4.0.2` diff --git a/vscode/README.md b/vscode/README.md index 31c53d09a..24877ae07 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -13,6 +13,10 @@ ## Release Notes +### 4.0.3 + +- Depends: `markuplint@4.0.3` + ### 4.0.2 - Depends: `markuplint@4.0.2` diff --git a/vscode/package.json b/vscode/package.json index 15503cda0..16b2f0ffe 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,7 +2,7 @@ "name": "vscode-markuplint", "displayName": "Markuplint", "description": "Markuplint for VS Code", - "version": "4.0.2", + "version": "4.0.3", "publisher": "yusukehirao", "license": "MIT", "private": true, @@ -109,7 +109,7 @@ "vscode:release": "vsce publish --no-yarn" }, "devDependencies": { - "@markuplint/file-resolver": "4.0.2", + "@markuplint/file-resolver": "4.0.3", "@types/mocha": "^10.0.6", "@types/node": "18.15", "@types/semver": "7.5.6", @@ -119,10 +119,10 @@ "typescript": "5.3.3" }, "dependencies": { - "@markuplint/esm-adapter": "4.0.0", + "@markuplint/esm-adapter": "4.0.1", "debug": "^4.3.4", "glob": "^10.3.10", - "markuplint": "4.0.2", + "markuplint": "4.0.3", "mocha": "^10.3.0", "semver": "7.6.0", "vscode-languageclient": "9.0.1",