Skip to content

Commit

Permalink
Fix documentation for the reporter() function's first parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Mar 1, 2024
1 parent dade5ad commit a5da3ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ $ node examples.js
*The `ignoreMessages` and `ignoreLevel` options only work for `'json'` output. 
Setting `ignoreLevel` to `'warning'` skips both `'warning'` level and `'info'` level validation messages.

#### w3cHtmlValidator.reporter(options)
#### w3cHtmlValidator.reporter(results, options)
| Name (key) | Type | Default | Description |
| :--------------- | :---------- | :------ | :-------------------------------------------------------------- |
| `continueOnFail` | **boolean** | `false` | Report messages but do not throw an error if validation failed. |
Expand Down
8 changes: 4 additions & 4 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const getIgnoreMessages = () => {
const isRegex = /^\/.*\/$/; //starts and ends with a slash indicating it's a regex
return rawLines.map(line => isRegex.test(line) ? new RegExp(line.slice(1, -1)) : line);
};
const handleReport = (report) => w3cHtmlValidator.reporter(report, reporterOptions);
const options = (filename) => ({ filename: filename, ignoreMessages: getIgnoreMessages() });
const getReport = (filename) => w3cHtmlValidator.validate(options(filename)).then(handleReport);
const processFile = (filename, i) => globalThis.setTimeout(() => getReport(filename), i * delay);
const handleResults = (results) => w3cHtmlValidator.reporter(results, reporterOptions);
const options = (filename) => ({ filename: filename, ignoreMessages: getIgnoreMessages() });
const getReport = (filename) => w3cHtmlValidator.validate(options(filename)).then(handleResults);
const processFile = (filename, i) => globalThis.setTimeout(() => getReport(filename), i * delay);
filenames.forEach(processFile);

0 comments on commit a5da3ad

Please sign in to comment.