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,25 +2,25 @@
"use strict";
var shared = require("./shared");
const shared = require("./shared");
module.exports = {
"names": [ "MD030", "list-marker-space" ],
"description": "Spaces after list markers",
"tags": [ "ol", "ul", "whitespace" ],
"function": function MD030(params, onError) {
var ulSingle = params.config.ul_single || 1;
var olSingle = params.config.ol_single || 1;
var ulMulti = params.config.ul_multi || 1;
var olMulti = params.config.ol_multi || 1;
const ulSingle = params.config.ul_single || 1;
const olSingle = params.config.ol_single || 1;
const ulMulti = params.config.ul_multi || 1;
const olMulti = params.config.ol_multi || 1;
shared.flattenLists().forEach(function forList(list) {
var lineCount = list.lastLineIndex - list.open.map[0];
var allSingle = lineCount === list.items.length;
var expectedSpaces = list.unordered ?
const lineCount = list.lastLineIndex - list.open.map[0];
const allSingle = lineCount === list.items.length;
const expectedSpaces = list.unordered ?
(allSingle ? ulSingle : ulMulti) :
(allSingle ? olSingle : olMulti);
list.items.forEach(function forItem(item) {
var match = /^[\s>]*\S+(\s+)/.exec(item.line);
const match = /^[\s>]*\S+(\s+)/.exec(item.line);
shared.addErrorDetailIf(onError, item.lineNumber,
expectedSpaces, (match ? match[1].length : 0), null,
shared.rangeFromRegExp(item.line, shared.listItemMarkerRe));