@markuplint/rules
Advanced tools
Comparing version 1.0.0-alpha.9 to 1.0.0-alpha.10
@@ -1,3 +0,5 @@ | ||
export declare type Value = 'always' | 'never'; | ||
declare const _default: import("@markuplint/ml-core").MLRule<"always" | "never", null>; | ||
declare type Option = { | ||
denyObsolateType: boolean; | ||
}; | ||
declare const _default: import("@markuplint/ml-core").MLRule<"always", Option>; | ||
export default _default; |
@@ -43,39 +43,36 @@ "use strict"; | ||
defaultValue: 'always', | ||
defaultOptions: null, | ||
defaultOptions: { | ||
denyObsolateType: true, | ||
}, | ||
verify: function (document, messages, rule) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var reports, message, has; | ||
var _this = this; | ||
var doctype; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
reports = []; | ||
message = messages('error'); | ||
has = false; | ||
if (!!document.isFragment) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, document.walk(function (node) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (node instanceof ml_core_1.Doctype) { | ||
has = true; | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
if (rule.value === 'never') { | ||
has = !has; | ||
} | ||
if (!has) { | ||
reports.push({ | ||
if (document.isFragment) { | ||
return [2 /*return*/, []]; | ||
} | ||
doctype = document.doctype; | ||
if (!doctype) { | ||
return [2 /*return*/, [ | ||
{ | ||
severity: rule.severity, | ||
message: message, | ||
message: messages('Missing doctype'), | ||
line: 1, | ||
col: 1, | ||
raw: '', | ||
}); | ||
} | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, reports]; | ||
}, | ||
]]; | ||
} | ||
if ((doctype.name.toLowerCase() === 'html' && doctype.publicId) || doctype.systemId) { | ||
return [2 /*return*/, [ | ||
{ | ||
severity: rule.severity, | ||
message: messages('Never declarate obsolete Doctype'), | ||
line: doctype.startLine, | ||
col: doctype.startCol, | ||
raw: doctype.raw, | ||
}, | ||
]]; | ||
} | ||
return [2 /*return*/, []]; | ||
}); | ||
@@ -82,0 +79,0 @@ }); |
@@ -1,2 +0,4 @@ | ||
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<import("./indentation").Value, import("./indentation").IndentationOptions> | import("@markuplint/ml-core").MLRule<boolean, import("./required-h1").RequiredH1Options>)[]; | ||
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<boolean, import("./required-h1").RequiredH1Options>)[]; | ||
export default _default; |
{ | ||
"name": "@markuplint/rules", | ||
"version": "1.0.0-alpha.9", | ||
"version": "1.0.0-alpha.10", | ||
"description": "Rules for markuplint", | ||
@@ -23,5 +23,5 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"devDependencies": { | ||
"@markuplint/ml-core": "^1.0.0-alpha.8" | ||
"@markuplint/ml-core": "^1.0.0-alpha.9" | ||
}, | ||
"gitHead": "0094f6679cceb294863f065dfb750621836061d4" | ||
"gitHead": "9e77270cab9fedc1ee16dbaa59ffbe6e65fb6a3e" | ||
} |
Sorry, the diff of this file is not supported yet
4483
435991