Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 2a2f2f0

Browse files
authored
Merge pull request #138 from mobify/markdown-lint-rule-tweaks
Markdown lint rule tweaks
2 parents afd0d5a + 90f9b14 commit 2a2f2f0

File tree

14 files changed

+120
-53
lines changed

14 files changed

+120
-53
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# To be released
2+
- Re-organized and cleaned up markdown linting files
3+
- Switched to using `no-duplicate-headings-in-section` (instead of `no-duplicate-headings`)
4+
15
2.7.0
26
- Remove `variable-for-property` rule from sass-lint
37
- Adds markdown linting via `lint-md` script

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
A repo to document code standards for different languages and provide tools for linting Mobify projects.
44

55
[![NPM version](https://badge.fury.io/js/mobify-code-style.svg)](http://badge.fury.io/js/mobify-code-style)
6+
[![CircleCI](https://circleci.com/gh/mobify/mobify-code-style/tree/develop.svg?style=svg)](https://circleci.com/gh/mobify/mobify-code-style/tree/develop)
67

78
## JavaScript (ES5) with Grunt
89

@@ -25,7 +26,6 @@ extends:
2526
- './node_modules/mobify-code-style/es5/mobify-es5.yml'
2627
```
2728
28-
2929
Sample eslint Grunt config:
3030
3131
```javascript
@@ -103,4 +103,4 @@ instructions on using `pep8`, `pylint` and `pyflakes` to check Python code.
103103

104104
## Documentation
105105

106-
See the [`docs`](docs) directory for setup and configuration of Markdown linting.
106+
See the [`docs`](docs) directory for setup and configuration of Markdown linting.

bin/lint-md

Lines changed: 0 additions & 7 deletions
This file was deleted.

bin/lint-md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../docs/bin/lint-md

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ What kind of document best meets your goal?
4949

5050
**After writing**
5151

52-
* [ ] 👍 Reviewer
52+
* [ ] 👍 Review
5353
* [ ] 🍻 Celeberate

docs/bin/lint-md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -eu
2+
3+
# Lints Markdown files using Mobify's `.remarkrc` configuration.
4+
BIN="${BASH_SOURCE[0]}"
5+
BIN_DIR="$(cd "$(dirname "$BIN")" && pwd)"
6+
7+
# We jump through some hoops here because we symlink the node module's
8+
# bin into the docs/bin/ directory and we want to support invoking
9+
# via the symlink and directly via `/docs/bin/lint-md`
10+
if [ -h "$BIN" ]; then
11+
# Dereference the symlink
12+
BIN="$BIN_DIR/$(readlink "$BIN")"
13+
fi
14+
BIN_DIR="$(cd "$(dirname "$BIN")" && pwd)"
15+
16+
REMARK_RC="$BIN_DIR/../remarkrc"
17+
REMARK_CLI="$(npm bin)/remark"
18+
19+
$REMARK_CLI --rc-path $REMARK_RC "$@"

.remarkrc renamed to docs/remarkrc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,14 @@
1616
"maximum-heading-length": 60,
1717
"maximum-line-length": 80,
1818
"no-consecutive-blank-lines": true,
19-
"no-duplicate-headings": true,
19+
"no-duplicate-headings-in-section": true,
2020
"no-file-name-articles": true,
21-
"no-file-name-articles": true,
22-
"no-file-name-consecutive-dashes": true,
2321
"no-file-name-consecutive-dashes": true,
2422
"no-file-name-irregular-characters": true,
25-
"no-file-name-irregular-characters": true,
26-
"no-file-name-mixed-case": true,
2723
"no-file-name-mixed-case": true,
2824
"no-file-name-outer-dashes": true,
29-
"no-file-name-outer-dashes": true,
30-
"no-heading-content-indent": true,
3125
"no-heading-content-indent": true,
3226
"no-heading-indent": true,
33-
"no-heading-indent": true,
3427
"no-multiple-toplevel-headings": 0,
3528
"no-table-indentation": true,
3629
"no-tabs": true,
@@ -40,4 +33,4 @@
4033
"unordered-list-marker-style": "-"
4134
}
4235
}
43-
}
36+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
a-bad-filename.md
3+
1:1 warning Do not start file names with `a` no-file-name-articles remark-lint
4+
5+
⚠ 1 warning

docs/test/a-bad-filename.md

Whitespace-only changes.

docs/test/bad.expected.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Used to test violations of style.
1414

1515
BAD: Really, really long lines of text that should probably be wrapped to a more sane length that this.
1616

17-
BAD: List immedidately following text.
17+
BAD: List immediately following text.
1818

1919
- list
2020

@@ -44,21 +44,20 @@ BAD: Indented code-block.
4444
# Indented code block
4545

4646
BAD: Missing newline at end of file.
47-
docs/test/bad.md
48-
1:1 warning Missing newline character at end of file final-newline remark-lint
49-
7:1-7:43 warning Heading levels should increment by one level at a time heading-increment remark-lint
50-
9:1-9:33 warning Don’t use multiple top level headings (9:1) no-multiple-toplevel-headings remark-lint
51-
13:1-13:27 warning Do not use headings with similar content (11:1) no-duplicate-headings remark-lint
52-
15:104 warning Line must be at most 80 characters maximum-line-length remark-lint
53-
18:5 warning Incorrect list-item indent: remove 2 spaces list-item-indent remark-lint
54-
26:4 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
55-
30:1-30:8 warning Marker style should be `-` unordered-list-marker-style remark-lint
56-
30:4 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
57-
34:5 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
58-
35:1-35:9 warning Marker should be `2`, was `1` ordered-list-marker-value remark-lint
59-
35:5 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
60-
38:1 warning Remove 1 line before node no-consecutive-blank-lines remark-lint
61-
40:1-42:4 warning Missing code-language flag fenced-code-flag remark-lint
62-
46:1-46:26 warning Code blocks should be fenced code-block-style remark-lint
63-
64-
⚠ 15 warnings
47+
bad.md
48+
7:1-7:43 warning Heading levels should increment by one level at a time heading-increment remark-lint
49+
9:1-9:33 warning Don’t use multiple top level headings (9:1) no-multiple-toplevel-headings remark-lint
50+
13:1-13:27 warning Do not use headings with similar content per section (11:1) no-duplicate-headings-in-section remark-lint
51+
15:104 warning Line must be at most 80 characters maximum-line-length remark-lint
52+
18:5 warning Incorrect list-item indent: remove 2 spaces list-item-indent remark-lint
53+
26:4 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
54+
30:1-30:8 warning Marker style should be `-` unordered-list-marker-style remark-lint
55+
30:4 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
56+
34:5 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
57+
35:1-35:9 warning Marker should be `2`, was `1` ordered-list-marker-value remark-lint
58+
35:5 warning Incorrect list-item indent: remove 1 space list-item-indent remark-lint
59+
38:1 warning Remove 1 line before node no-consecutive-blank-lines remark-lint
60+
40:1-42:4 warning Missing code-language flag fenced-code-flag remark-lint
61+
46:1-46:26 warning Code blocks should be fenced code-block-style remark-lint
62+
63+
⚠ 14 warnings

0 commit comments

Comments
 (0)