mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-23 09: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
18
lib/md038.js
18
lib/md038.js
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue