mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Convert var to const/let (except in browser-only code).
This commit is contained in:
parent
78c1af7bfd
commit
213aef4564
56 changed files with 524 additions and 518 deletions
16
lib/md043.js
16
lib/md043.js
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
const shared = require("./shared");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD043", "required-headings", "required-headers" ],
|
||||
"description": "Required heading structure",
|
||||
"tags": [ "headings", "headers" ],
|
||||
"function": function MD043(params, onError) {
|
||||
var requiredHeadings = params.config.headings || params.config.headers;
|
||||
const requiredHeadings = params.config.headings || params.config.headers;
|
||||
if (requiredHeadings) {
|
||||
var levels = {};
|
||||
const levels = {};
|
||||
[ 1, 2, 3, 4, 5, 6 ].forEach(function forLevel(level) {
|
||||
levels["h" + level] = "######".substr(-level);
|
||||
});
|
||||
var i = 0;
|
||||
var optional = false;
|
||||
var errorCount = 0;
|
||||
let i = 0;
|
||||
let optional = false;
|
||||
let errorCount = 0;
|
||||
shared.forEachHeading(params, function forHeading(heading, content) {
|
||||
if (!errorCount) {
|
||||
var actual = levels[heading.tag] + " " + content;
|
||||
var expected = requiredHeadings[i++] || "[None]";
|
||||
const actual = levels[heading.tag] + " " + content;
|
||||
const expected = requiredHeadings[i++] || "[None]";
|
||||
if (expected === "*") {
|
||||
optional = true;
|
||||
} else if (expected.toLowerCase() === actual.toLowerCase()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue