mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Include file/string name in params object for custom rules (fixes #119).
This commit is contained in:
parent
8c87a20677
commit
1c816897c1
3 changed files with 53 additions and 5 deletions
|
@ -2282,6 +2282,50 @@ module.exports.customRulesOnErrorLazy = function customRulesOnErrorLazy(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.customRulesFileName = function customRulesFileName(test) {
|
||||
test.expect(2);
|
||||
const options = {
|
||||
"customRules": [
|
||||
{
|
||||
"names": [ "name" ],
|
||||
"description": "description",
|
||||
"tags": [ "tag" ],
|
||||
"function": function stringName(params) {
|
||||
test.equal(params.name, "doc/CustomRules.md", "Incorrect file name");
|
||||
}
|
||||
}
|
||||
],
|
||||
"files": "doc/CustomRules.md"
|
||||
};
|
||||
markdownlint(options, function callback(err) {
|
||||
test.ifError(err);
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.customRulesStringName = function customRulesStringName(test) {
|
||||
test.expect(2);
|
||||
const options = {
|
||||
"customRules": [
|
||||
{
|
||||
"names": [ "name" ],
|
||||
"description": "description",
|
||||
"tags": [ "tag" ],
|
||||
"function": function stringName(params) {
|
||||
test.equal(params.name, "string", "Incorrect string name");
|
||||
}
|
||||
}
|
||||
],
|
||||
"strings": {
|
||||
"string": "# Heading"
|
||||
}
|
||||
};
|
||||
markdownlint(options, function callback(err) {
|
||||
test.ifError(err);
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.customRulesDoc = function customRulesDoc(test) {
|
||||
test.expect(2);
|
||||
markdownlint({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue