[doc] add eslint rule references in react guide

* react/jsx-filename-extension
* react/no-array-index-key
This commit is contained in:
Pirasis Leelatanon
2018-10-04 20:29:10 +07:00
committed by GitHub
parent 924dfb2682
commit 24da5bb540

View File

@@ -80,7 +80,7 @@ This style guide is mostly based on the standards that are currently prevalent i
## Naming
- **Extensions**: Use `.jsx` extension for React components.
- **Extensions**: Use `.jsx` extension for React components. eslint: [`react/jsx-filename-extension`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md)
- **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.jsx`.
- **Reference Naming**: Use PascalCase for React components and camelCase for their instances. eslint: [`react/jsx-pascal-case`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md)
@@ -351,7 +351,7 @@ This style guide is mostly based on the standards that are currently prevalent i
<div />
```
- Avoid using an array index as `key` prop, prefer a stable ID.
- Avoid using an array index as `key` prop, prefer a stable ID. eslint: [`react/no-array-index-key`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md)
> Why? Not using a stable ID [is an anti-pattern](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318) because it can negatively impact performance and cause issues with component state.