mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-22 08:50: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
14
lib/md029.js
14
lib/md029.js
|
|
@ -2,27 +2,27 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
const shared = require("./shared");
|
||||
|
||||
var numberRe = /^[\s>]*([^.)]*)[.)]/;
|
||||
const numberRe = /^[\s>]*([^.)]*)[.)]/;
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD029", "ol-prefix" ],
|
||||
"description": "Ordered list item prefix",
|
||||
"tags": [ "ol" ],
|
||||
"function": function MD029(params, onError) {
|
||||
var style = params.config.style || "one_or_ordered";
|
||||
const style = params.config.style || "one_or_ordered";
|
||||
shared.flattenLists().forEach(function forList(list) {
|
||||
if (!list.unordered) {
|
||||
var listStyle = style;
|
||||
let listStyle = style;
|
||||
if (listStyle === "one_or_ordered") {
|
||||
var second = (list.items.length > 1) &&
|
||||
const second = (list.items.length > 1) &&
|
||||
numberRe.exec(list.items[1].line);
|
||||
listStyle = (second && (second[1] !== "1")) ? "ordered" : "one";
|
||||
}
|
||||
var number = 1;
|
||||
let number = 1;
|
||||
list.items.forEach(function forItem(item) {
|
||||
var match = numberRe.exec(item.line);
|
||||
const match = numberRe.exec(item.line);
|
||||
shared.addErrorDetailIf(onError, item.lineNumber,
|
||||
String(number), !match || match[1],
|
||||
"Style: " + (listStyle === "one" ? "1/1/1" : "1/2/3"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue