Skip to content

Commit 211085f

Browse files
committed
Clean up plugin core
No need to filter for undefined array items; join gets rid of them
1 parent f06a07f commit 211085f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

plugin/pluginCore.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const { isDirectory, isFile } = require('path-type')
44
const { results: cliReporter } = require('pa11y/lib/reporters/cli');
55
const readdirp = require('readdirp')
66

7+
const EMPTY_ARRAY = []
8+
79
exports.runPa11y = async function ({ htmlFilePaths, pa11yOpts, build }) {
810
let issueCount = 0;
911
const results = await Promise.all(htmlFilePaths.map(async path => {
@@ -20,8 +22,7 @@ exports.runPa11y = async function ({ htmlFilePaths, pa11yOpts, build }) {
2022

2123
return {
2224
issueCount,
23-
report: results.filter(Boolean)
24-
.join(''),
25+
report: results.join(''),
2526
};
2627
};
2728

@@ -55,11 +56,11 @@ const findHtmlFiles = async function (fileAndDirPath, directoryFilter) {
5556

5657
if (!(await isFile(fileAndDirPath))) {
5758
console.warn(`Folder ${fileAndDirPath} was provided in "checkPaths", but does not exist - it either indicates something went wrong with your build, or you can simply delete this folder from your "checkPaths" in netlify.toml`)
58-
return []
59+
return EMPTY_ARRAY
5960
}
6061

6162
if (extname(fileAndDirPath) !== '.html') {
62-
return []
63+
return EMPTY_ARRAY
6364
}
6465

6566
return [fileAndDirPath]

0 commit comments

Comments
 (0)