Remove MD002 (deprecated in v0.13.0) and MD006 (deprecated in v0.19.0).

This commit is contained in:
David Anson 2023-11-09 19:47:15 -08:00
parent 80539b774e
commit 20a552b4b7
40 changed files with 250 additions and 1239 deletions

View file

@ -30,39 +30,6 @@ export interface Configuration {
* MD001/heading-increment/header-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md001.md
*/
"header-increment"?: boolean;
/**
* MD002/first-heading-h1/first-header-h1 : First heading should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md002.md
*/
MD002?:
| boolean
| {
/**
* Heading level
*/
level?: number;
};
/**
* MD002/first-heading-h1/first-header-h1 : First heading should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md002.md
*/
"first-heading-h1"?:
| boolean
| {
/**
* Heading level
*/
level?: number;
};
/**
* MD002/first-heading-h1/first-header-h1 : First heading should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md002.md
*/
"first-header-h1"?:
| boolean
| {
/**
* Heading level
*/
level?: number;
};
/**
* MD003/heading-style/header-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md003.md
*/
@ -126,14 +93,6 @@ export interface Configuration {
* MD005/list-indent : Inconsistent indentation for list items at the same level : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md005.md
*/
"list-indent"?: boolean;
/**
* MD006/ul-start-left : Consider starting bulleted lists at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md006.md
*/
MD006?: boolean;
/**
* MD006/ul-start-left : Consider starting bulleted lists at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md006.md
*/
"ul-start-left"?: boolean;
/**
* MD007/ul-indent : Unordered list indentation : https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md
*/
@ -1169,23 +1128,23 @@ export interface Configuration {
reference?: boolean;
};
/**
* headings : MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
* headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
*/
headings?: boolean;
/**
* headers : MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
* headers : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
*/
headers?: boolean;
/**
* bullet : MD004, MD005, MD006, MD007, MD032
* bullet : MD004, MD005, MD007, MD032
*/
bullet?: boolean;
/**
* ul : MD004, MD005, MD006, MD007, MD030, MD032
* ul : MD004, MD005, MD007, MD030, MD032
*/
ul?: boolean;
/**
* indentation : MD005, MD006, MD007, MD027
* indentation : MD005, MD007, MD027
*/
indentation?: boolean;
/**

View file

@ -2,14 +2,13 @@
"use strict";
module.exports.deprecatedRuleNames = [ "MD002", "MD006" ];
module.exports.deprecatedRuleNames = [];
module.exports.fixableRuleNames = [
"MD004", "MD005", "MD006", "MD007", "MD009", "MD010",
"MD011", "MD012", "MD014", "MD018", "MD019", "MD020",
"MD021", "MD022", "MD023", "MD026", "MD027", "MD030",
"MD031", "MD032", "MD034", "MD037", "MD038", "MD039",
"MD044", "MD047", "MD049", "MD050", "MD051", "MD053",
"MD054"
"MD004", "MD005", "MD007", "MD009", "MD010", "MD011",
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
"MD022", "MD023", "MD026", "MD027", "MD030", "MD031",
"MD032", "MD034", "MD037", "MD038", "MD039", "MD044",
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054"
];
module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
module.exports.version = "0.31.1";

View file

@ -6,7 +6,7 @@ const path = require("node:path");
const { promisify } = require("node:util");
const markdownit = require("markdown-it");
const micromark = require("../helpers/micromark.cjs");
const { deprecatedRuleNames } = require("./constants");
// const { deprecatedRuleNames } = require("./constants");
const rules = require("./rules");
const helpers = require("../helpers");
const cache = require("./cache");
@ -323,9 +323,9 @@ function getEffectiveConfig(ruleList, config, aliasToRuleNames) {
const ruleName = rule.names[0].toUpperCase();
effectiveConfig[ruleName] = ruleDefault;
}
for (const ruleName of deprecatedRuleNames) {
effectiveConfig[ruleName] = false;
}
// for (const ruleName of deprecatedRuleNames) {
// effectiveConfig[ruleName] = false;
// }
for (const key of Object.keys(config)) {
let value = config[key];
if (value) {

View file

@ -1,22 +0,0 @@
// @ts-check
"use strict";
const { addErrorDetailIf } = require("../helpers");
module.exports = {
"names": [ "MD002", "first-heading-h1", "first-header-h1" ],
"description": "First heading should be a top-level heading",
"tags": [ "headings", "headers" ],
"function": function MD002(params, onError) {
const level = Number(params.config.level || 1);
const tag = "h" + level;
params.parsers.markdownit.tokens.every(function forToken(token) {
if (token.type === "heading_open") {
addErrorDetailIf(onError, token.lineNumber, tag, token.tag);
return false;
}
return true;
});
}
};

View file

@ -1,34 +0,0 @@
// @ts-check
"use strict";
const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
require("../helpers");
const { flattenedLists } = require("./cache");
module.exports = {
"names": [ "MD006", "ul-start-left" ],
"description":
"Consider starting bulleted lists at the beginning of the line",
"tags": [ "bullet", "ul", "indentation" ],
"function": function MD006(params, onError) {
for (const list of flattenedLists()) {
if (list.unordered && !list.nesting && (list.indent !== 0)) {
for (const item of list.items) {
const { lineNumber, line } = item;
addErrorDetailIf(
onError,
lineNumber,
0,
list.indent,
null,
null,
rangeFromRegExp(line, listItemMarkerRe),
{
"deleteCount": line.length - line.trimStart().length
});
}
}
}
}
};

View file

@ -6,11 +6,9 @@ const { homepage, version } = require("./constants");
const rules = [
require("./md001"),
require("./md002"),
require("./md003"),
require("./md004"),
require("./md005"),
require("./md006"),
require("./md007"),
require("./md009"),
require("./md010"),