Convert var to const/let (except in browser-only code).

This commit is contained in:
David Anson 2018-04-27 22:05:34 -07:00
parent 78c1af7bfd
commit 213aef4564
56 changed files with 524 additions and 518 deletions

View file

@ -2,27 +2,27 @@
"use strict";
var shared = require("./shared");
const shared = require("./shared");
var numberRe = /^[\s>]*([^.)]*)[.)]/;
const numberRe = /^[\s>]*([^.)]*)[.)]/;
module.exports = {
"names": [ "MD029", "ol-prefix" ],
"description": "Ordered list item prefix",
"tags": [ "ol" ],
"function": function MD029(params, onError) {
var style = params.config.style || "one_or_ordered";
const style = params.config.style || "one_or_ordered";
shared.flattenLists().forEach(function forList(list) {
if (!list.unordered) {
var listStyle = style;
let listStyle = style;
if (listStyle === "one_or_ordered") {
var second = (list.items.length > 1) &&
const second = (list.items.length > 1) &&
numberRe.exec(list.items[1].line);
listStyle = (second && (second[1] !== "1")) ? "ordered" : "one";
}
var number = 1;
let number = 1;
list.items.forEach(function forItem(item) {
var match = numberRe.exec(item.line);
const match = numberRe.exec(item.line);
shared.addErrorDetailIf(onError, item.lineNumber,
String(number), !match || match[1],
"Style: " + (listStyle === "one" ? "1/1/1" : "1/2/3"),