From eea8e06d898622fa7676c8b738339e6187b130ac Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 15 Sep 2021 21:43:54 +0300 Subject: [PATCH] htmllint.js: use flatMap instead of concat & map --- lib/htmllint.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/htmllint.js b/lib/htmllint.js index c085d9e..bbdcd9c 100644 --- a/lib/htmllint.js +++ b/lib/htmllint.js @@ -42,14 +42,13 @@ function parseErrorMessages(errors, config) { if (config.server) { // Extract "messages" property from each object and set the url of each message. // This results in an array of arrays instead of array of objects, which is then - // flattened by concatenation - // eslint-disable-next-line unicorn/prefer-spread - messages = [].concat(...messages, parsed.map(file => { + // flattened + messages = parsed.flatMap(file => { return file.messages.map(message => { message.url = file.url; return message; }); - })); + }); } return messages;