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,9 +2,9 @@
"use strict";
var shared = require("./shared");
const shared = require("./shared");
var spaceInLinkRe = /\[(?:\s+(?:[^\]]*?)\s*|(?:[^\]]*?)\s+)](?=\(\S*\))/;
const spaceInLinkRe = /\[(?:\s+(?:[^\]]*?)\s*|(?:[^\]]*?)\s+)](?=\(\S*\))/;
module.exports = {
"names": [ "MD039", "no-space-in-links" ],
@ -12,16 +12,16 @@ module.exports = {
"tags": [ "whitespace", "links" ],
"function": function MD039(params, onError) {
shared.filterTokens(params, "inline", function forToken(token) {
var inLink = false;
var linkText = "";
let inLink = false;
let linkText = "";
token.children.forEach(function forChild(child) {
if (child.type === "link_open") {
inLink = true;
linkText = "";
} else if (child.type === "link_close") {
inLink = false;
var left = shared.trimLeft(linkText).length !== linkText.length;
var right = shared.trimRight(linkText).length !== linkText.length;
const left = shared.trimLeft(linkText).length !== linkText.length;
const right = shared.trimRight(linkText).length !== linkText.length;
if (left || right) {
shared.addErrorContext(onError, token.lineNumber,
"[" + linkText + "]", left, right,