mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update dependencies: eslint to 8.5.0, eslint-plugin-jsdoc to 37.4.0.
This commit is contained in:
parent
fd24b9552b
commit
528758e962
3 changed files with 19 additions and 15 deletions
|
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
"jsdoc/check-access": "error",
|
"jsdoc/check-access": "error",
|
||||||
"jsdoc/check-alignment": "error",
|
"jsdoc/check-alignment": "error",
|
||||||
"jsdoc/check-examples": "error",
|
"jsdoc/check-examples": "off",
|
||||||
"jsdoc/check-indentation": "error",
|
"jsdoc/check-indentation": "error",
|
||||||
"jsdoc/check-line-alignment": "error",
|
"jsdoc/check-line-alignment": "error",
|
||||||
"jsdoc/check-param-names": "error",
|
"jsdoc/check-param-names": "error",
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "~3.15.0",
|
"ava": "~3.15.0",
|
||||||
"c8": "~7.10.0",
|
"c8": "~7.10.0",
|
||||||
"eslint": "~7.32.0",
|
"eslint": "~8.5.0",
|
||||||
"eslint-plugin-jsdoc": "~37.2.8",
|
"eslint-plugin-jsdoc": "~37.4.0",
|
||||||
"eslint-plugin-node": "~11.1.0",
|
"eslint-plugin-node": "~11.1.0",
|
||||||
"eslint-plugin-unicorn": "~39.0.0",
|
"eslint-plugin-unicorn": "~39.0.0",
|
||||||
"globby": "~11.0.4",
|
"globby": "~11.0.4",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
const { filterTokens } = require("markdownlint-rule-helpers");
|
const { filterTokens } = require("markdownlint-rule-helpers");
|
||||||
const eslint = require("eslint");
|
const eslint = require("eslint");
|
||||||
const cliEngine = new eslint.CLIEngine({});
|
const eslintInstance = new eslint.ESLint();
|
||||||
const linter = new eslint.Linter();
|
const linter = new eslint.Linter();
|
||||||
const languageJavaScript = /js|javascript/i;
|
const languageJavaScript = /js|javascript/i;
|
||||||
|
|
||||||
|
|
@ -28,23 +28,27 @@ module.exports = {
|
||||||
"names": [ "lint-javascript" ],
|
"names": [ "lint-javascript" ],
|
||||||
"description": "Rule that lints JavaScript code",
|
"description": "Rule that lints JavaScript code",
|
||||||
"tags": [ "test", "lint", "javascript" ],
|
"tags": [ "test", "lint", "javascript" ],
|
||||||
|
"asynchronous": true,
|
||||||
"function": (params, onError) => {
|
"function": (params, onError) => {
|
||||||
filterTokens(params, "fence", (fence) => {
|
filterTokens(params, "fence", (fence) => {
|
||||||
if (languageJavaScript.test(fence.info)) {
|
if (languageJavaScript.test(fence.info)) {
|
||||||
let config = cliEngine.getConfigForFile(params.name);
|
return eslintInstance.calculateConfigForFile(params.name)
|
||||||
config = cleanJsdocRulesFromEslintConfig(config);
|
.then((config) => {
|
||||||
const results = linter.verify(fence.content, config);
|
config = cleanJsdocRulesFromEslintConfig(config);
|
||||||
results.forEach((result) => {
|
const results = linter.verify(fence.content, config);
|
||||||
const lineNumber = fence.lineNumber + result.line;
|
results.forEach((result) => {
|
||||||
onError({
|
const lineNumber = fence.lineNumber + result.line;
|
||||||
"lineNumber": lineNumber,
|
onError({
|
||||||
"detail": result.message,
|
"lineNumber": lineNumber,
|
||||||
"context": params.lines[lineNumber - 1]
|
"detail": result.message,
|
||||||
|
"context": params.lines[lineNumber - 1]
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
// Unused:
|
// Unsupported:
|
||||||
// filterTokens("code_block"), language unknown
|
// filterTokens("code_block"), language unknown
|
||||||
// filterTokens("code_inline"), too brief
|
// filterTokens("code_inline"), too brief
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue