mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +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
12
lib/md039.js
12
lib/md039.js
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue