mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Remove filterTokens helper (now used only by tests).
This commit is contained in:
parent
2b8369ae39
commit
55729cfcf7
5 changed files with 21 additions and 61 deletions
|
|
@ -3,7 +3,6 @@
|
|||
"use strict";
|
||||
|
||||
const js = require("@eslint/js");
|
||||
const { filterTokens } = require("../../helpers");
|
||||
const eslint = require("eslint");
|
||||
const linter = new eslint.Linter();
|
||||
const languageJavaScript = /js|javascript/i;
|
||||
|
|
@ -15,7 +14,9 @@ module.exports = {
|
|||
"tags": [ "test", "lint", "javascript" ],
|
||||
"parser": "markdownit",
|
||||
"function": (params, onError) => {
|
||||
filterTokens(params, "fence", (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);
|
||||
for (const result of results) {
|
||||
|
|
@ -27,9 +28,9 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// Unsupported:
|
||||
// filterTokens("code_block"), language unknown
|
||||
// filterTokens("code_inline"), too brief
|
||||
}
|
||||
// Unsupported by this sample:
|
||||
// "code_block": language unknown
|
||||
// "code_inline": too brief
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue