Skip to content

Commit

Permalink
[Docs] fix broken links:
Browse files Browse the repository at this point in the history
 - `default-props-match-prop-types`
 - `jsx-boolean-value`
 - `jsx-curly-brace-presence`
 - `jsx-no-bind`
 - `no-array-index-key`
 - `no-is-mounted`
 - `no-render-return-value`
 - `require-default-props`
  • Loading branch information
bastiendmt authored and ljharb committed Oct 16, 2024
1 parent 2c0b10c commit 958954d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Change Log

All notable changes to this project will be documented in this file.
Expand All @@ -12,8 +13,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

### Changed
* [Tests] [`jsx-no-script-url`]: Improve tests ([#3849][] @radu2147)
* [Docs] fix broken links: [`default-props-match-prop-types`], [`jsx-boolean-value`], [`jsx-curly-brace-presence`], [`jsx-no-bind`], [`no-array-index-key`], [`no-is-mounted`], [`no-render-return-value`], [`require-default-props`] ([#3841][] @bastiendmt)

[#3849]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3849
[#3841]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3841
[#3840]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3840
[#3833]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3833

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/default-props-match-prop-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ If you don't care about stray `defaultsProps` in your components, you can disabl

## Resources

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

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: https://www.typescriptlang.org/
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/jsx-boolean-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!-- end auto-generated 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.
When using a [boolean attribute in JSX](https://web.archive.org/web/20160607204033/http://facebook.github.io/react/docs/jsx-in-depth.html#boolean-attributes), you can set the attribute value to `true` or omit the value.

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/jsx-curly-brace-presence.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

For situations where JSX expressions are unnecessary, please refer to [the React doc](https://facebook.github.io/react/docs/jsx-in-depth.html) and [this page about JSX gotchas](https://github.com/facebook/react/blob/v15.4.0-rc.3/docs/docs/02.3-jsx-gotchas.md#html-entities).
For situations where JSX expressions are unnecessary, please refer to [the React doc](https://legacy.reactjs.org/docs/jsx-in-depth.html) and [this page about JSX gotchas](https://github.com/facebook/react/blob/v15.4.0-rc.3/docs/docs/02.3-jsx-gotchas.md#html-entities).

## Rule Details

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/jsx-no-bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ This will speed up rendering, as it avoids the need to create new functions (thr
### ES6 Classes
Unfortunately [React ES6 classes](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#es6-classes) do not autobind their methods like components created with the older `createReactClass` syntax. There are several approaches to binding methods for ES6 classes. A basic approach is to just manually bind the methods in the constructor:
Unfortunately [React ES6 classes](https://legacy.reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html#es6-classes) do not autobind their methods like components created with the older `createReactClass` syntax. There are several approaches to binding methods for ES6 classes. A basic approach is to just manually bind the methods in the constructor:
```jsx
class Foo extends React.Component {
Expand All @@ -174,7 +174,7 @@ class Foo extends React.Component {
}
```
A more sophisticated approach would be to use something like an [autobind ES7 decorator](https://www.npmjs.com/package/core-decorators#autobind) or [property initializers](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding).
A more sophisticated approach would be to use something like an [autobind ES7 decorator](https://www.npmjs.com/package/core-decorators#autobind) or [property initializers](https://legacy.reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding).
### React Hooks
Expand All @@ -191,7 +191,7 @@ const Button = () => {
};
```
Otherwise, the idiomatic way to avoid redefining callbacks on every render would be to memoize them using the [`useCallback`](https://reactjs.org/docs/hooks-reference.html#usecallback) hook:
Otherwise, the idiomatic way to avoid redefining callbacks on every render would be to memoize them using the [`useCallback`](https://legacy.reactjs.org/docs/hooks-reference.html#usecallback) hook:
```jsx
const Button = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-array-index-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Warn if an element uses an Array index in its `key`.

The `key` is used by React to [identify which items have changed, are added, or are removed and should be stable](https://facebook.github.io/react/docs/lists-and-keys.html#keys).
The `key` is used by React to [identify which items have changed, are added, or are removed and should be stable](https://react.dev/learn/rendering-lists#why-does-react-need-keys).

It's a bad idea to use the array index since it doesn't uniquely identify your elements. In cases where the array is sorted or an element is added to the beginning of the array, the index will be changed even though the element representing that index may be the same. This results in unnecessary renders.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-is-mounted.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[`isMounted` is an anti-pattern][anti-pattern], is not available when using ES6 classes, and it is on its way to being officially deprecated.

[anti-pattern]: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html
[anti-pattern]: https://legacy.reactjs.org/blog/2015/12/16/ismounted-antipattern.html

## Rule Details

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-render-return-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<!-- end auto-generated rule header -->

> `ReactDOM.render()` currently returns a reference to the root `ReactComponent` instance. However, using this return value is legacy and should be avoided because future versions of React may render components asynchronously in some cases. If you need a reference to the root `ReactComponent` instance, the preferred solution is to attach a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) to the root element.
> `ReactDOM.render()` currently returns a reference to the root `ReactComponent` instance. However, using this return value is legacy and should be avoided because future versions of React may render components asynchronously in some cases. If you need a reference to the root `ReactComponent` instance, the preferred solution is to attach a [callback ref](https://legacy.reactjs.org/docs/refs-and-the-dom.html#callback-refs) to the root element.
Source: [ReactDOM documentation](https://facebook.github.io/react/docs/react-dom.html#render)
Source: [ReactDOM documentation](https://legacy.reactjs.org/docs/react-dom.html#render)

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-default-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ If you don't care about using `defaultProps` for your component's props that are

## Resources

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

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: https://www.typescriptlang.org/
Expand Down

0 comments on commit 958954d

Please sign in to comment.