Add eslint-import-plugin to node_modules
Will be used to make sure no default exports are in DevTools.
The PRESUBMIT.py has been updated to skip running the formatting check
if node_modules files are affected, to workaround crbug.com/1068198.
DISABLE_THIRD_PARTY_CHECK=Add plugin to node_modules
Bug: 1068198
Change-Id: I04d4dc813daa01099f21d40edf47aaefcc0b045f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2135610
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
diff --git a/node_modules/eslint-module-utils/ModuleCache.js b/node_modules/eslint-module-utils/ModuleCache.js
new file mode 100644
index 0000000..b910a58
--- /dev/null
+++ b/node_modules/eslint-module-utils/ModuleCache.js
@@ -0,0 +1,47 @@
+'use strict'
+exports.__esModule = true
+
+const log = require('debug')('eslint-module-utils:ModuleCache')
+
+class ModuleCache {
+ constructor(map) {
+ this.map = map || new Map()
+ }
+
+ /**
+ * returns value for returning inline
+ * @param {[type]} cacheKey [description]
+ * @param {[type]} result [description]
+ */
+ set(cacheKey, result) {
+ this.map.set(cacheKey, { result, lastSeen: process.hrtime() })
+ log('setting entry for', cacheKey)
+ return result
+ }
+
+ get(cacheKey, settings) {
+ if (this.map.has(cacheKey)) {
+ const f = this.map.get(cacheKey)
+ // check freshness
+ if (process.hrtime(f.lastSeen)[0] < settings.lifetime) return f.result
+ } else log('cache miss for', cacheKey)
+ // cache miss
+ return undefined
+ }
+
+}
+
+ModuleCache.getSettings = function (settings) {
+ const cacheSettings = Object.assign({
+ lifetime: 30, // seconds
+ }, settings['import/cache'])
+
+ // parse infinity
+ if (cacheSettings.lifetime === '∞' || cacheSettings.lifetime === 'Infinity') {
+ cacheSettings.lifetime = Infinity
+ }
+
+ return cacheSettings
+}
+
+exports.default = ModuleCache