@cryptotaxi247 / netdata-1 / commits / 4c8f928f9

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

Andrey Galkin committed Jun 3, 2019 at 15:46 UTC 4c8f928f99f0b5a967e4ec6e52f37de7a21ddedd
2 files changed +165 -10
.remarkrc.js new
+121
@@ -0,0 +1,121 @@
1 +// Source: https://github.com/codacy/codacy-remark-lint/raw/master/.remarkrc.js
2 +
3 +const fs = require("fs");
4 +const path = require("path");
5 +
6 +exports.settings = {
7 + gfm: true,
8 + commonmark: true,
9 + looseTable: false,
10 + spacedTable: false,
11 + paddedTable: false,
12 + fences: true,
13 + rule: '-',
14 + ruleRepetition: 3,
15 + emphasis: "*",
16 + strong: "*",
17 + bullet: "-",
18 + listItemIndent: 'tab',
19 + incrementListMarker: true
20 +};
21 +
22 +const personalDictionaryPath = path.join(__dirname, ".dictionary");
23 +const personalDictionary = fs.existsSync(personalDictionaryPath)
24 + ? {
25 + personal: fs.readFileSync(personalDictionaryPath, "utf8")
26 + }
27 + : {};
28 +
29 +const remarkPresetLintMarkdownStyleGuide = {
30 + plugins: require("remark-preset-lint-markdown-style-guide").plugins.filter(
31 + function(elem) {
32 + return elem != require("remark-lint-no-duplicate-headings");
33 + }
34 + )
35 +};
36 +
37 +exports.plugins = [
38 + require("remark-preset-lint-consistent"),
39 + require("remark-preset-lint-recommended"),
40 + remarkPresetLintMarkdownStyleGuide,
41 + [require("remark-lint-no-dead-urls"), { skipOffline: true }],
42 + require("remark-lint-heading-whitespace"),
43 + [require("remark-lint-maximum-line-length"), 120],
44 + [require("remark-lint-maximum-heading-length"), 120],
45 + [require("remark-lint-list-item-indent"), "tab-size"],
46 + [require("remark-lint-list-item-spacing"), false],
47 + [require("remark-lint-strong-marker"), "*"],
48 + [require("remark-lint-emphasis-marker"), "_"],
49 + [require("remark-lint-unordered-list-marker-style"), "-"],
50 + [require("remark-lint-ordered-list-marker-style"), "."],
51 + [require("remark-lint-ordered-list-marker-value"), "ordered"],
52 + /*[
53 + require("remark-lint-write-good"),
54 + [
55 + "warn",
56 + {
57 + passive: false,
58 + illusion: true,
59 + so: true,
60 + thereIs: true,
61 + weasel: true,
62 + adverb: true,
63 + tooWordy: true,
64 + cliches: true,
65 + eprime: false
66 + }
67 + ]
68 + ],*/
69 + require("remark-validate-links"),
70 + require("remark-frontmatter"),
71 + /*[
72 + require("remark-retext"),
73 + require("unified")().use({
74 + plugins: [
75 + require("retext-english"),
76 + require("retext-syntax-urls"),
77 + [
78 + require("retext-spell"),
79 + {
80 + ignoreLiteral: true,
81 + dictionary: require("dictionary-en-us"),
82 + ...personalDictionary
83 + }
84 + ],
85 + [
86 + require("retext-sentence-spacing"),
87 + {
88 + preferred: 1
89 + }
90 + ],
91 + require("retext-repeated-words"),
92 + require("retext-usage"),
93 + require("retext-indefinite-article"),
94 + require("retext-redundant-acronyms"),
95 + [
96 + require("retext-contractions"),
97 + {
98 + straight: true,
99 + allowLiteral: true
100 + }
101 + ],
102 + require("retext-diacritics"),
103 + [
104 + require("retext-quotes"),
105 + {
106 + preferred: "straight"
107 + }
108 + ],
109 + require("retext-equality"),
110 + require("retext-passive"),
111 + require("retext-profanities"),
112 + [
113 + require("retext-readability"),
114 + {
115 + age: 20
116 + }
117 + ]
118 + ]
119 + })
120 + ]*/
121 +];
package.json
+44 -10
@@ -1,23 +1,57 @@
1 {
2 "devDependencies": {
3 "coffee-script": "^1.12.7",
4 + "dictionary-en-us": "^2.0.0",
5 + "gaze": "^1.1.2",
6 + "grunt": "^1.0.1",
7 + "grunt-exec": "^2.0.0",
8 "jasmine": "^2.6.0",
9 "jasmine-core": "^2.6.4",
10 + "jasmine-growl-reporter": "^1.0.1",
11 + "jasmine-node": "BrainDoctor/jasmine-node",
12 + "jasmine-reporters": "^2.2.1",
13 "karma": "^1.7.0",
14 "karma-chrome-launcher": "^2.2.0",
15 "karma-coverage": "^1.1.1",
16 "karma-firefox-launcher": "^1.0.1",
17 "karma-jasmine": "^1.1.0",
11 - "walkdir": "^0.0.11",
12 - "underscore": "^1.8.3",
13 - "gaze": "^1.1.2",
14 - "mkdirp": "^0.5.1",
18 "minimist": "^1.2.0",
16 - "jasmine-growl-reporter": "^1.0.1",
17 - "xml2js": "^0.4.17",
18 - "grunt": "^1.0.1",
19 - "grunt-exec": "^2.0.0",
20 - "jasmine-reporters": "^2.2.1",
21 - "jasmine-node": "BrainDoctor/jasmine-node"
19 + "mkdirp": "^0.5.1",
20 + "remark-cli": "^6.0.1",
21 + "remark-frontmatter": "^1.3.1",
22 + "remark-lint-heading-whitespace": "^1.0.0",
23 + "remark-lint-no-dead-urls": "^0.4.1",
24 + "remark-lint-unordered-list-marker-style": "^1.0.2",
25 + "remark-lint-write-good": "^1.1.0",
26 + "remark-preset-lint-consistent": "^2.0.2",
27 + "remark-preset-lint-markdown-style-guide": "^2.1.2",
28 + "remark-preset-lint-recommended": "^3.0.2",
29 + "remark-retext": "^3.1.2",
30 + "remark-stringify": "^6.0.4",
31 + "remark-validate-links": "^8.0.2",
32 + "retext-contractions": "^2.1.3",
33 + "retext-diacritics": "^1.2.2",
34 + "retext-english": "^3.0.2",
35 + "retext-equality": "^3.9.1",
36 + "retext-indefinite-article": "^1.1.6",
37 + "retext-overuse": "^1.1.1",
38 + "retext-passive": "^1.3.2",
39 + "retext-profanities": "^4.6.0",
40 + "retext-quotes": "^2.0.3",
41 + "retext-readability": "^4.2.1",
42 + "retext-redundant-acronyms": "^1.2.2",
43 + "retext-repeated-words": "^1.2.2",
44 + "retext-sentence-spacing": "^2.1.0",
45 + "retext-spell": "^2.4.0",
46 + "retext-syntax-urls": "^1.0.1",
47 + "retext-usage": "^0.5.0",
48 + "underscore": "^1.8.3",
49 + "walkdir": "^0.0.11",
50 + "xml2js": "^0.4.17"
51 + },
52 + "scripts": {
53 + "lint-md": "remark .",
54 + "lint-md-path": "remark",
55 + "fix-md": "remark collectors --output"
56 }
57 }