summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/lib/rules/no-self-assign.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-08-30 16:56:49 -0400
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-09-03 06:51:40 +0200
commitd62d2b456031539617a9e615c3e62c199a7e7dfe (patch)
tree4e1a3a6a3fb02bab7824772d51ea6ac7d023b929 /tools/node_modules/eslint/lib/rules/no-self-assign.js
parentd18b6a7e40460efe652ffd1bd072947d635ae890 (diff)
downloadandroid-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.tar.gz
android-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.tar.bz2
android-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.zip
tools: update ESLint to 6.3.0
Update ESLint to 6.3.0 PR-URL: https://github.com/nodejs/node/pull/29382 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/no-self-assign.js')
-rw-r--r--tools/node_modules/eslint/lib/rules/no-self-assign.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/node_modules/eslint/lib/rules/no-self-assign.js b/tools/node_modules/eslint/lib/rules/no-self-assign.js
index 79fb50770e..dc8bf90147 100644
--- a/tools/node_modules/eslint/lib/rules/no-self-assign.js
+++ b/tools/node_modules/eslint/lib/rules/no-self-assign.js
@@ -94,9 +94,19 @@ function eachSelfAssignment(left, right, props, report) {
const end = Math.min(left.elements.length, right.elements.length);
for (let i = 0; i < end; ++i) {
+ const leftElement = left.elements[i];
const rightElement = right.elements[i];
- eachSelfAssignment(left.elements[i], rightElement, props, report);
+ // Avoid cases such as [...a] = [...a, 1]
+ if (
+ leftElement &&
+ leftElement.type === "RestElement" &&
+ i < right.elements.length - 1
+ ) {
+ break;
+ }
+
+ eachSelfAssignment(leftElement, rightElement, props, report);
// After a spread element, those indices are unknown.
if (rightElement && rightElement.type === "SpreadElement") {