Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dzencot committed Apr 12, 2024
1 parent 54a2964 commit 03daf95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const getWrongWords = async (rules = []) => {
});
};

const checkContent = async (content) => {
const checkContent = async (content, rules) => {

const checkResults = await check(content, rules);

Expand Down Expand Up @@ -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));
Expand All @@ -160,7 +160,7 @@ const fix = async (rules = []) => {

const parsedContent = fromMarkdown(content);

checkTree(parsedContent);
checkTree(parsedContent, rules);

const finalResult = toMarkdown(parsedContent);

Expand Down

0 comments on commit 03daf95

Please sign in to comment.