@markuplint/rules
Advanced tools
Comparing version 1.0.0-alpha.44 to 1.0.0-alpha.45
@@ -100,3 +100,3 @@ "use strict"; | ||
} | ||
_node = node.parentNode; | ||
_node = _node.parentNode; | ||
} | ||
@@ -103,0 +103,0 @@ } |
@@ -13,3 +13,3 @@ declare const _default: (import("@markuplint/ml-core").MLRule<boolean, import("./attr-spacing").AttrSpasingOptions> | import("@markuplint/ml-core").MLRule<boolean, null> | import("@markuplint/ml-core").MLRule<import("./class-naming").Value, null> | import("@markuplint/ml-core").MLRule<"always", { | ||
}> | import("@markuplint/ml-core").MLRule<boolean, { | ||
ignoreRoles: ("main" | "banner" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]; | ||
ignoreRoles: ("banner" | "main" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]; | ||
labelEachArea: boolean; | ||
@@ -16,0 +16,0 @@ }> | import("@markuplint/ml-core").MLRule<import("@markuplint/ml-spec").PermittedStructuresSchema[], { |
@@ -1,2 +0,3 @@ | ||
declare const _default: import("@markuplint/ml-core").MLRule<string | string[], null>; | ||
declare type RequiredAttributes = string | string[]; | ||
declare const _default: import("@markuplint/ml-core").MLRule<RequiredAttributes, null>; | ||
export default _default; |
@@ -23,2 +23,3 @@ "use strict"; | ||
for (const spec of attributeSpecs) { | ||
const didntHave = !node.hasAttribute(spec.name); | ||
let invalid = false; | ||
@@ -29,4 +30,10 @@ if (spec.requiredEither) { | ||
} | ||
else if (spec.required === true) { | ||
invalid = helpers_1.attrMatches(node, spec.condition) && didntHave; | ||
} | ||
else if (spec.required) { | ||
invalid = helpers_1.attrMatches(node, spec.condition) && !node.hasAttribute(spec.name); | ||
if (spec.required.ancestor) { | ||
const ancestors = spec.required.ancestor.split(',').map(a => a.trim()); | ||
invalid = ancestors.some(a => node.closest(a)) && didntHave; | ||
} | ||
} | ||
@@ -33,0 +40,0 @@ if (invalid) { |
{ | ||
"name": "@markuplint/rules", | ||
"version": "1.0.0-alpha.44", | ||
"version": "1.0.0-alpha.45", | ||
"description": "Rules for markuplint", | ||
@@ -20,12 +20,12 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"dependencies": { | ||
"@markuplint/ml-spec": "^1.0.0-alpha.10" | ||
"@markuplint/ml-spec": "^1.0.0-alpha.11" | ||
}, | ||
"devDependencies": { | ||
"@markuplint/html-spec": "^1.0.0-alpha.26", | ||
"@markuplint/ml-core": "^1.0.0-alpha.30", | ||
"@markuplint/pug-parser": "^1.0.0-alpha.9", | ||
"@markuplint/vue-parser": "^1.0.0-alpha.17", | ||
"@markuplint/vue-spec": "^1.0.0-alpha.2" | ||
"@markuplint/html-spec": "^1.0.0-alpha.27", | ||
"@markuplint/ml-core": "^1.0.0-alpha.31", | ||
"@markuplint/pug-parser": "^1.0.0-alpha.10", | ||
"@markuplint/vue-parser": "^1.0.0-alpha.18", | ||
"@markuplint/vue-spec": "^1.0.0-alpha.3" | ||
}, | ||
"gitHead": "0ba006fa8ad417c59015088c41d01a1add390bdc" | ||
"gitHead": "f50f02f36f67397d1e6ed1b0e52dfbb638220c17" | ||
} |
Sorry, the diff of this file is not supported yet
58
2593
369609