Update linter packages
- Update ESLint
- Update typescript-eslint
- Update eslint-plugin-import
- Update Stylelint standard config
R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=ESLint fix
Bug: none
Change-Id: Ic1efac8b4f7b085b8f2b792a76b8b99b9f583da3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3158225
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
diff --git a/node_modules/eslint-import-resolver-node/index.js b/node_modules/eslint-import-resolver-node/index.js
index bf2aab3..899e552 100644
--- a/node_modules/eslint-import-resolver-node/index.js
+++ b/node_modules/eslint-import-resolver-node/index.js
@@ -1,47 +1,68 @@
-var resolve = require('resolve')
- , path = require('path')
+'use strict';
-var log = require('debug')('eslint-plugin-import:resolver:node')
+const resolve = require('resolve');
+const path = require('path');
-exports.interfaceVersion = 2
+const log = require('debug')('eslint-plugin-import:resolver:node');
+
+exports.interfaceVersion = 2;
exports.resolve = function (source, file, config) {
- log('Resolving:', source, 'from:', file)
- var resolvedPath
+ log('Resolving:', source, 'from:', file);
+ let resolvedPath;
if (resolve.isCore(source)) {
- log('resolved to core')
- return { found: true, path: null }
+ log('resolved to core');
+ return { found: true, path: null };
}
try {
- resolvedPath = resolve.sync(source, opts(file, config))
- log('Resolved to:', resolvedPath)
- return { found: true, path: resolvedPath }
+ const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
+ resolvedPath = resolve.sync(source, opts(file, config, cachedFilter));
+ log('Resolved to:', resolvedPath);
+ return { found: true, path: resolvedPath };
} catch (err) {
- log('resolve threw error:', err)
- return { found: false }
+ log('resolve threw error:', err);
+ return { found: false };
}
-}
+};
-function opts(file, config) {
+function opts(file, config, packageFilter) {
return Object.assign({
- // more closely matches Node (#333)
- // plus 'mjs' for native modules! (#939)
- extensions: ['.mjs', '.js', '.json', '.node'],
- },
- config,
- {
- // path.resolve will handle paths relative to CWD
- basedir: path.dirname(path.resolve(file)),
- packageFilter: packageFilter,
-
- })
+ // more closely matches Node (#333)
+ // plus 'mjs' for native modules! (#939)
+ extensions: ['.mjs', '.js', '.json', '.node'],
+ },
+ config,
+ {
+ // path.resolve will handle paths relative to CWD
+ basedir: path.dirname(path.resolve(file)),
+ packageFilter,
+ });
}
-function packageFilter(pkg) {
- if (pkg['jsnext:main']) {
- pkg['main'] = pkg['jsnext:main']
+function identity(x) { return x; }
+
+function packageFilter(pkg, dir, config) {
+ let found = false;
+ const file = path.join(dir, 'dummy.js');
+ if (pkg.module) {
+ try {
+ resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
+ pkg.main = pkg.module;
+ found = true;
+ } catch (err) {
+ log('resolve threw error trying to find pkg.module:', err);
+ }
}
- return pkg
+ if (!found && pkg['jsnext:main']) {
+ try {
+ resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
+ pkg.main = pkg['jsnext:main'];
+ found = true;
+ } catch (err) {
+ log('resolve threw error trying to find pkg[\'jsnext:main\']:', err);
+ }
+ }
+ return pkg;
}