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 inlineCodeSpansRe = /(?:^|[^\\])((`+)((?:.*?[^`])|)\2(?!`))/g;
const inlineCodeSpansRe = /(?:^|[^\\])((`+)((?:.*?[^`])|)\2(?!`))/g;
module.exports = {
"names": [ "MD038", "no-space-in-code" ],
@ -13,14 +13,14 @@ module.exports = {
"function": function MD038(params, onError) {
shared.forEachInlineChild(params, "code_inline",
function forToken(token) {
var line = params.lines[token.lineNumber - 1];
var match = null;
const line = params.lines[token.lineNumber - 1];
let match = null;
while ((match = inlineCodeSpansRe.exec(line)) !== null) {
var inlineCodeSpan = match[1];
var content = match[3];
var length = inlineCodeSpan.length;
var column = match.index + 1 + (match[0].length - length);
var range = [ column, length ];
const inlineCodeSpan = match[1];
const content = match[3];
const length = inlineCodeSpan.length;
const column = match.index + 1 + (match[0].length - length);
const range = [ column, length ];
if (/^\s([^`]|$)/.test(content)) {
shared.addErrorContext(onError, token.lineNumber,
inlineCodeSpan, true, false, range);