Expose shared.js helper code for custom rule authors (fixes #134).

This commit is contained in:
David Anson 2019-04-13 11:18:57 -07:00
parent f614f3e1ce
commit 7e980401b8
52 changed files with 283 additions and 184 deletions

View file

@ -2,16 +2,16 @@
"use strict";
const shared = require("./shared");
const { addError, forEachInlineChild } = require("../helpers");
module.exports = {
"names": [ "MD045", "no-alt-text" ],
"description": "Images should have alternate text (alt text)",
"tags": [ "accessibility", "images" ],
"function": function MD045(params, onError) {
shared.forEachInlineChild(params, "image", function forToken(token) {
forEachInlineChild(params, "image", function forToken(token) {
if (token.content === "") {
shared.addError(onError, token.lineNumber);
addError(onError, token.lineNumber);
}
});
}