Update ESLint to 6.8.0
Also update the PRESUBMIT linter configuration to make sure
it actually runs the linter when updating ESLint. Otherwise,
it would not properly do the full linter check.
R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update ESLint
Bug: 1068145
Change-Id: Ibf2de156366dc64c90ee1aced5537d2038e7a268
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137384
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
diff --git a/node_modules/eslint/lib/rules/class-methods-use-this.js b/node_modules/eslint/lib/rules/class-methods-use-this.js
index 0eb1da8..2cc5cc4 100644
--- a/node_modules/eslint/lib/rules/class-methods-use-this.js
+++ b/node_modules/eslint/lib/rules/class-methods-use-this.js
@@ -6,6 +6,12 @@
"use strict";
//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("./utils/ast-utils");
+
+//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -34,7 +40,7 @@
}],
messages: {
- missingThis: "Expected 'this' to be used by class method '{{name}}'."
+ missingThis: "Expected 'this' to be used by class {{name}}."
}
},
create(context) {
@@ -55,7 +61,7 @@
/**
* Check if the node is an instance method
- * @param {ASTNode} node - node to check
+ * @param {ASTNode} node node to check
* @returns {boolean} True if its an instance method
* @private
*/
@@ -65,19 +71,20 @@
/**
* Check if the node is an instance method not excluded by config
- * @param {ASTNode} node - node to check
+ * @param {ASTNode} node node to check
* @returns {boolean} True if it is an instance method, and not excluded by config
* @private
*/
function isIncludedInstanceMethod(node) {
- return isInstanceMethod(node) && !exceptMethods.has(node.key.name);
+ return isInstanceMethod(node) &&
+ (node.computed || !exceptMethods.has(node.key.name));
}
/**
* Checks if we are leaving a function that is a method, and reports if 'this' has not been used.
* Static methods and the constructor are exempt.
* Then pops the context off the stack.
- * @param {ASTNode} node - A function node that was entered.
+ * @param {ASTNode} node A function node that was entered.
* @returns {void}
* @private
*/
@@ -89,7 +96,7 @@
node,
messageId: "missingThis",
data: {
- name: node.parent.key.name
+ name: astUtils.getFunctionNameWithKind(node)
}
});
}