Update ESLint and related packages
Major update breaking changes:
- ESLint 7.0.0 (https://eslint.org/docs/user-guide/migrating-to-7.0.0) now includes
.eslint.rc.js in its list, which is fine for us. Other changes are not applicable
for us.
- eslint-plugin-mocha (https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md#700-may-13-2020)
drops support for ESLint <7, but this CL updates to 7+. Other changes are
not applicable for us.
DISABLE_THIRD_PARTY_CHECK=Updating ESLint
R=petermarshall@chromium.org
Change-Id: I7760e084ef87f73a92f9ea4e075fb4c065047f5a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2534873
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
diff --git a/node_modules/shebang-command/index.js b/node_modules/shebang-command/index.js
index 2de70b0..f35db30 100644
--- a/node_modules/shebang-command/index.js
+++ b/node_modules/shebang-command/index.js
@@ -1,19 +1,19 @@
'use strict';
-var shebangRegex = require('shebang-regex');
+const shebangRegex = require('shebang-regex');
-module.exports = function (str) {
- var match = str.match(shebangRegex);
+module.exports = (string = '') => {
+ const match = string.match(shebangRegex);
if (!match) {
return null;
}
- var arr = match[0].replace(/#! ?/, '').split(' ');
- var bin = arr[0].split('/').pop();
- var arg = arr[1];
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
+ const binary = path.split('/').pop();
- return (bin === 'env' ?
- arg :
- bin + (arg ? ' ' + arg : '')
- );
+ if (binary === 'env') {
+ return argument;
+ }
+
+ return argument ? `${binary} ${argument}` : binary;
};