Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] HTTP => HTTPS #3133

Merged
merged 1 commit into from Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions CHANGELOG.md
@@ -1,7 +1,7 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
This project adheres to [Semantic Versioning](https://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](https://keepachangelog.com).

## Unreleased

Expand All @@ -13,9 +13,11 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

### Changed
* [readme] change [`jsx-runtime`] link from branch to sha ([#3160][] @tatsushitoji)
* [Docs] HTTP => HTTPS ([#3133][] @Schweinepriester)

[#3163]: https://github.com/yannickcr/eslint-plugin-react/pull/3163
[#3160]: https://github.com/yannickcr/eslint-plugin-react/pull/3160
[#3133]: https://github.com/yannickcr/eslint-plugin-react/pull/3133
[#2921]: https://github.com/yannickcr/eslint-plugin-react/pull/2921

## [7.28.0] - 2021.12.22
Expand Down Expand Up @@ -2189,7 +2191,7 @@ React ([#1073][] @jomasti)
* Add support for `PureComponent` in [`prefer-stateless-function`][] ([#781][] @tiemevanveen)

### Fixed
* Fix [`jsx-uses-vars`][] to work better with [`prefer-const`](http://eslint.org/docs/rules/prefer-const). You'll need to upgrade to ESLint 3.4.0 to completely fix the compatibility issue ([#716][])
* Fix [`jsx-uses-vars`][] to work better with [`prefer-const`](https://eslint.org/docs/rules/prefer-const). You'll need to upgrade to ESLint 3.4.0 to completely fix the compatibility issue ([#716][])
* Fix [`require-render-return`][] crash ([#784][])
* Fix related components detection in [`prop-types`][] ([#735][])
* Fix component detection to ignore functions expression without a parent component
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -262,11 +262,11 @@ This pairs well with the `eslint:all` rule.
}
```

**Note**: These configurations will import `eslint-plugin-react` and enable JSX in [parser options](http://eslint.org/docs/user-guide/configuring#specifying-parser-options).
**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).

# License

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


[npm-url]: https://npmjs.org/package/eslint-plugin-react
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/boolean-prop-naming.md
Expand Up @@ -118,5 +118,5 @@ This value is boolean. It tells if nested props should be validated as well. By
```

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: http://www.typescriptlang.org/
[TypeScript]: https://www.typescriptlang.org/
[Flow]: https://flow.org/
2 changes: 1 addition & 1 deletion docs/rules/default-props-match-prop-types.md
Expand Up @@ -196,5 +196,5 @@ If you don't care about stray `defaultsProps` in your components, you can disabl
- [Official React documentation on defaultProps](https://facebook.github.io/react/docs/typechecking-with-proptypes.html#default-prop-values)

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: http://www.typescriptlang.org/
[TypeScript]: https://www.typescriptlang.org/
[Flow]: https://flow.org/
2 changes: 1 addition & 1 deletion docs/rules/jsx-curly-spacing.md
Expand Up @@ -219,7 +219,7 @@ Examples of **correct** code for this rule, when configured with `"never"` and `
<App blah={3} foo={ {bar: true, baz: true} } />;
```

Please note that spacing of the object literal curly braces themselves is controlled by the built-in [`object-curly-spacing`](http://eslint.org/docs/rules/object-curly-spacing) rule.
Please note that spacing of the object literal curly braces themselves is controlled by the built-in [`object-curly-spacing`](https://eslint.org/docs/rules/object-curly-spacing) rule.

### Shorthand options

Expand Down
16 changes: 8 additions & 8 deletions docs/rules/jsx-no-target-blank.md
Expand Up @@ -37,16 +37,16 @@ This rule aims to prevent user generated link hrefs and form actions from creati
Examples of **incorrect** code for this rule, when configured with `{ "enforceDynamicLinks": "always" }`:

```jsx
var Hello = <a target='_blank' href="http://example.com/"></a>
var Hello = <a target='_blank' href="https://example.com/"></a>
var Hello = <a target='_blank' href={dynamicLink}></a>
```

Examples of **correct** code for this rule:

```jsx
var Hello = <p target="_blank"></p>
var Hello = <a target="_blank" rel="noreferrer" href="http://example.com"></a>
var Hello = <a target="_blank" rel="noopener noreferrer" href="http://example.com"></a>
var Hello = <a target="_blank" rel="noreferrer" href="https://example.com"></a>
var Hello = <a target="_blank" rel="noopener noreferrer" href="https://example.com"></a>
var Hello = <a target="_blank" href="relative/path/in/the/host"></a>
var Hello = <a target="_blank" href="/absolute/path/in/the/host"></a>
var Hello = <a></a>
Expand All @@ -68,7 +68,7 @@ Spread attributes are a handy way of passing programmatically-generated props to

```jsx
const unsafeProps = {
href: "http://example.com",
href: "https://example.com",
target: "_blank",
};

Expand All @@ -88,13 +88,13 @@ Defaults to false. If false, this rule will ignore all spread attributes. If tru
When option `forms` is set to `true`, the following is considered an error:

```jsx
var Hello = <form target="_blank" action="http://example.com/"></form>;
var Hello = <form target="_blank" action="https://example.com/"></form>;
```

When option `links` is set to `true`, the following is considered an error:

```jsx
var Hello = <a target='_blank' href="http://example.com/"></form>
var Hello = <a target='_blank' href="https://example.com/"></form>
```

### Custom link components
Expand All @@ -104,14 +104,14 @@ This rule supports the ability to use custom components for links, such as `<Lin
Examples of **incorrect** code for this rule:

```jsx
var Hello = <Link target="_blank" to="http://example.com/"></Link>
var Hello = <Link target="_blank" to="https://example.com/"></Link>
var Hello = <Link target="_blank" to={dynamicLink}></Link>
```

Examples of **correct** code for this rule:

```jsx
var Hello = <Link target="_blank" rel="noopener noreferrer" to="http://example.com"></Link>
var Hello = <Link target="_blank" rel="noopener noreferrer" to="https://example.com"></Link>
var Hello = <Link target="_blank" to="relative/path/in/the/host"></Link>
var Hello = <Link target="_blank" to="/absolute/path/in/the/host"></Link>
var Hello = <Link />
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/jsx-uses-vars.md
@@ -1,6 +1,6 @@
# Prevent variables used in JSX to be incorrectly marked as unused (react/jsx-uses-vars)

Since 0.17.0 the `eslint` `no-unused-vars` rule does not detect variables used in JSX ([see details](http://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling)). This rule will find variables used in JSX and mark them as used.
Since 0.17.0 the `eslint` `no-unused-vars` rule does not detect variables used in JSX ([see details](https://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling)). This rule will find variables used in JSX and mark them as used.

This rule only has an effect when the `no-unused-vars` rule is enabled.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-render-return-value.md
@@ -1,6 +1,6 @@
# Prevent usage of the return value of ReactDOM.render (react/no-render-return-value)

> `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](http://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute) 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://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)

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unused-prop-types.md
Expand Up @@ -140,5 +140,5 @@ AComponent.propTypes = {
```

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: http://www.typescriptlang.org/
[TypeScript]: https://www.typescriptlang.org/
[Flow]: https://flow.org/
2 changes: 1 addition & 1 deletion docs/rules/prefer-stateless-function.md
Expand Up @@ -6,7 +6,7 @@ Stateless functional components are simpler than class based components and will

This rule will check your class based React components for

* methods/properties other than `displayName`, `propTypes`, `contextTypes`, `defaultProps`, `render` and useless constructor (same detection as `eslint` [no-useless-constructor rule](http://eslint.org/docs/rules/no-useless-constructor))
* methods/properties other than `displayName`, `propTypes`, `contextTypes`, `defaultProps`, `render` and useless constructor (same detection as `eslint` [no-useless-constructor rule](https://eslint.org/docs/rules/no-useless-constructor))
* instance property other than `this.props` and `this.context`
* extension of `React.PureComponent` (if the `ignorePureComponents` flag is true)
* presence of `ref` attribute in JSX
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prop-types.md
Expand Up @@ -176,5 +176,5 @@ For now we should detect components created with:
* an ES6 class that inherit from `React.Component` or `Component`

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: http://www.typescriptlang.org/
[TypeScript]: https://www.typescriptlang.org/
[Flow]: https://flow.org/
2 changes: 1 addition & 1 deletion docs/rules/require-default-props.md
Expand Up @@ -348,5 +348,5 @@ If you don't care about using `defaultProps` for your component's props that are
- [Official React documentation on defaultProps](https://facebook.github.io/react/docs/typechecking-with-proptypes.html#default-prop-values)

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
[TypeScript]: http://www.typescriptlang.org/
[TypeScript]: https://www.typescriptlang.org/
[Flow]: https://flow.org/
2 changes: 1 addition & 1 deletion lib/rules/no-unknown-property.js
Expand Up @@ -154,7 +154,7 @@ function getDOMPropertyNames(context) {
const tagConvention = /^[a-z][^-]*$/;
function isTagName(node) {
if (tagConvention.test(node.parent.name.name)) {
// http://www.w3.org/TR/custom-elements/#type-extension-semantics
// https://www.w3.org/TR/custom-elements/#type-extension-semantics
return !node.parent.attributes.some((attrNode) => (
attrNode.type === 'JSXAttribute'
&& attrNode.name.type === 'JSXIdentifier'
Expand Down
6 changes: 3 additions & 3 deletions lib/util/pragma.js
Expand Up @@ -11,7 +11,7 @@ const JS_IDENTIFIER_REGEX = /^[_$a-zA-Z][_$a-zA-Z0-9]*$/;

function getCreateClassFromContext(context) {
let pragma = 'createReactClass';
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
// .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
if (context.settings.react && context.settings.react.createClass) {
pragma = context.settings.react.createClass;
}
Expand All @@ -23,7 +23,7 @@ function getCreateClassFromContext(context) {

function getFragmentFromContext(context) {
let pragma = 'Fragment';
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
// .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
if (context.settings.react && context.settings.react.fragment) {
pragma = context.settings.react.fragment;
}
Expand All @@ -42,7 +42,7 @@ function getFromContext(context) {
if (pragmaNode) {
const matches = JSX_ANNOTATION_REGEX.exec(pragmaNode.value);
pragma = matches[1].split('.')[0];
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
// .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
} else if (context.settings.react && context.settings.react.pragma) {
pragma = context.settings.react.pragma;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/util/version.js
Expand Up @@ -71,7 +71,7 @@ function detectReactVersion(context) {

function getReactVersionFromContext(context) {
let confVer = '999.999.999';
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
// .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
if (context.settings && context.settings.react && context.settings.react.version) {
let settingsVersion = context.settings.react.version;
if (settingsVersion === 'detect') {
Expand Down Expand Up @@ -111,7 +111,7 @@ function detectFlowVersion(context) {

function getFlowVersionFromContext(context) {
let confVer = '999.999.999';
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
// .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
if (context.settings.react && context.settings.react.flowVersion) {
let flowVersion = context.settings.react.flowVersion;
if (flowVersion === 'detect') {
Expand Down
58 changes: 29 additions & 29 deletions tests/lib/rules/jsx-no-target-blank.js
Expand Up @@ -46,8 +46,8 @@ ruleTester.run('jsx-no-target-blank', rule, {
{ code: '<a href={`foobar`} target={`_blank`} rel={`noreferrer`}></a>' },
{ code: '<a target="_blank" {...spreadProps} rel="noopener noreferrer"></a>' },
{ code: '<a target="_blank" {...spreadProps} rel="noreferrer"></a>' },
{ code: '<a {...spreadProps} target="_blank" rel="noopener noreferrer" href="http://example.com">s</a>' },
{ code: '<a {...spreadProps} target="_blank" rel="noreferrer" href="http://example.com">s</a>' },
{ code: '<a {...spreadProps} target="_blank" rel="noopener noreferrer" href="https://example.com">s</a>' },
{ code: '<a {...spreadProps} target="_blank" rel="noreferrer" href="https://example.com">s</a>' },
{ code: '<a target="_blank" rel="noopener noreferrer" {...spreadProps}></a>' },
{ code: '<a target="_blank" rel="noreferrer" {...spreadProps}></a>' },
{ code: '<p target="_blank"></p>' },
Expand Down Expand Up @@ -127,15 +127,15 @@ ruleTester.run('jsx-no-target-blank', rule, {
options: [{ forms: false, links: true }],
},
{
code: '<form action="http://example.com" target="_blank"></form>',
code: '<form action="https://example.com" target="_blank"></form>',
options: [],
},
{
code: '<form action="http://example.com" target="_blank" rel="noopener noreferrer"></form>',
code: '<form action="https://example.com" target="_blank" rel="noopener noreferrer"></form>',
options: [{ forms: true }],
},
{
code: '<form action="http://example.com" target="_blank" rel="noopener noreferrer"></form>',
code: '<form action="https://example.com" target="_blank" rel="noopener noreferrer"></form>',
options: [{ forms: true, links: false }],
},
{
Expand All @@ -144,48 +144,48 @@ ruleTester.run('jsx-no-target-blank', rule, {
]),
invalid: parsers.all([
{
code: '<a target="_blank" href="http://example.com/1"></a>',
output: '<a target="_blank" href="http://example.com/1" rel="noreferrer"></a>',
code: '<a target="_blank" href="https://example.com/1"></a>',
output: '<a target="_blank" href="https://example.com/1" rel="noreferrer"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel="" href="http://example.com/2"></a>',
output: '<a target="_blank" rel="noreferrer" href="http://example.com/2"></a>',
code: '<a target="_blank" rel="" href="https://example.com/2"></a>',
output: '<a target="_blank" rel="noreferrer" href="https://example.com/2"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel={0} href="http://example.com/3"></a>',
output: '<a target="_blank" rel="noreferrer" href="http://example.com/3"></a>',
code: '<a target="_blank" rel={0} href="https://example.com/3"></a>',
output: '<a target="_blank" rel="noreferrer" href="https://example.com/3"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel={1} href="http://example.com/3"></a>',
output: '<a target="_blank" rel="noreferrer" href="http://example.com/3"></a>',
code: '<a target="_blank" rel={1} href="https://example.com/3"></a>',
output: '<a target="_blank" rel="noreferrer" href="https://example.com/3"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel={false} href="http://example.com/4"></a>',
output: '<a target="_blank" rel="noreferrer" href="http://example.com/4"></a>',
code: '<a target="_blank" rel={false} href="https://example.com/4"></a>',
output: '<a target="_blank" rel="noreferrer" href="https://example.com/4"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel={null} href="http://example.com/5"></a>',
output: '<a target="_blank" rel="noreferrer" href="http://example.com/5"></a>',
code: '<a target="_blank" rel={null} href="https://example.com/5"></a>',
output: '<a target="_blank" rel="noreferrer" href="https://example.com/5"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel="noopenernoreferrer" href="http://example.com/6"></a>',
output: '<a target="_blank" rel="noopener noreferrer" href="http://example.com/6"></a>',
code: '<a target="_blank" rel="noopenernoreferrer" href="https://example.com/6"></a>',
output: '<a target="_blank" rel="noopener noreferrer" href="https://example.com/6"></a>',
errors: defaultErrors,
},
{
code: '<a target="_blank" rel="no referrer" href="http://example.com/7"></a>',
output: '<a target="_blank" rel="no referrer noreferrer" href="http://example.com/7"></a>',
code: '<a target="_blank" rel="no referrer" href="https://example.com/7"></a>',
output: '<a target="_blank" rel="no referrer noreferrer" href="https://example.com/7"></a>',
errors: defaultErrors,
},
{
code: '<a target="_BLANK" href="http://example.com/8"></a>',
output: '<a target="_BLANK" href="http://example.com/8" rel="noreferrer"></a>',
code: '<a target="_BLANK" href="https://example.com/8"></a>',
output: '<a target="_BLANK" href="https://example.com/8" rel="noreferrer"></a>',
errors: defaultErrors,
},
{
Expand Down Expand Up @@ -248,8 +248,8 @@ ruleTester.run('jsx-no-target-blank', rule, {
errors: defaultErrors,
},
{
code: '<a href="http://example.com/20" target="_blank"></a>',
output: '<a href="http://example.com/20" target="_blank" rel="noreferrer"></a>',
code: '<a href="https://example.com/20" target="_blank"></a>',
output: '<a href="https://example.com/20" target="_blank" rel="noreferrer"></a>',
options: [{ allowReferrer: true }],
errors: [{ messageId: 'noTargetBlankWithoutNoopener' }],
},
Expand Down Expand Up @@ -327,22 +327,22 @@ ruleTester.run('jsx-no-target-blank', rule, {
errors: defaultErrors,
},
{
code: '<form method="POST" action="http://example.com" target="_blank"></form>',
code: '<form method="POST" action="https://example.com" target="_blank"></form>',
options: [{ forms: true }],
errors: defaultErrors,
},
{
code: '<form method="POST" action="http://example.com" rel="" target="_blank"></form>',
code: '<form method="POST" action="https://example.com" rel="" target="_blank"></form>',
options: [{ forms: true }],
errors: defaultErrors,
},
{
code: '<form method="POST" action="http://example.com" rel="noopenernoreferrer" target="_blank"></form>',
code: '<form method="POST" action="https://example.com" rel="noopenernoreferrer" target="_blank"></form>',
options: [{ forms: true }],
errors: defaultErrors,
},
{
code: '<form method="POST" action="http://example.com" rel="noopenernoreferrer" target="_blank"></form>',
code: '<form method="POST" action="https://example.com" rel="noopenernoreferrer" target="_blank"></form>',
options: [{ forms: true, links: false }],
errors: defaultErrors,
},
Expand Down