From 03daf95eb23e80f6b29436c4ab8684c2f1e9e78a Mon Sep 17 00:00:00 2001 From: Ivan Gagarinov Date: Fri, 12 Apr 2024 18:37:51 +0500 Subject: [PATCH] update --- Makefile | 1 + src/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 66bf14d..7715d73 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ run-fix: docker run --rm \ -v ./fixtures:/content \ -v ./bin:/usr/local/bin \ + -v ./src:/LanguageTool-6.3/src \ hexlet/languagetool-cli \ node ./bin/fix.js diff --git a/src/index.js b/src/index.js index 44073d3..323c470 100644 --- a/src/index.js +++ b/src/index.js @@ -107,7 +107,7 @@ const getWrongWords = async (rules = []) => { }); }; -const checkContent = async (content) => { +const checkContent = async (content, rules) => { const checkResults = await check(content, rules); @@ -135,13 +135,13 @@ const checkContent = async (content) => { return totalResult.result; }; -const checkTree = (source) => { +const checkTree = (source, rules) => { const iter = async (tree) => { if (filterBlocks.includes(tree.type)) { return Promise.resolve(); } - tree.value = await checkContent(tree.value); + tree.value = await checkContent(tree.value, rules); if (tree.children) { return Promise.all(tree.children.map(iter)); @@ -160,7 +160,7 @@ const fix = async (rules = []) => { const parsedContent = fromMarkdown(content); - checkTree(parsedContent); + checkTree(parsedContent, rules); const finalResult = toMarkdown(parsedContent);