X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Feslint%2Flib%2Flinter%2Fapply-disable-directives.js;h=0ba69ca9cc44c73bfd8556e3298a93092404fbd9;hb=3be0a9efc698a9570a44456009afc6014812625a;hp=41d6934abba46d41466e6fc81f41d72b8510ef66;hpb=3aba54c891969552833dbc350b3139e944e17a97;p=dotfiles%2F.git diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/linter/apply-disable-directives.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/linter/apply-disable-directives.js index 41d6934a..0ba69ca9 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/linter/apply-disable-directives.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/linter/apply-disable-directives.js @@ -5,8 +5,6 @@ "use strict"; -const lodash = require("lodash"); - /** * Compares the locations of two objects in a source file * @param {{line: number, column: number}} itemA The first object @@ -124,7 +122,21 @@ module.exports = ({ directives, problems, reportUnusedDisableDirectives = "off" .map(directive => Object.assign({}, directive, { unprocessedDirective: directive })) .sort(compareLocations); - const lineDirectives = lodash.flatMap(directives, directive => { + /** + * Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. + * TODO(stephenwade): Replace this with array.flatMap when we drop support for Node v10 + * @param {any[]} array The array to process + * @param {Function} fn The function to use + * @returns {any[]} The result array + */ + function flatMap(array, fn) { + const mapped = array.map(fn); + const flattened = [].concat(...mapped); + + return flattened; + } + + const lineDirectives = flatMap(directives, directive => { switch (directive.type) { case "disable": case "enable":