Closed tt512 closed 3 years ago
Hi!
I guess fpb-lint doesn't check alphabetical order of lists because ja is not included in langsToAlphabetize and dictionary order of Japanese is not alphabetical also. However fpb-lint checks alphabetical order on Japanese document.
fpb-lint
ja
langsToAlphabetize
/home/tat/free-programming-books/free-programming-books-ja.md 4:3-17:80 warning Alphabetical ordering: swap l.17 and l.16 alphabetize-lists remark-lint 4:3-17:80 warning Alphabetical ordering: swap l.11 and l.10 alphabetize-lists remark-lint ⚠ 2 warnings
In addition, I found out alphabetize-lists plugin appended increasingly to preset.plugin list in forEach loop by inserting log for debugging.
alphabetize-lists
preset.plugin
forEach
diff --git a/lib/lint.js b/lib/lint.js index 8fb2f5e..b5347b0 100644 --- a/lib/lint.js +++ b/lib/lint.js @@ -80,6 +80,9 @@ const commonPreset = { preset.plugins.push([require('remark-lint-alphabetize-lists'), lang]); } const processor = remark().use(preset); + console.log(JSON.stringify({ + filename: filename.split('/').pop(), lang: lang, alphabetize: langsToAlphabetize.includes(lang), + remarkLintAlphabetizeListsFor: preset.plugins.filter(x => x[0] === require('remark-lint-alphabetize-lists')).map(x => x[1])})); processor.process(doc, (err, file) => { if (report(err || file) !== 'no issues found') {
output:
... {"filename":"HOWTO.md","lang":"en-US","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US"]} {"filename":"HOWTO.pt_BR.md","lang":"books/HOWTO.pt-BR","alphabetize":false,"remarkLintAlphabetizeListsFor":["en-US"]} {"filename":"free-courses-bg.md","lang":"bg","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US","bg"]} {"filename":"free-courses-de.md","lang":"de","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US","bg","de"]} {"filename":"free-courses-en.md","lang":"en","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US","bg","de","en"]} {"filename":"free-courses-es.md","lang":"es","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US","bg","de","en","es"]} {"filename":"free-courses-fi.md","lang":"fi","alphabetize":true,"remarkLintAlphabetizeListsFor":["en-US","bg","de","en","es","fi"]} {"filename":"free-courses-hi.md","lang":"hi","alphabetize":false,"remarkLintAlphabetizeListsFor":["en-US","bg","de","en","es","fi"]} ...
I think it's not expected behavior, so I'll create PR.
Well done, thanks for the detailed issue and the fix!
Hi!
I guess
fpb-lint
doesn't check alphabetical order of lists becauseja
is not included inlangsToAlphabetize
and dictionary order of Japanese is not alphabetical also. Howeverfpb-lint
checks alphabetical order on Japanese document.In addition, I found out
alphabetize-lists
plugin appended increasingly topreset.plugin
list inforEach
loop by inserting log for debugging.output:
I think it's not expected behavior, so I'll create PR.