From 03fc727389da09678c9e7106456481061772ea97 Mon Sep 17 00:00:00 2001
From: Pascal Birchler <pascal.birchler@gmail.com>
Date: Fri, 8 Mar 2019 12:47:40 +0200
Subject: [PATCH] Update packages used by eslint plugin to remove warnings
 (#14077)

* Update packages used by eslint plugin to remove warnings

* Manually modify package-lock.json

Props @gziolo.

* Specify React version in eslint-plugin-react settings

* Fix react/jsx-no-target lint errors
---
 package-lock.json                             | 122 ++++++++++--------
 packages/block-library/src/categories/edit.js |   2 +-
 .../block-library/src/latest-posts/edit.js    |   2 +-
 .../components/src/external-link/index.js     |   2 +-
 packages/eslint-plugin/configs/custom.js      |   5 +
 packages/eslint-plugin/package.json           |   4 +-
 6 files changed, 80 insertions(+), 57 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 9d1ac8494ae024..93f1ca6a19331e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2856,8 +2856,8 @@
 			"dev": true,
 			"requires": {
 				"babel-eslint": "^8.0.3",
-				"eslint-plugin-jsx-a11y": "6.0.2",
-				"eslint-plugin-react": "7.7.0",
+				"eslint-plugin-jsx-a11y": "^6.2.1",
+				"eslint-plugin-react": "^7.12.4",
 				"requireindex": "^1.2.0"
 			}
 		},
@@ -3323,6 +3323,16 @@
 				}
 			}
 		},
+		"aria-query": {
+			"version": "3.0.0",
+			"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz",
+			"integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=",
+			"dev": true,
+			"requires": {
+				"ast-types-flow": "0.0.7",
+				"commander": "^2.11.0"
+			}
+		},
 		"arr-diff": {
 			"version": "4.0.0",
 			"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
@@ -3610,6 +3620,15 @@
 				"axe-core": "^3.1.2"
 			}
 		},
+		"axobject-query": {
+			"version": "2.0.2",
+			"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz",
+			"integrity": "sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==",
+			"dev": true,
+			"requires": {
+				"ast-types-flow": "0.0.7"
+			}
+		},
 		"babel-eslint": {
 			"version": "8.0.3",
 			"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.0.3.tgz",
@@ -7280,9 +7299,9 @@
 			}
 		},
 		"emoji-regex": {
-			"version": "6.5.1",
-			"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz",
-			"integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==",
+			"version": "7.0.3",
+			"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+			"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
 			"dev": true
 		},
 		"emojis-list": {
@@ -7722,67 +7741,66 @@
 			"dev": true
 		},
 		"eslint-plugin-jsx-a11y": {
-			"version": "6.0.2",
-			"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.2.tgz",
-			"integrity": "sha1-ZZJ3p1iwNsMFp+ShMFfDAc075z8=",
+			"version": "6.2.1",
+			"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.1.tgz",
+			"integrity": "sha512-cjN2ObWrRz0TTw7vEcGQrx+YltMvZoOEx4hWU8eEERDnBIU00OTq7Vr+jA7DFKxiwLNv4tTh5Pq2GUNEa8b6+w==",
 			"dev": true,
 			"requires": {
-				"aria-query": "^0.7.0",
+				"aria-query": "^3.0.0",
 				"array-includes": "^3.0.3",
-				"ast-types-flow": "0.0.7",
-				"axobject-query": "^0.1.0",
-				"damerau-levenshtein": "^1.0.0",
-				"emoji-regex": "^6.1.0",
-				"jsx-ast-utils": "^1.4.0"
-			},
-			"dependencies": {
-				"aria-query": {
-					"version": "0.7.1",
-					"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-0.7.1.tgz",
-					"integrity": "sha1-Jsu1r/ZBRLCoJb4YRuCxbPoAsR4=",
-					"dev": true,
-					"requires": {
-						"ast-types-flow": "0.0.7",
-						"commander": "^2.11.0"
-					}
-				},
-				"axobject-query": {
-					"version": "0.1.0",
-					"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-0.1.0.tgz",
-					"integrity": "sha1-YvWdvFnJ+SQnWco0mWDnov48NsA=",
-					"dev": true,
-					"requires": {
-						"ast-types-flow": "0.0.7"
-					}
-				},
-				"jsx-ast-utils": {
-					"version": "1.4.1",
-					"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
-					"integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=",
-					"dev": true
-				}
+				"ast-types-flow": "^0.0.7",
+				"axobject-query": "^2.0.2",
+				"damerau-levenshtein": "^1.0.4",
+				"emoji-regex": "^7.0.2",
+				"has": "^1.0.3",
+				"jsx-ast-utils": "^2.0.1"
 			}
 		},
 		"eslint-plugin-react": {
-			"version": "7.7.0",
-			"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.7.0.tgz",
-			"integrity": "sha512-KC7Snr4YsWZD5flu6A5c0AcIZidzW3Exbqp7OT67OaD2AppJtlBr/GuPrW/vaQM/yfZotEvKAdrxrO+v8vwYJA==",
+			"version": "7.12.4",
+			"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz",
+			"integrity": "sha512-1puHJkXJY+oS1t467MjbqjvX53uQ05HXwjqDgdbGBqf5j9eeydI54G3KwiJmWciQ0HTBacIKw2jgwSBSH3yfgQ==",
 			"dev": true,
 			"requires": {
-				"doctrine": "^2.0.2",
-				"has": "^1.0.1",
+				"array-includes": "^3.0.3",
+				"doctrine": "^2.1.0",
+				"has": "^1.0.3",
 				"jsx-ast-utils": "^2.0.1",
-				"prop-types": "^15.6.0"
+				"object.fromentries": "^2.0.0",
+				"prop-types": "^15.6.2",
+				"resolve": "^1.9.0"
 			},
 			"dependencies": {
+				"path-parse": {
+					"version": "1.0.6",
+					"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
+					"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+					"dev": true
+				},
 				"prop-types": {
-					"version": "15.6.2",
-					"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz",
-					"integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==",
+					"version": "15.7.2",
+					"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
+					"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
 					"dev": true,
 					"requires": {
-						"loose-envify": "^1.3.1",
-						"object-assign": "^4.1.1"
+						"loose-envify": "^1.4.0",
+						"object-assign": "^4.1.1",
+						"react-is": "^16.8.1"
+					}
+				},
+				"react-is": {
+					"version": "16.8.3",
+					"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.3.tgz",
+					"integrity": "sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA==",
+					"dev": true
+				},
+				"resolve": {
+					"version": "1.10.0",
+					"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
+					"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
+					"dev": true,
+					"requires": {
+						"path-parse": "^1.0.6"
 					}
 				}
 			}
diff --git a/packages/block-library/src/categories/edit.js b/packages/block-library/src/categories/edit.js
index 69e70a2596f254..faee47015394ae 100644
--- a/packages/block-library/src/categories/edit.js
+++ b/packages/block-library/src/categories/edit.js
@@ -86,7 +86,7 @@ class CategoriesEdit extends Component {
 
 		return (
 			<li key={ category.id }>
-				<a href={ category.link } target="_blank">{ this.renderCategoryName( category ) }</a>
+				<a href={ category.link } target="_blank" rel="noreferrer noopener">{ this.renderCategoryName( category ) }</a>
 				{ showPostCounts &&
 					<span className="wp-block-categories__post-count">
 						{ ' ' }({ category.count })
diff --git a/packages/block-library/src/latest-posts/edit.js b/packages/block-library/src/latest-posts/edit.js
index f5f8bc5d121d06..2e0f00e32eea30 100644
--- a/packages/block-library/src/latest-posts/edit.js
+++ b/packages/block-library/src/latest-posts/edit.js
@@ -178,7 +178,7 @@ class LatestPostsEdit extends Component {
 						const titleTrimmed = post.title.rendered.trim();
 						return (
 							<li key={ i }>
-								<a href={ post.link } target="_blank">
+								<a href={ post.link } target="_blank" rel="noreferrer noopener">
 									{ titleTrimmed ? (
 										<RawHTML>
 											{ titleTrimmed }
diff --git a/packages/components/src/external-link/index.js b/packages/components/src/external-link/index.js
index 89ad1d80160a18..6b57f3978fd5f6 100644
--- a/packages/components/src/external-link/index.js
+++ b/packages/components/src/external-link/index.js
@@ -24,7 +24,7 @@ export function ExternalLink( { href, children, className, rel = '', ...addition
 	] ) ).join( ' ' );
 	const classes = classnames( 'components-external-link', className );
 	return (
-		<a { ...additionalProps } className={ classes } href={ href } target="_blank" rel={ rel } ref={ ref }>
+		<a { ...additionalProps } className={ classes } href={ href } target="_blank" rel={ rel } ref={ ref }> { /* eslint-disable-line react/jsx-no-target-blank */ }
 			{ children }
 			<span className="screen-reader-text">
 				{
diff --git a/packages/eslint-plugin/configs/custom.js b/packages/eslint-plugin/configs/custom.js
index 82ba39265eb43b..d11c4ef232190d 100644
--- a/packages/eslint-plugin/configs/custom.js
+++ b/packages/eslint-plugin/configs/custom.js
@@ -23,4 +23,9 @@ module.exports = {
 			},
 		],
 	},
+	settings: {
+		react: {
+			version: '16.6',
+		},
+	},
 };
diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json
index 3d79f48f78fb73..a9892892b634ac 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -19,8 +19,8 @@
 	},
 	"dependencies": {
 		"babel-eslint": "^8.0.3",
-		"eslint-plugin-jsx-a11y": "6.0.2",
-		"eslint-plugin-react": "7.7.0",
+		"eslint-plugin-jsx-a11y": "^6.2.1",
+		"eslint-plugin-react": "^7.12.4",
 		"requireindex": "^1.2.0"
 	},
 	"publishConfig": {