mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Move each rule implementation into its own file (fixes #83).
This commit is contained in:
parent
49e36f817c
commit
9ba143555d
42 changed files with 1289 additions and 1028 deletions
24
lib/md010.js
Normal file
24
lib/md010.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
|
||||
var tabRe = /\t+/;
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD010", "no-hard-tabs" ],
|
||||
"description": "Hard tabs",
|
||||
"tags": [ "whitespace", "hard_tab" ],
|
||||
"function": function MD010(params, onError) {
|
||||
var codeBlocks = params.config.code_blocks;
|
||||
var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
|
||||
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
|
||||
if (tabRe.test(line) && (!inCode || includeCodeBlocks)) {
|
||||
shared.addError(onError, lineIndex + 1,
|
||||
"Column: " + (line.indexOf("\t") + 1), null,
|
||||
shared.rangeFromRegExp(line, tabRe));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue