Skip to content

Commit 456fab3

Browse files
committed
[Docs] Add markdownlint for documentation formatting consistency
1 parent 885afc3 commit 456fab3

39 files changed

+95
-63
lines changed

.markdownlint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"line-length": false
3+
}

.markdownlintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CHANGELOG.md
2+
LICENSE
3+
node_modules

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- markdownlint-disable-next-line MD033-->
12
# `eslint-plugin-react` <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
3+
24
===================
35

46
[![github actions][actions-image]][actions-url]
@@ -8,16 +10,15 @@
810

911
React specific linting rules for `eslint`
1012

11-
# Installation
13+
## Installation
1214

1315
```sh
14-
$ npm install eslint eslint-plugin-react --save-dev
16+
npm install eslint eslint-plugin-react --save-dev
1517
```
1618

1719
It is also possible to install ESLint globally rather than locally (using npm install eslint --global). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
1820

19-
# Configuration
20-
21+
## Configuration
2122

2223
Use [our preset](#recommended) to get reasonable defaults:
2324

@@ -109,7 +110,7 @@ Enable the rules that you would like to use.
109110
}
110111
```
111112

112-
# List of supported rules
113+
## List of supported rules
113114

114115
✔: Enabled in the [`recommended`](#recommended) configuration.\
115116
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).\
@@ -179,7 +180,7 @@ Enable the rules that you would like to use.
179180
| | | | [react/void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md) | Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children |
180181
<!-- AUTO-GENERATED-CONTENT:END -->
181182

182-
## JSX-specific rules
183+
### JSX-specific rules
183184

184185
<!-- AUTO-GENERATED-CONTENT:START (JSX_RULES) -->
185186
|| 🔧 | 💡 | Rule | Description |
@@ -225,15 +226,15 @@ Enable the rules that you would like to use.
225226
| | 🔧 | | [react/jsx-wrap-multilines](docs/rules/jsx-wrap-multilines.md) | Disallow missing parentheses around multiline JSX |
226227
<!-- AUTO-GENERATED-CONTENT:END -->
227228

228-
## Other useful plugins
229+
### Other useful plugins
229230

230231
- Rules of Hooks: [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks)
231232
- JSX accessibility: [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y)
232233
- React Native: [eslint-plugin-react-native](https://github.com/Intellicode/eslint-plugin-react-native)
233234

234-
# Shareable configurations
235+
## Shareable configurations
235236

236-
## Recommended
237+
### Recommended
237238

238239
This plugin exports a `recommended` configuration that enforces React good practices.
239240

@@ -247,7 +248,7 @@ To enable this configuration use the `extends` property in your `.eslintrc` conf
247248

248249
See [`eslint` documentation](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files) for more information about extending configuration files.
249250

250-
## All
251+
### All
251252

252253
This plugin also exports an `all` configuration that includes every available rule.
253254
This pairs well with the `eslint:all` rule.
@@ -263,11 +264,10 @@ This pairs well with the `eslint:all` rule.
263264

264265
**Note**: These configurations will import `eslint-plugin-react` and enable JSX in [parser options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options).
265266

266-
# License
267+
## License
267268

268269
`eslint-plugin-react` is licensed under the [MIT License](https://opensource.org/licenses/mit-license.php).
269270

270-
271271
[npm-url]: https://npmjs.org/package/eslint-plugin-react
272272
[npm-image]: https://img.shields.io/npm/v/eslint-plugin-react.svg
273273

SECURITY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ This is the list of versions of `eslint-plugin-react` which are currently being
99
| 7.x | :white_check_mark: |
1010
| < 7.x | :x: |
1111

12-
1312
## Reporting a Vulnerability
1413

1514
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.

docs/rules/boolean-prop-naming.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var Hello = createReactClass({
3636
render: function() { return <div />; };
3737
});
3838
```
39+
3940
```jsx
4041
type Props = {
4142
isEnabled: boolean
@@ -94,8 +95,8 @@ The custom message to display upon failure to match the rule. This overrides the
9495

9596
If you choose to use a custom message, you have access to two template variables.
9697

97-
* `propName` – the name of the prop that does not match the pattern
98-
* `pattern` – the pattern against which all prop names are tested
98+
- `propName` – the name of the prop that does not match the pattern
99+
- `pattern` – the pattern against which all prop names are tested
99100

100101
For example, if a prop is named `something`, and if the rule's pattern is set to `"^(is|has)[A-Z]([A-Za-z0-9]?)+"`, you could set the custom message as follows:
101102

@@ -105,7 +106,7 @@ message: 'It is better if your prop ({{ propName }}) matches this pattern: ({{ p
105106

106107
And the failure would look like so:
107108

108-
```
109+
```plaintext
109110
It is better if your prop (something) matches this pattern: (^is[A-Z]([A-Za-z0-9]?)+)
110111
```
111112

docs/rules/default-props-match-prop-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ If you don't care about stray `defaultsProps` in your components, you can disabl
192192

193193
- [require-default-props](./require-default-props.md)
194194

195-
# Resources
195+
## Resources
196196

197197
- [Official React documentation on defaultProps](https://facebook.github.io/react/docs/typechecking-with-proptypes.html#default-prop-values)
198198

docs/rules/destructuring-assignment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
44

55
Rule can be set to either of `always` or `never`;
6+
67
```js
78
"react/destructuring-assignment": [<enabled>, 'always']
89
```

docs/rules/iframe-missing-sandbox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The sandbox attribute enables an extra set of restrictions for the content in the iframe. Using sandbox attribute is considered a good security practice.
44

5-
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
5+
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox>
66

77
## Rule Details
88

docs/rules/jsx-curly-brace-presence.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ or alternatively
3232
...
3333
```
3434

35-
### Valid options for <string>
35+
### Valid options for `<string>`
3636

3737
They are `always`, `never` and `ignore` for checking on JSX props and children.
3838

@@ -45,7 +45,7 @@ If passed in the option to fix, this is how a style violation will get fixed
4545
* `always`: wrap a JSX attribute in curly braces/JSX expression and/or a JSX child the same way but also with double quotes
4646
* `never`: get rid of curly braces from a JSX attribute and/or a JSX child
4747

48-
- All fixing operations use double quotes.
48+
* All fixing operations use double quotes.
4949

5050
For examples:
5151

@@ -78,6 +78,7 @@ They can be fixed to:
7878
```
7979

8080
Examples of **incorrect** code for this rule, when configured with `{ props: "always", children: "always", "propElementValues": "always" }`:
81+
8182
```jsx
8283
<App prop=<div /> />;
8384
```
@@ -89,6 +90,7 @@ They can be fixed to:
8990
```
9091

9192
Examples of **incorrect** code for this rule, when configured with `{ props: "never", children: "never", "propElementValues": "never" }`:
93+
9294
```jsx
9395
<App prop={<div />} />;
9496
```
@@ -115,6 +117,7 @@ Examples of **incorrect** code for this rule, when configured with `"always"`:
115117
```
116118

117119
They can be fixed to:
120+
118121
```jsx
119122
<App>{"Hello world"}</App>;
120123
<App prop={"Hello world"} attr={"foo"}>{"Hello world"}</App>;
@@ -152,7 +155,6 @@ will be warned and fixed to:
152155

153156
For example:
154157

155-
156158
```jsx
157159
<App prop='Hello "foo" world'>Hello 'foo' "bar" world</App>;
158160
```

docs/rules/jsx-curly-newline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This rule accepts either an object option:
1818
singleline: "consistent" | "forbid" | "require", // default to 'consistent'
1919
}
2020
```
21+
2122
Option `multiline` takes effect when the jsx expression inside the curlies occupies multiple lines.
2223

2324
Option `singleline` takes effect when the jsx expression inside the curlies occupies a single line.
@@ -143,7 +144,6 @@ Examples of **correct** code for this rule:
143144
</div>
144145
```
145146

146-
147147
## When Not To Use It
148148

149149
You can turn this rule off if you are not concerned with the consistency of padding linebreaks inside of JSX attributes or expressions.

0 commit comments

Comments
 (0)