X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Feslint%2Flib%2Fshared%2Fdeprecation-warnings.js;h=1a0501ab057a1123c3ae956b7372bf2771bd7679;hp=1438eaa69bff86c383d9f4f413050132fcbc7cac;hb=3be0a9efc698a9570a44456009afc6014812625a;hpb=d2f432cc757f42f0318fdddcab8c00b240d47088 diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/shared/deprecation-warnings.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/shared/deprecation-warnings.js index 1438eaa6..1a0501ab 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/shared/deprecation-warnings.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/shared/deprecation-warnings.js @@ -9,7 +9,6 @@ //------------------------------------------------------------------------------ const path = require("path"); -const lodash = require("lodash"); //------------------------------------------------------------------------------ // Private @@ -28,6 +27,8 @@ const deprecationWarningMessages = { "projects in order to avoid loading '~/.eslintrc.*' accidentally." }; +const sourceFileErrorCache = new Set(); + /** * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted * for each unique file path, but repeated invocations with the same file path have no effect. @@ -36,7 +37,15 @@ const deprecationWarningMessages = { * @param {string} errorCode The warning message to show. * @returns {void} */ -const emitDeprecationWarning = lodash.memoize((source, errorCode) => { +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + + sourceFileErrorCache.add(cacheKey); + const rel = path.relative(process.cwd(), source); const message = deprecationWarningMessages[errorCode]; @@ -45,7 +54,7 @@ const emitDeprecationWarning = lodash.memoize((source, errorCode) => { "DeprecationWarning", errorCode ); -}, (...args) => JSON.stringify(args)); +} //------------------------------------------------------------------------------ // Public Interface