Skip to content

Commit

Permalink
htmllint.js: use flatMap instead of concat & map
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Sep 15, 2021
1 parent 0e760c5 commit eea8e06
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/htmllint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eea8e06

Please sign in to comment.