diff options
author | Andrey Galkin <andrey@futoin.org> | 2019-06-03 15:46:36 +0300 |
---|---|---|
committer | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-06-03 14:46:36 +0200 |
commit | 4c8f928f99f0b5a967e4ec6e52f37de7a21ddedd (patch) | |
tree | 8ff85f6ce978e398e300d9f8a8c488113db30846 /.remarkrc.js | |
parent | 526f46e987e159caf3e8df84223d67951693d88f (diff) |
NEW: local remark-lint checks and autofix support (#5898)
* NEW: Codacy remark-lint config to run locally
- Use `npm run-script lint-md` to check all Markdown files (may be excessively long)
- Use `npm run-script lint-md-path {path}` to check only specific path
* remark-lint autofix support example
* A bit revised remark-stringify configuration
Diffstat (limited to '.remarkrc.js')
-rw-r--r-- | .remarkrc.js | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/.remarkrc.js b/.remarkrc.js new file mode 100644 index 0000000000..a5d9d1280b --- /dev/null +++ b/.remarkrc.js @@ -0,0 +1,121 @@ +// Source: https://github.com/codacy/codacy-remark-lint/raw/master/.remarkrc.js + +const fs = require("fs"); +const path = require("path"); + +exports.settings = { + gfm: true, + commonmark: true, + looseTable: false, + spacedTable: false, + paddedTable: false, + fences: true, + rule: '-', + ruleRepetition: 3, + emphasis: "*", + strong: "*", + bullet: "-", + listItemIndent: 'tab', + incrementListMarker: true +}; + +const personalDictionaryPath = path.join(__dirname, ".dictionary"); +const personalDictionary = fs.existsSync(personalDictionaryPath) + ? { + personal: fs.readFileSync(personalDictionaryPath, "utf8") + } + : {}; + +const remarkPresetLintMarkdownStyleGuide = { + plugins: require("remark-preset-lint-markdown-style-guide").plugins.filter( + function(elem) { + return elem != require("remark-lint-no-duplicate-headings"); + } + ) +}; + +exports.plugins = [ + require("remark-preset-lint-consistent"), + require("remark-preset-lint-recommended"), + remarkPresetLintMarkdownStyleGuide, + [require("remark-lint-no-dead-urls"), { skipOffline: true }], + require("remark-lint-heading-whitespace"), + [require("remark-lint-maximum-line-length"), 120], + [require("remark-lint-maximum-heading-length"), 120], + [require("remark-lint-list-item-indent"), "tab-size"], + [require("remark-lint-list-item-spacing"), false], + [require("remark-lint-strong-marker"), "*"], + [require("remark-lint-emphasis-marker"), "_"], + [require("remark-lint-unordered-list-marker-style"), "-"], + [require("remark-lint-ordered-list-marker-style"), "."], + [require("remark-lint-ordered-list-marker-value"), "ordered"], + /*[ + require("remark-lint-write-good"), + [ + "warn", + { + passive: false, + illusion: true, + so: true, + thereIs: true, + weasel: true, + adverb: true, + tooWordy: true, + cliches: true, + eprime: false + } + ] + ],*/ + require("remark-validate-links"), + require("remark-frontmatter"), + /*[ + require("remark-retext"), + require("unified")().use({ + plugins: [ + require("retext-english"), + require("retext-syntax-urls"), + [ + require("retext-spell"), + { + ignoreLiteral: true, + dictionary: require("dictionary-en-us"), + ...personalDictionary + } + ], + [ + require("retext-sentence-spacing"), + { + preferred: 1 + } + ], + require("retext-repeated-words"), + require("retext-usage"), + require("retext-indefinite-article"), + require("retext-redundant-acronyms"), + [ + require("retext-contractions"), + { + straight: true, + allowLiteral: true + } + ], + require("retext-diacritics"), + [ + require("retext-quotes"), + { + preferred: "straight" + } + ], + require("retext-equality"), + require("retext-passive"), + require("retext-profanities"), + [ + require("retext-readability"), + { + age: 20 + } + ] + ] + }) + ]*/ +]; |