w3c-html-validator 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,31 +63,33 @@ Command-line flags:
63
63
  ### 4. Example CLI usage
64
64
  Examples:
65
65
  - `html-validator`<br>
66
- Validate all HTML files in the project.
66
+ Validates all HTML files in the project.
67
67
 
68
68
  - `html-validator docs --exclude=build,tmp`<br>
69
- Validate all HTML files in the **docs** folder except files which have "build" or "tmp" anywhere in their pathname or filename.
69
+ Validates all HTML files in the **docs** folder except files which have "build" or "tmp" anywhere in their pathname or filename.
70
70
 
71
71
  - `html-validator docs '--ignore=Trailing slash on void elements'`<br>
72
- Allow the ugly slashes of self-closing tags despite XHTML being a hideous scourge on the web.
72
+ Allows the ugly slashes of self-closing tags despite XHTML being a hideous scourge on the web.
73
73
 
74
74
  - `html-validator docs '--ignore=/^Duplicate ID/'`<br>
75
- Use a regex (regular expression) to skip all HTML validation messages that start with "Duplicate ID".
75
+ Uses a regex (regular expression) to skip all HTML validation messages that start with "Duplicate ID".
76
76
 
77
77
  - `html-validator docs '--ignore=/^Duplicate ID|^Section lacks|^Element .blockquote. not allowed/'`<br>
78
- Use a regex with "or" operators (`|`) to skip multiple HTML validation messages.
78
+ Uses a regex with "or" operators (`|`) to skip multiple HTML validation messages.
79
79
 
80
80
  - `html-validator docs --ignore-config=spec/ignore-config.txt`<br>
81
81
  Similar to the pervious command but strings and regexes are stored in a configuration file (see the _Ignore Configuration File_ section below).
82
82
 
83
83
  - `html-validator --quiet`<br>
84
- Suppress "pass" status messages.
84
+ Suppresses all the "pass" status messages.
85
85
 
86
86
  - `html-validator docs --delay=200`<br>
87
- Validate all HTML files in the "docs" folder at a rate of 1 file per 200 ms (default is 500 ms).
87
+ Validates all HTML files in the "docs" folder at a rate of 1 file per 200 ms (default is 500 ms).
88
88
 
89
89
  - `html-validator docs --trim=30 --continue`<br>
90
- Truncate validation messages to 30 characters and do not abort CI if validation fails.
90
+ Truncates validation messages to 30 characters and does not abort CI if validation fails.
91
+
92
+ _**Note:** Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._
91
93
 
92
94
  ### 5. Ignore Configuration File
93
95
  The optional `--ignore-config=FILENAME` flag specifies a configuration file with one string or regex per line.&nbsp;
package/bin/cli.js CHANGED
@@ -17,6 +17,8 @@
17
17
  //
18
18
  // Contributors to this project:
19
19
  // $ cd w3c-html-validator
20
+ // $ npm install
21
+ // $ npm test
20
22
  // $ node bin/cli.js spec --continue
21
23
 
22
24
  // Imports
@@ -35,10 +37,12 @@ const delay = Number(cli.flagMap.delay) || 500; //default half second de
35
37
  const trim = Number(cli.flagMap.trim) || null;
36
38
 
37
39
  // Validator
40
+ const globOptions = { ignore: '**/node_modules/**/*' };
38
41
  const keep = (filename) => !filename.includes('node_modules/');
39
- const readFolder = (folder) => globSync(folder + '**/*.html', { ignore: '**/node_modules/**/*' });
42
+ const readFolder = (folder) => globSync(folder + '**/*.html', globOptions);
40
43
  const expandFolder = (file) => fs.lstatSync(file).isDirectory() ? readFolder(file + '/') : file;
41
- const getFilenames = () => [...new Set(files.map(expandFolder).flat().filter(keep))].sort();
44
+ const getAllPaths = () => files.map(file => globSync(file, globOptions)).flat();
45
+ const getFilenames = () => getAllPaths().map(expandFolder).flat().filter(keep).sort();
42
46
  const list = files.length ? getFilenames() : readFolder('');
43
47
  const excludes = cli.flagMap.exclude?.split(',') ?? [];
44
48
  const filenames = list.filter(name => !excludes.find(exclude => name.includes(exclude)));
@@ -1,4 +1,4 @@
1
- //! w3c-html-validator v1.5.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
1
+ //! w3c-html-validator v1.6.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
2
2
 
3
3
  export type ValidatorSettings = {
4
4
  html: string;
@@ -1,11 +1,11 @@
1
- //! w3c-html-validator v1.5.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
1
+ //! w3c-html-validator v1.6.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
2
2
 
3
3
  import chalk from 'chalk';
4
4
  import fs from 'fs';
5
5
  import log from 'fancy-log';
6
6
  import request from 'superagent';
7
7
  const w3cHtmlValidator = {
8
- version: '1.5.1',
8
+ version: '1.6.0',
9
9
  validate(options) {
10
10
  const defaults = {
11
11
  checkUrl: 'https://validator.w3.org/nu/',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w3c-html-validator",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Check the markup validity of HTML files using the W3C validator",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -85,21 +85,21 @@
85
85
  "chalk": "~5.3",
86
86
  "cli-argv-util": "~1.2",
87
87
  "fancy-log": "~2.0",
88
- "glob": "10.3.6",
88
+ "glob": "~10.3",
89
89
  "superagent": "~8.1"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/fancy-log": "~2.0",
93
93
  "@types/glob": "~8.1",
94
- "@types/node": "~20.6",
94
+ "@types/node": "~20.8",
95
95
  "@types/superagent": "~4.1",
96
- "@typescript-eslint/eslint-plugin": "~6.7",
97
- "@typescript-eslint/parser": "~6.7",
96
+ "@typescript-eslint/eslint-plugin": "~6.9",
97
+ "@typescript-eslint/parser": "~6.9",
98
98
  "add-dist-header": "~1.3",
99
99
  "assert-deep-strict-equal": "~1.1",
100
100
  "copy-file-util": "~1.1",
101
101
  "copy-folder-util": "~1.1",
102
- "eslint": "~8.50",
102
+ "eslint": "~8.53",
103
103
  "jshint": "~2.13",
104
104
  "merge-stream": "~2.0",
105
105
  "mocha": "~10.2",