mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add @stylistic/eslint-plugin to ESLint configuration.
This commit is contained in:
parent
fe02674ce0
commit
164bbac651
21 changed files with 103 additions and 78 deletions
|
|
@ -77,8 +77,8 @@ test("filterByTypes, htmlFlow false", async(t) => {
|
|||
// Not using flat tokens
|
||||
t.deepEqual(
|
||||
filtered,
|
||||
filterByTypes([ ...tokens], types)
|
||||
)
|
||||
filterByTypes([ ...tokens ], types)
|
||||
);
|
||||
});
|
||||
|
||||
test("filterByTypes, htmlFlow true", async(t) => {
|
||||
|
|
@ -95,8 +95,8 @@ test("filterByTypes, htmlFlow true", async(t) => {
|
|||
// Not using flat tokens
|
||||
t.deepEqual(
|
||||
filtered,
|
||||
filterByTypes([ ...tokens], types, true)
|
||||
)
|
||||
filterByTypes([ ...tokens ], types, true)
|
||||
);
|
||||
});
|
||||
|
||||
test("filterByPredicate/filterByTypes", async(t) => {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function markdownlintParallel(options) {
|
|||
const workerData = {
|
||||
...options,
|
||||
"files": files.slice(i * chunkSize, (i + 1) * chunkSize)
|
||||
}
|
||||
};
|
||||
const worker = new Worker(__filename.replace(/parallel\.js$/, "worker.js"), { workerData });
|
||||
worker.on("message", resolve);
|
||||
worker.on("error", reject);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ async function lintTestRepo(t, globPatterns, configPath, parallel) {
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(`${t.title}: Linting ${files.length} files...`);
|
||||
const config = Object.fromEntries(
|
||||
Object.entries(rawConfig).
|
||||
map(([ k, v ]) => [
|
||||
Object.entries(rawConfig)
|
||||
.map(([ k, v ]) => [
|
||||
k.replace(/header/, "heading"),
|
||||
v
|
||||
])
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ test("resultFormattingV0", (t) => new Promise((resolve) => {
|
|||
"./test/atx_heading_spacing.md: 1: MD041" +
|
||||
" First line in a file should be a top-level heading\n" +
|
||||
"./test/first_heading_bad_atx.md: 1: MD041" +
|
||||
" First line in a file should be a top-level heading"
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (name).");
|
||||
" First line in a file should be a top-level heading";
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (name).");
|
||||
// @ts-ignore
|
||||
actualMessage = actualResult.toString(true);
|
||||
expectedMessage =
|
||||
|
|
@ -78,8 +78,8 @@ test("resultFormattingV0", (t) => new Promise((resolve) => {
|
|||
"./test/atx_heading_spacing.md: 1: first-line-heading" +
|
||||
" First line in a file should be a top-level heading\n" +
|
||||
"./test/first_heading_bad_atx.md: 1: first-line-heading" +
|
||||
" First line in a file should be a top-level heading"
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (alias).");
|
||||
" First line in a file should be a top-level heading";
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (alias).");
|
||||
resolve();
|
||||
});
|
||||
}));
|
||||
|
|
@ -121,7 +121,7 @@ test("resultFormattingSyncV0", (t) => {
|
|||
"./test/atx_heading_spacing.md: 1: MD041" +
|
||||
" First line in a file should be a top-level heading\n" +
|
||||
"./test/first_heading_bad_atx.md: 1: MD041" +
|
||||
" First line in a file should be a top-level heading"
|
||||
" First line in a file should be a top-level heading";
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (name).");
|
||||
// @ts-ignore
|
||||
actualMessage = actualResult.toString(true);
|
||||
|
|
@ -135,7 +135,7 @@ test("resultFormattingSyncV0", (t) => {
|
|||
"./test/atx_heading_spacing.md: 1: first-line-heading" +
|
||||
" First line in a file should be a top-level heading\n" +
|
||||
"./test/first_heading_bad_atx.md: 1: first-line-heading" +
|
||||
" First line in a file should be a top-level heading"
|
||||
" First line in a file should be a top-level heading";
|
||||
t.is(actualMessage, expectedMessage, "Incorrect message (alias).");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ const markdownlint = require("../lib/markdownlint").promises.markdownlint;
|
|||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
markdownlint(workerData).then((lintResults) => {
|
||||
// @ts-ignore
|
||||
parentPort.
|
||||
parentPort
|
||||
// eslint-disable-next-line unicorn/require-post-message-target-origin
|
||||
postMessage(lintResults);
|
||||
.postMessage(lintResults);
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
process.exit();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ module.exports = {
|
|||
"tags": [ "test" ],
|
||||
"parser": "markdownit",
|
||||
"function": (params, onError) => {
|
||||
const blockquotes = params.parsers.markdownit.tokens.
|
||||
filter((token => token.type === "blockquote_open"));
|
||||
const blockquotes = params.parsers.markdownit.tokens
|
||||
.filter(((token) => token.type === "blockquote_open"));
|
||||
for (const blockquote of blockquotes) {
|
||||
const lines = blockquote.map[1] - blockquote.map[0];
|
||||
onError({
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ module.exports = {
|
|||
"tags": [ "test", "lint", "javascript" ],
|
||||
"parser": "markdownit",
|
||||
"function": (params, onError) => {
|
||||
const fences = params.parsers.markdownit.tokens.
|
||||
filter((token => token.type === "fence"));
|
||||
const fences = params.parsers.markdownit.tokens
|
||||
.filter(((token) => token.type === "fence"));
|
||||
for (const fence of fences) {
|
||||
if (languageJavaScript.test(fence.info)) {
|
||||
const results = linter.verify(fence.content, js.configs.recommended);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ module.exports = {
|
|||
"parser": "markdownit",
|
||||
"asynchronous": true,
|
||||
"function": (params, onError) => {
|
||||
const fences = params.parsers.markdownit.tokens.
|
||||
filter((token => token.type === "fence"));
|
||||
const fences = params.parsers.markdownit.tokens
|
||||
.filter(((token) => token.type === "fence"));
|
||||
for (const fence of fences) {
|
||||
if (/jsonc?/i.test(fence.info)) {
|
||||
const errors = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue