Skip to content

Commit 98f2224

Browse files
daxelrodljharb
authored andcommitted
Add linting for Markdown prose
Codify existing practices for writing Markdown in style guides and enforce them via Markdownlint. A new npm script "lint" in the top level package.json runs before tests or as the first step of the "travis" script. Only modify documents in cases where they had bugs or isolated cases of inconsistency: README.md: 10: MD007 Unordered list indentation Inconsistent with all other top level lists README.md: 10: MD032 Lists should be surrounded by blank lines Some Markdown parsers don't handle this correctly README.md: 3156-3161: MD005 Inconsistent indentation for list items at the same level Bug, looks like it's intended to be another list level but GitHub renders it at the same level as the "No but seriously" README.md & css-in-javascript/README.md: throughout: MD012 Multiple consecutive blank lines README.md: throughout: MD004 Unordered list style Some nested lists used plusses, now everything consistently uses dashes.
1 parent ac6de2f commit 98f2224

File tree

4 files changed

+190
-58
lines changed

4 files changed

+190
-58
lines changed

README.md

+29-56
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
88

99
Other Style Guides
10-
- [ES5 (Deprecated)](https://github.com/airbnb/javascript/tree/es5-deprecated/es5)
11-
- [React](react/)
12-
- [CSS-in-JavaScript](css-in-javascript/)
13-
- [CSS & Sass](https://github.com/airbnb/css)
14-
- [Ruby](https://github.com/airbnb/ruby)
10+
11+
- [ES5 (Deprecated)](https://github.com/airbnb/javascript/tree/es5-deprecated/es5)
12+
- [React](react/)
13+
- [CSS-in-JavaScript](css-in-javascript/)
14+
- [CSS & Sass](https://github.com/airbnb/css)
15+
- [Ruby](https://github.com/airbnb/ruby)
1516

1617
## Table of Contents
1718

@@ -58,11 +59,11 @@ Other Style Guides
5859
<a name="types--primitives"></a><a name="1.1"></a>
5960
- [1.1](#types--primitives) **Primitives**: When you access a primitive type you work directly on its value.
6061

61-
+ `string`
62-
+ `number`
63-
+ `boolean`
64-
+ `null`
65-
+ `undefined`
62+
- `string`
63+
- `number`
64+
- `boolean`
65+
- `null`
66+
- `undefined`
6667

6768
```javascript
6869
const foo = 1;
@@ -76,9 +77,9 @@ Other Style Guides
7677
<a name="types--complex"></a><a name="1.2"></a>
7778
- [1.2](#types--complex) **Complex**: When you access a complex type you work on a reference to its value.
7879

79-
+ `object`
80-
+ `array`
81-
+ `function`
80+
- `object`
81+
- `array`
82+
- `function`
8283

8384
```javascript
8485
const foo = [1, 2];
@@ -524,7 +525,6 @@ Other Style Guides
524525
const { left, top } = processInput(input);
525526
```
526527
527-
528528
**[⬆ back to top](#table-of-contents)**
529529
530530
## Strings
@@ -610,7 +610,6 @@ Other Style Guides
610610
611611
**[⬆ back to top](#table-of-contents)**
612612
613-
614613
## Functions
615614
616615
<a name="functions--declarations"></a><a name="7.1"></a>
@@ -1016,7 +1015,6 @@ Other Style Guides
10161015
10171016
**[⬆ back to top](#table-of-contents)**
10181017
1019-
10201018
## Classes & Constructors
10211019
10221020
<a name="constructors--use-class"></a><a name="9.1"></a>
@@ -1035,7 +1033,6 @@ Other Style Guides
10351033
return value;
10361034
};
10371035

1038-
10391036
// good
10401037
class Queue {
10411038
constructor(contents = []) {
@@ -1110,7 +1107,6 @@ Other Style Guides
11101107
.setHeight(20);
11111108
```
11121109
1113-
11141110
<a name="constructors--tostring"></a><a name="9.4"></a>
11151111
- [9.4](#constructors--tostring) It's okay to write a custom toString() method, just make sure it works successfully and causes no side effects.
11161112
@@ -1182,10 +1178,8 @@ Other Style Guides
11821178
}
11831179
```
11841180

1185-
11861181
**[⬆ back to top](#table-of-contents)**
11871182

1188-
11891183
## Modules
11901184

11911185
<a name="modules--use-them"></a><a name="10.1"></a>
@@ -1449,7 +1443,6 @@ Other Style Guides
14491443
14501444
**[⬆ back to top](#table-of-contents)**
14511445
1452-
14531446
## Properties
14541447
14551448
<a name="properties--dot"></a><a name="12.1"></a>
@@ -1486,7 +1479,6 @@ Other Style Guides
14861479
14871480
**[⬆ back to top](#table-of-contents)**
14881481
1489-
14901482
## Variables
14911483
14921484
<a name="variables--const"></a><a name="13.1"></a>
@@ -1656,7 +1648,6 @@ Other Style Guides
16561648
16571649
**[⬆ back to top](#table-of-contents)**
16581650
1659-
16601651
## Hoisting
16611652
16621653
<a name="hoisting--about"></a><a name="14.1"></a>
@@ -1756,7 +1747,6 @@ Other Style Guides
17561747
17571748
**[⬆ back to top](#table-of-contents)**
17581749
1759-
17601750
## Comparison Operators & Equality
17611751
17621752
<a name="comparison--eqeqeq"></a><a name="15.1"></a>
@@ -1765,12 +1755,12 @@ Other Style Guides
17651755
<a name="comparison--if"></a><a name="15.2"></a>
17661756
- [15.2](#comparison--if) Conditional statements such as the `if` statement evaluate their expression using coercion with the `ToBoolean` abstract method and always follow these simple rules:
17671757
1768-
+ **Objects** evaluate to **true**
1769-
+ **Undefined** evaluates to **false**
1770-
+ **Null** evaluates to **false**
1771-
+ **Booleans** evaluate to **the value of the boolean**
1772-
+ **Numbers** evaluate to **false** if **+0, -0, or NaN**, otherwise **true**
1773-
+ **Strings** evaluate to **false** if an empty string `''`, otherwise **true**
1758+
- **Objects** evaluate to **true**
1759+
- **Undefined** evaluates to **false**
1760+
- **Null** evaluates to **false**
1761+
- **Booleans** evaluate to **the value of the boolean**
1762+
- **Numbers** evaluate to **false** if **+0, -0, or NaN**, otherwise **true**
1763+
- **Strings** evaluate to **false** if an empty string `''`, otherwise **true**
17741764
17751765
```javascript
17761766
if ([0] && []) {
@@ -1910,7 +1900,6 @@ Other Style Guides
19101900

19111901
**[⬆ back to top](#table-of-contents)**
19121902

1913-
19141903
## Blocks
19151904

19161905
<a name="blocks--braces"></a><a name="16.1"></a>
@@ -1960,10 +1949,8 @@ Other Style Guides
19601949
}
19611950
```
19621951

1963-
19641952
**[⬆ back to top](#table-of-contents)**
19651953

1966-
19671954
## Control Statements
19681955

19691956
<a name="control-statements"></a>
@@ -2018,10 +2005,8 @@ Other Style Guides
20182005
}
20192006
```
20202007
2021-
20222008
**[⬆ back to top](#table-of-contents)**
20232009
2024-
20252010
## Comments
20262011
20272012
<a name="comments--multiline"></a><a name="17.1"></a>
@@ -2162,7 +2147,6 @@ Other Style Guides
21622147

21632148
**[⬆ back to top](#table-of-contents)**
21642149

2165-
21662150
## Whitespace
21672151

21682152
<a name="whitespace--spaces"></a><a name="18.1"></a>
@@ -2624,7 +2608,6 @@ Other Style Guides
26242608
26252609
**[⬆ back to top](#table-of-contents)**
26262610
2627-
26282611
## Semicolons
26292612
26302613
<a name="semicolons--required"></a><a name="20.1"></a>
@@ -2654,7 +2637,6 @@ Other Style Guides
26542637
26552638
**[⬆ back to top](#table-of-contents)**
26562639
2657-
26582640
## Type Casting & Coercion
26592641
26602642
<a name="coercion--explicit"></a><a name="21.1"></a>
@@ -2741,7 +2723,6 @@ Other Style Guides
27412723
27422724
**[⬆ back to top](#table-of-contents)**
27432725
2744-
27452726
## Naming Conventions
27462727
27472728
<a name="naming--descriptive"></a><a name="22.1"></a>
@@ -2933,7 +2914,6 @@ Other Style Guides
29332914
29342915
**[⬆ back to top](#table-of-contents)**
29352916
2936-
29372917
## Accessors
29382918
29392919
<a name="accessors--not-required"></a><a name="23.1"></a>
@@ -3003,7 +2983,6 @@ Other Style Guides
30032983
30042984
**[⬆ back to top](#table-of-contents)**
30052985
3006-
30072986
## Events
30082987
30092988
<a name="events--hash"></a><a name="24.1"></a>
@@ -3035,7 +3014,6 @@ Other Style Guides
30353014
30363015
**[⬆ back to top](#table-of-contents)**
30373016
3038-
30393017
## jQuery
30403018
30413019
<a name="jquery--dollar-prefix"></a><a name="25.1"></a>
@@ -3105,7 +3083,6 @@ Other Style Guides
31053083
31063084
**[⬆ back to top](#table-of-contents)**
31073085
3108-
31093086
## ECMAScript 5 Compatibility
31103087
31113088
<a name="es5-compat--kangax"></a><a name="26.1"></a>
@@ -3153,16 +3130,15 @@ Other Style Guides
31533130
31543131
<a name="testing--for-real"></a><a name="28.2"></a>
31553132
- [29.2](#testing--for-real) **No, but seriously**:
3156-
- Whichever testing framework you use, you should be writing tests!
3157-
- Strive to write many small pure functions, and minimize where mutations occur.
3158-
- Be cautious about stubs and mocks - they can make your tests more brittle.
3159-
- We primarily use [`mocha`](https://www.npmjs.com/package/mocha) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules.
3160-
- 100% test coverage is a good goal to strive for, even if it's not always practical to reach it.
3161-
- Whenever you fix a bug, _write a regression test_. A bug fixed without a regression test is almost certainly going to break again in the future.
3133+
- Whichever testing framework you use, you should be writing tests!
3134+
- Strive to write many small pure functions, and minimize where mutations occur.
3135+
- Be cautious about stubs and mocks - they can make your tests more brittle.
3136+
- We primarily use [`mocha`](https://www.npmjs.com/package/mocha) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules.
3137+
- 100% test coverage is a good goal to strive for, even if it's not always practical to reach it.
3138+
- Whenever you fix a bug, _write a regression test_. A bug fixed without a regression test is almost certainly going to break again in the future.
31623139
31633140
**[⬆ back to top](#table-of-contents)**
31643141
3165-
31663142
## Performance
31673143
31683144
- [On Layout & Web Performance](https://www.kellegous.com/j/2013/01/26/layout-performance/)
@@ -3177,7 +3153,6 @@ Other Style Guides
31773153
31783154
**[⬆ back to top](#table-of-contents)**
31793155
3180-
31813156
## Resources
31823157
31833158
**Learning ES6**
@@ -3194,9 +3169,9 @@ Other Style Guides
31943169
**Tools**
31953170
31963171
- Code Style Linters
3197-
+ [ESlint](http://eslint.org/) - [Airbnb Style .eslintrc](https://github.com/airbnb/javascript/blob/master/linters/.eslintrc)
3198-
+ [JSHint](http://jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/.jshintrc)
3199-
+ [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json) (Deprecated, please use [ESlint](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base))
3172+
- [ESlint](http://eslint.org/) - [Airbnb Style .eslintrc](https://github.com/airbnb/javascript/blob/master/linters/.eslintrc)
3173+
- [JSHint](http://jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/.jshintrc)
3174+
- [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json) (Deprecated, please use [ESlint](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base))
32003175
- Neutrino preset - [neutrino-preset-airbnb-base](https://neutrino.js.org/presets/neutrino-preset-airbnb-base/)
32013176
32023177
**Other Style Guides**
@@ -3257,7 +3232,6 @@ Other Style Guides
32573232
- [JavaScript Air](https://javascriptair.com/)
32583233
- [JavaScript Jabber](https://devchat.tv/js-jabber/)
32593234
3260-
32613235
**[⬆ back to top](#table-of-contents)**
32623236
32633237
## In the Wild
@@ -3385,7 +3359,6 @@ Other Style Guides
33853359
33863360
- [View Contributors](https://github.com/airbnb/javascript/graphs/contributors)
33873361
3388-
33893362
## License
33903363
33913364
(The MIT License)

css-in-javascript/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@
176176

177177
export default withStyles(() => styles)(MyComponent);
178178

179-
180179
// good
181180
function MyComponent({ styles }) {
182181
return (

0 commit comments

Comments
 (0)