mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add MD044 proper-names "Proper names should have the correct capitalization" (fixes #39).
This commit is contained in:
parent
46cbcfa55e
commit
d8975282dc
13 changed files with 185 additions and 5 deletions
22
lib/rules.js
22
lib/rules.js
|
@ -1090,5 +1090,27 @@ module.exports = [
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "MD044",
|
||||
"desc": "Proper names should have the correct capitalization",
|
||||
"tags": [ "spelling" ],
|
||||
"aliases": [ "proper-names" ],
|
||||
"regexp": null,
|
||||
"func": function MD044(params, errors) {
|
||||
var names = params.options.names || [];
|
||||
names.forEach(function forName(name) {
|
||||
var escapedName = escapeForRegExp(name);
|
||||
var namePattern = "\\b" + escapedName + "\\b";
|
||||
var anyNameRe = new RegExp(namePattern, "gi");
|
||||
forEachLine(params, function forLine(line, lineIndex) {
|
||||
var matches = line.match(anyNameRe) || [];
|
||||
matches.forEach(function forMatch(match) {
|
||||
errors.addDetailIf(lineIndex + 1, name, match);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue