@markuplint/rules
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -153,2 +153,8 @@ "use strict"; | ||
}); | ||
test('the header element', async () => { | ||
expect(helpers_1.getImplicitRole(test_utils_1.createElement('<header></header>'))).toBe('banner'); | ||
expect(helpers_1.getImplicitRole(test_utils_1.createElement('<header><article></article></header>'))).toBe(false); | ||
expect(helpers_1.getImplicitRole(test_utils_1.createElement('<header><div></div></header>'))).toBe('banner'); | ||
expect(helpers_1.getImplicitRole(test_utils_1.createElement('<header><div role="article"></div></header>'))).toBe(false); | ||
}); | ||
}); | ||
@@ -155,0 +161,0 @@ describe('getComputedRole', () => { |
@@ -1,4 +0,2 @@ | ||
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", { | ||
denyObsolateType: boolean; | ||
}> | import("@markuplint/ml-core").MLRule<import("./indentation").Value, import("./indentation").IndentationOptions> | import("@markuplint/ml-core").MLRule<true, { | ||
declare const _default: (import("@markuplint/ml-core").MLRule<true, { | ||
attrs?: Record<string, { | ||
@@ -12,4 +10,6 @@ enum: string[]; | ||
ignoreAttrNamePrefix?: string | string[] | undefined; | ||
}> | import("@markuplint/ml-core").MLRule<boolean, { | ||
ignoreRoles: ("main" | "complementary" | "banner" | "contentinfo" | "form" | "navigation" | "region")[]; | ||
}> | 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", { | ||
denyObsolateType: boolean; | ||
}> | import("@markuplint/ml-core").MLRule<import("./indentation").Value, import("./indentation").IndentationOptions> | import("@markuplint/ml-core").MLRule<boolean, { | ||
ignoreRoles: ("banner" | "main" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]; | ||
labelEachArea: boolean; | ||
@@ -16,0 +16,0 @@ }> | import("@markuplint/ml-core").MLRule<import("@markuplint/ml-spec").PermittedStructuresSchema[], { |
@@ -36,3 +36,3 @@ "use strict"; | ||
if ('enum' in customRule) { | ||
invalid = type_check_1.typeCheck(name.toLowerCase(), value, { | ||
invalid = type_check_1.typeCheck(name.toLowerCase(), value, true, { | ||
name, | ||
@@ -53,3 +53,3 @@ type: 'String', | ||
else if ('type' in customRule) { | ||
invalid = type_check_1.typeCheck(name, value, { name, type: customRule.type, description: '' }); | ||
invalid = type_check_1.typeCheck(name, value, true, { name, type: customRule.type, description: '' }); | ||
} | ||
@@ -59,3 +59,3 @@ } | ||
const spec = attributeSpecs.find(s => s.name === name); | ||
invalid = type_check_1.typeCheck(name, value, spec); | ||
invalid = type_check_1.typeCheck(name, value, false, spec); | ||
if (!invalid && spec && !helpers_1.attrMatches(node, spec.condition)) { | ||
@@ -62,0 +62,0 @@ invalid = { |
@@ -6,3 +6,3 @@ import { Attribute as AttrSpec } from '@markuplint/ml-spec'; | ||
}; | ||
export declare function typeCheck(name: string, value: string, spec?: AttrSpec): Invalid | false; | ||
export declare function typeCheck(name: string, value: string, isCustomRule: boolean, spec?: AttrSpec): Invalid | false; | ||
/** | ||
@@ -9,0 +9,0 @@ * @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#signed-integers |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nonZeroUintCheck = exports.floatCheck = exports.uintCheck = exports.intCheck = exports.typeCheck = void 0; | ||
function typeCheck(name, value, spec) { | ||
if (/^data-.+$/.test(name)) { | ||
// Ignore checking because "data-*" attribute is any type | ||
return false; | ||
function typeCheck(name, value, isCustomRule, spec) { | ||
if (!isCustomRule) { | ||
if (/^data-.+$/.test(name)) { | ||
// Ignore checking because "data-*" attribute is any type | ||
return false; | ||
} | ||
if (/^aria-.+$|^role$/.test(name)) { | ||
// Ignore checking because ARIA attributes are check on another rule | ||
return false; | ||
} | ||
} | ||
if (/^aria-.+$|^role$/.test(name)) { | ||
// Ignore checking because ARIA attributes are check on another rule | ||
return false; | ||
} | ||
// Existance | ||
@@ -14,0 +16,0 @@ if (!spec) { |
{ | ||
"name": "@markuplint/rules", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Rules for markuplint", | ||
@@ -23,4 +23,4 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"devDependencies": { | ||
"@markuplint/html-spec": "^1.2.0", | ||
"@markuplint/ml-core": "^1.2.0", | ||
"@markuplint/html-spec": "^1.2.1", | ||
"@markuplint/ml-core": "^1.2.1", | ||
"@markuplint/pug-parser": "^1.0.0-alpha.13", | ||
@@ -30,3 +30,3 @@ "@markuplint/vue-parser": "^1.0.0-alpha.21", | ||
}, | ||
"gitHead": "90b7f86d6708e2003cc33ca7aa7da327d590f6b4" | ||
"gitHead": "24493ff069c79ff21f0c20e1602ceb179bce2e8e" | ||
} |
Sorry, the diff of this file is not supported yet
464262
3572