diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0bedbc3a..3b2b5bcf38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + # Change Log All notable changes to this project will be documented in this file. @@ -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 diff --git a/docs/rules/default-props-match-prop-types.md b/docs/rules/default-props-match-prop-types.md index f5641c44aa..d8773046f2 100644 --- a/docs/rules/default-props-match-prop-types.md +++ b/docs/rules/default-props-match-prop-types.md @@ -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/ diff --git a/docs/rules/jsx-boolean-value.md b/docs/rules/jsx-boolean-value.md index 1a0c2bde17..6bebe31137 100644 --- a/docs/rules/jsx-boolean-value.md +++ b/docs/rules/jsx-boolean-value.md @@ -4,7 +4,7 @@ -[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 diff --git a/docs/rules/jsx-curly-brace-presence.md b/docs/rules/jsx-curly-brace-presence.md index ddd296926a..30a00364db 100644 --- a/docs/rules/jsx-curly-brace-presence.md +++ b/docs/rules/jsx-curly-brace-presence.md @@ -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 diff --git a/docs/rules/jsx-no-bind.md b/docs/rules/jsx-no-bind.md index 10141656a6..2becfef8a0 100644 --- a/docs/rules/jsx-no-bind.md +++ b/docs/rules/jsx-no-bind.md @@ -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 { @@ -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 @@ -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 = () => { diff --git a/docs/rules/no-array-index-key.md b/docs/rules/no-array-index-key.md index 37f2652d93..4fc4f928ad 100644 --- a/docs/rules/no-array-index-key.md +++ b/docs/rules/no-array-index-key.md @@ -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. diff --git a/docs/rules/no-is-mounted.md b/docs/rules/no-is-mounted.md index e38be740bc..ce06311545 100644 --- a/docs/rules/no-is-mounted.md +++ b/docs/rules/no-is-mounted.md @@ -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 diff --git a/docs/rules/no-render-return-value.md b/docs/rules/no-render-return-value.md index 2042ba9f57..1859f75231 100644 --- a/docs/rules/no-render-return-value.md +++ b/docs/rules/no-render-return-value.md @@ -4,9 +4,9 @@ -> `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 diff --git a/docs/rules/require-default-props.md b/docs/rules/require-default-props.md index f083aaf7ff..ea4e69e086 100644 --- a/docs/rules/require-default-props.md +++ b/docs/rules/require-default-props.md @@ -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/