@markuplint/rules
Advanced tools
Comparing version
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, Record<string, { | ||
enum: string[]; | ||
} | { | ||
pattern: string; | ||
} | { | ||
type: import("@markuplint/ml-spec/src").AttributeType; | ||
}>> | import("@markuplint/ml-core").MLRule<boolean, { | ||
}> | import("@markuplint/ml-core").MLRule<import("./indentation").Value, import("./indentation").IndentationOptions> | import("@markuplint/ml-core").MLRule<true, { | ||
attrs?: Record<string, { | ||
enum: string[]; | ||
} | { | ||
pattern: string; | ||
} | { | ||
type: import("@markuplint/ml-spec/src").AttributeType; | ||
}> | undefined; | ||
ignoreAttrNamePrefix?: string | string[] | undefined; | ||
}> | import("@markuplint/ml-core").MLRule<boolean, { | ||
ignoreRoles: ("banner" | "main" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]; | ||
@@ -11,0 +14,0 @@ labelEachArea: boolean; |
import { AttributeType } from '@markuplint/ml-spec/src'; | ||
declare type Option = { | ||
attrs?: Record<string, Rule>; | ||
ignoreAttrNamePrefix?: string | string[]; | ||
}; | ||
declare type Rule = { | ||
@@ -9,3 +13,3 @@ enum: string[]; | ||
}; | ||
declare const _default: import("@markuplint/ml-core").MLRule<true, Record<string, Rule>>; | ||
declare const _default: import("@markuplint/ml-core").MLRule<true, Option>; | ||
export default _default; |
@@ -16,5 +16,13 @@ "use strict"; | ||
for (const attr of node.attributes) { | ||
const name = attr.name.raw.toLowerCase(); | ||
if (node.rule.option.ignoreAttrNamePrefix) { | ||
const ignoreAttrNamePrefixes = Array.isArray(node.rule.option.ignoreAttrNamePrefix) | ||
? node.rule.option.ignoreAttrNamePrefix | ||
: [node.rule.option.ignoreAttrNamePrefix]; | ||
if (ignoreAttrNamePrefixes.some(prefix => name.indexOf(prefix) === 0)) { | ||
continue; | ||
} | ||
} | ||
let invalid = false; | ||
const name = attr.name.raw.toLowerCase(); | ||
const customRule = node.rule.option[name]; | ||
const customRule = node.rule.option.attrs ? node.rule.option.attrs[name] : null; | ||
if (customRule) { | ||
@@ -21,0 +29,0 @@ if ('enum' in customRule) { |
{ | ||
"name": "@markuplint/rules", | ||
"version": "1.0.0-alpha.29", | ||
"version": "1.0.0-alpha.30", | ||
"description": "Rules for markuplint", | ||
@@ -28,3 +28,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
}, | ||
"gitHead": "2b9b334ad921139c38f19fbbd9bd9d81c425be44" | ||
"gitHead": "e7ac08629d8c9736023d2087cd2f505f13b131ec" | ||
} |
Sorry, the diff of this file is not supported yet
355984
0.2%2422
0.62%