Skip to content

Commit

Permalink
docs: automate docs with eslint-doc-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Oct 20, 2022
1 parent f17395e commit 1a69655
Show file tree
Hide file tree
Showing 108 changed files with 397 additions and 523 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/readme.yml

This file was deleted.

227 changes: 112 additions & 115 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/rules/boolean-prop-naming.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforces consistent naming for boolean props (react/boolean-prop-naming)
# Enforces consistent naming for boolean props (`react/boolean-prop-naming`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

Allows you to enforce a consistent naming pattern for props which expect a boolean value.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/button-has-type.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow usage of `button` elements without an explicit `type` attribute (react/button-has-type)
# Disallow usage of `button` elements without an explicit `type` attribute (`react/button-has-type`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

The default value of `type` attribute for `button` HTML element is `"submit"` which is often not the desired behavior and may lead to unexpected page reloads.
This rules enforces an explicit `type` attribute for all the `button` elements and checks that its value is valid per spec (i.e., is one of `"button"`, `"submit"`, and `"reset"`).
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/default-props-match-prop-types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce all defaultProps have a corresponding non-required PropType (react/default-props-match-prop-types)
# Enforce all defaultProps have a corresponding non-required PropType (`react/default-props-match-prop-types`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

This rule aims to ensure that any prop in `defaultProps` has a non-required type
definition.
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/destructuring-assignment.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce consistent usage of destructuring assignment of props, state, and context (react/destructuring-assignment)
# Enforce consistent usage of destructuring assignment of props, state, and context (`react/destructuring-assignment`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Rule can be set to either of `always` or `never`;

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/display-name.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow missing displayName in a React component definition (react/display-name)
# Disallow missing displayName in a React component definition (`react/display-name`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`, `recommended`.
✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#shareable-configs).

<!-- end rule header -->

DisplayName allows you to name your component. This name is used by React in debugging messages.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/forbid-component-props.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow certain props on components (react/forbid-component-props)
# Disallow certain props on components (`react/forbid-component-props`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

By default this rule prevents passing of [props that add lots of complexity](https://medium.com/brigade-engineering/don-t-pass-css-classes-between-components-e9f7ab192785) (`className`, `style`) to Components. This rule only applies to Components (e.g. `<Foo />`) and not DOM nodes (e.g. `<div />`). The list of forbidden props can be customized with the `forbid` option.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/forbid-dom-props.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow certain props on DOM Nodes (react/forbid-dom-props)
# Disallow certain props on DOM Nodes (`react/forbid-dom-props`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

This rule prevents passing of props to elements. This rule only applies to DOM Nodes (e.g. `<div />`) and not Components (e.g. `<Component />`).
The list of forbidden props can be customized with the `forbid` option.
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/forbid-elements.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow certain elements (react/forbid-elements)
# Disallow certain elements (`react/forbid-elements`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

You may want to forbid usage of certain elements in favor of others, (e.g. forbid all `<div />` and use `<Box />` instead). This rule allows you to configure a list of forbidden elements and to specify their desired replacements.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/forbid-foreign-prop-types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow using another component's propTypes (react/forbid-foreign-prop-types)
# Disallow using another component's propTypes (`react/forbid-foreign-prop-types`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

This rule forbids using another component's prop types unless they are explicitly imported/exported. This allows people who want to use [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) to remove propTypes from their components in production builds, to do so safely.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/forbid-prop-types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow certain propTypes (react/forbid-prop-types)
# Disallow certain propTypes (`react/forbid-prop-types`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

By default this rule prevents vague prop types with more specific alternatives available (`any`, `array`, `object`), but any prop type can be disabled if desired. The defaults are chosen because they have obvious replacements. `any` should be replaced with, well, anything. `array` and `object` can be replaced with `arrayOf` and `shape`, respectively.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/function-component-definition.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce a specific function type for function components (react/function-component-definition)
# Enforce a specific function type for function components (`react/function-component-definition`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

This option enforces a specific function type for function components.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/hook-use-state.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Ensure destructuring and symmetric naming of useState hook value and setter variables (react/hook-use-state)
# Ensure destructuring and symmetric naming of useState hook value and setter variables (`react/hook-use-state`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

<!-- end rule header -->

💡 This rule provides editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/iframe-missing-sandbox.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce sandbox attribute on iframe elements (react/iframe-missing-sandbox)
# Enforce sandbox attribute on iframe elements (`react/iframe-missing-sandbox`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

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

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-boolean-value.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce boolean attributes notation in JSX (react/jsx-boolean-value)
# Enforce boolean attributes notation in JSX (`react/jsx-boolean-value`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

[When using a boolean attribute in JSX](https://facebook.github.io/react/docs/jsx-in-depth.html#boolean-attributes), you can set the attribute value to `true` or omit the value.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/jsx-child-element-spacing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (react/jsx-child-element-spacing)
# Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (`react/jsx-child-element-spacing`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

## Rule Details

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-closing-bracket-location.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce closing bracket location in JSX (react/jsx-closing-bracket-location)
# Enforce closing bracket location in JSX (`react/jsx-closing-bracket-location`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Enforce the closing bracket location for JSX multiline elements.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-closing-tag-location.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce closing tag location for multiline JSX (react/jsx-closing-tag-location)
# Enforce closing tag location for multiline JSX (`react/jsx-closing-tag-location`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Enforce the closing tag location for multiline JSX elements.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-curly-brace-presence.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes (react/jsx-curly-brace-presence)
# Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes (`react/jsx-curly-brace-presence`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

This rule allows you to enforce curly braces or disallow unnecessary curly braces in JSX props and/or children.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-curly-newline.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce consistent linebreaks in curly braces in JSX attributes and expressions (react/jsx-curly-newline)
# Enforce consistent linebreaks in curly braces in JSX attributes and expressions (`react/jsx-curly-newline`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Many style guides require or disallow newlines inside of jsx curly expressions.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-curly-spacing.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (react/jsx-curly-spacing)
# Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (`react/jsx-curly-spacing`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-equals-spacing.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce or disallow spaces around equal signs in JSX attributes (react/jsx-equals-spacing)
# Enforce or disallow spaces around equal signs in JSX attributes (`react/jsx-equals-spacing`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Some style guides require or disallow spaces around equal signs.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/jsx-filename-extension.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow file extensions that may contain JSX (react/jsx-filename-extension)
# Disallow file extensions that may contain JSX (`react/jsx-filename-extension`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

## Rule Details

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-first-prop-new-line.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce proper position of the first property in JSX (react/jsx-first-prop-new-line)
# Enforce proper position of the first property in JSX (`react/jsx-first-prop-new-line`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Ensure correct position of the first property.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-fragments.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce shorthand or standard form for React fragments (react/jsx-fragments)
# Enforce shorthand or standard form for React fragments (`react/jsx-fragments`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

In JSX, a React [fragment] is created either with `<React.Fragment>...</React.Fragment>`, or, using the shorthand syntax, `<>...</>`.

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/jsx-handler-names.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce event handler naming conventions in JSX (react/jsx-handler-names)
# Enforce event handler naming conventions in JSX (`react/jsx-handler-names`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

Ensures that any component or prop methods used to handle events are correctly prefixed.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-indent-props.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce props indentation in JSX (react/jsx-indent-props)
# Enforce props indentation in JSX (`react/jsx-indent-props`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

This option validates a specific indentation style for props.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-indent.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce JSX indentation (react/jsx-indent)
# Enforce JSX indentation (`react/jsx-indent`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

This option validates a specific indentation style for JSX.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/jsx-key.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow missing `key` props in iterators/collection literals (react/jsx-key)
# Disallow missing `key` props in iterators/collection literals (`react/jsx-key`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`, `recommended`.
✅ This rule is enabled in the `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#shareable-configs).

<!-- end rule header -->

Warn if an element that likely requires a `key` prop--namely, one present in an
array literal or an arrow function expression.
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/jsx-max-depth.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce JSX maximum depth (react/jsx-max-depth)
# Enforce JSX maximum depth (`react/jsx-max-depth`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
<!-- end rule header -->

This option validates a specific depth for JSX.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-max-props-per-line.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Enforce maximum of props on a single line in JSX (react/jsx-max-props-per-line)
# Enforce maximum of props on a single line in JSX (`react/jsx-max-props-per-line`)

💼 This rule is enabled in the following [configs](https://github.com/jsx-eslint/eslint-plugin-react#shareable-configurations): `all`.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
<!-- end rule header -->

Limiting the maximum of props on a single line can improve readability.

Expand Down
Loading

0 comments on commit 1a69655

Please sign in to comment.