mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Remove regexp from rule definition to simplify API.
This commit is contained in:
parent
d47091078e
commit
a0e3b4db90
3 changed files with 67 additions and 154 deletions
|
|
@ -293,39 +293,6 @@ module.exports.resultFormattingV1 = function resultFormattingV1(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.resultFormattingV1BadRegExp =
|
||||
function resultFormattingV1BadRegExp(test) {
|
||||
test.expect(3);
|
||||
var md010 = rules[8];
|
||||
test.equal(md010.names[0], "MD010", "Wrong rule.");
|
||||
var md010RegExp = md010.regexp;
|
||||
md010.regexp = /X/;
|
||||
var options = {
|
||||
"strings": {
|
||||
"tab": "\t."
|
||||
},
|
||||
"config": defaultConfig,
|
||||
"resultVersion": 1
|
||||
};
|
||||
markdownlint(options, function callback(err, actualResult) {
|
||||
test.ifError(err);
|
||||
var expectedResult = {
|
||||
"tab": [
|
||||
{ "lineNumber": 1,
|
||||
"ruleName": "MD010",
|
||||
"ruleAlias": "no-hard-tabs",
|
||||
"ruleDescription": "Hard tabs",
|
||||
"errorDetail": "Column: 1",
|
||||
"errorContext": null,
|
||||
"errorRange": null }
|
||||
]
|
||||
};
|
||||
test.deepEqual(actualResult, expectedResult, "Undetected issues.");
|
||||
md010.regexp = md010RegExp;
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.resultFormattingV2 = function resultFormattingV2(test) {
|
||||
test.expect(3);
|
||||
var options = {
|
||||
|
|
@ -412,37 +379,6 @@ module.exports.resultFormattingV2 = function resultFormattingV2(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.resultFormattingV2BadRegExp =
|
||||
function resultFormattingV2BadRegExp(test) {
|
||||
test.expect(3);
|
||||
var md010 = rules[8];
|
||||
test.equal(md010.names[0], "MD010", "Wrong rule.");
|
||||
var md010RegExp = md010.regexp;
|
||||
md010.regexp = /X/;
|
||||
var options = {
|
||||
"strings": {
|
||||
"tab": "\t."
|
||||
},
|
||||
"config": defaultConfig
|
||||
};
|
||||
markdownlint(options, function callback(err, actualResult) {
|
||||
test.ifError(err);
|
||||
var expectedResult = {
|
||||
"tab": [
|
||||
{ "lineNumber": 1,
|
||||
"ruleNames": [ "MD010", "no-hard-tabs" ],
|
||||
"ruleDescription": "Hard tabs",
|
||||
"errorDetail": "Column: 1",
|
||||
"errorContext": null,
|
||||
"errorRange": null }
|
||||
]
|
||||
};
|
||||
test.deepEqual(actualResult, expectedResult, "Undetected issues.");
|
||||
md010.regexp = md010RegExp;
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.stringInputLineEndings = function stringInputLineEndings(test) {
|
||||
test.expect(2);
|
||||
var options = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue