@fulldecent/nice-checkers-plugin 1.3.10 → 1.3.11
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 +29 -33
- package/dist/index.cjs +28608 -504
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -9
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28578 -505
- package/dist/index.js.map +1 -1
- package/package.json +20 -25
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Nice Checkers is an [HTML-validate](https://html-validate.org/) plugin with 11 r
|
|
|
9
9
|
|
|
10
10
|
The npm package is [@fulldecent/nice-checkers-plugin](https://www.npmjs.com/package/@fulldecent/nice-checkers-plugin). It publishes ESM and CommonJS builds and TypeScript types. It runs in Node.js while a site is built. Some rules call other sites with `curl`. A `fetch()` implementation is blocked by [html-validate issue 317](https://gitlab.com/html-validate/html-validate/-/issues/317).
|
|
11
11
|
|
|
12
|
-
`engines` allows Node.js 22 and newer. [Tests](.github/workflows/test.yml) run on the Node.js 22, 24, and 26 release lines. [Lint](.github/workflows/lint.yml) checks Prettier and markdownlint. Local development uses the Node.js version in [.node-version](.node-version).
|
|
12
|
+
`engines` allows Node.js 22.16 and newer, which is the oldest Node.js supported by html-validate 10. [Tests](.github/workflows/test.yml) run on the Node.js 22, 24, and 26 release lines. [Lint](.github/workflows/lint.yml) checks Prettier and markdownlint. Local development uses the Node.js version in [.node-version](.node-version).
|
|
13
13
|
|
|
14
14
|
[GitHub Pages template](https://github.com/fulldecent/github-pages-template) is a site that uses this plugin, with Actions and Pages deployment.
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
|
-
These instructions assume Nice Checkers is part of a web test suite running Node.js 22 or newer and [HTML-validate](https://html-validate.org/).
|
|
18
|
+
These instructions assume Nice Checkers is part of a web test suite running Node.js 22.16 or newer and [HTML-validate](https://html-validate.org/).
|
|
19
19
|
|
|
20
20
|
### Add the package
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ This example assumes you are using the .htmlvalidate.mjs configuration flavor. H
|
|
|
39
39
|
|
|
40
40
|
```diff
|
|
41
41
|
import { defineConfig } from "html-validate";
|
|
42
|
-
+ import
|
|
42
|
+
+ import NiceCheckersPlugin from "@fulldecent/nice-checkers-plugin"
|
|
43
43
|
|
|
44
44
|
export default defineConfig({
|
|
45
45
|
- "extends": ["htmlvalidate:recommended"]
|
|
@@ -148,7 +148,7 @@ This allows you to validate your HTML before publishing, even when the canonical
|
|
|
148
148
|
"cacheExpiryFoundSeconds": 2592000,
|
|
149
149
|
"cacheExpiryNotFoundSeconds": 259200,
|
|
150
150
|
"timeoutSeconds": 5,
|
|
151
|
-
"cacheDatabasePath": "cache/external-links.
|
|
151
|
+
"cacheDatabasePath": "cache/external-links.csv",
|
|
152
152
|
"userAgent": "Mozilla/5.0 (compatible; html-validate-nice-checkers)"
|
|
153
153
|
}
|
|
154
154
|
]
|
|
@@ -165,7 +165,7 @@ This allows you to validate your HTML before publishing, even when the canonical
|
|
|
165
165
|
| `cacheExpiryFoundSeconds` | `number` | `2592000` | Cache duration for successful checks (default: 30 days) |
|
|
166
166
|
| `cacheExpiryNotFoundSeconds` | `number` | `259200` | Cache duration for failed checks (default: 3 days) |
|
|
167
167
|
| `timeoutSeconds` | `number` | `5` | Request timeout in seconds |
|
|
168
|
-
| `cacheDatabasePath` | `string` | `"cache/external-links.
|
|
168
|
+
| `cacheDatabasePath` | `string` | `"cache/external-links.csv"` | Path to the CSV cache database file |
|
|
169
169
|
| `userAgent` | `string` | `"Mozilla/5.0 (compatible; html-validate-nice-checkers)"` | User agent string for HTTP requests |
|
|
170
170
|
| `manuallyReviewedPath` | `string` | `""` | Path to CSV file with manually reviewed URLs (see below) |
|
|
171
171
|
| `manuallyReviewedExpirySeconds` | `number` | `31536000` | Expiry time for manually reviewed URLs (default: 365 days) |
|
|
@@ -220,7 +220,7 @@ Reports insecure HTTP links that are accessible via HTTPS, encouraging the use o
|
|
|
220
220
|
"cacheExpiryFoundSeconds": 2592000,
|
|
221
221
|
"cacheExpiryNotFoundSeconds": 259200,
|
|
222
222
|
"timeoutSeconds": 10,
|
|
223
|
-
"cacheDatabasePath": "cache/https-availability.
|
|
223
|
+
"cacheDatabasePath": "cache/https-availability.csv"
|
|
224
224
|
}
|
|
225
225
|
]
|
|
226
226
|
}
|
|
@@ -229,12 +229,12 @@ Reports insecure HTTP links that are accessible via HTTPS, encouraging the use o
|
|
|
229
229
|
|
|
230
230
|
#### Configuration options
|
|
231
231
|
|
|
232
|
-
| Option | Type | Default
|
|
233
|
-
| ---------------------------- | -------- |
|
|
234
|
-
| `cacheExpiryFoundSeconds` | `number` | `2592000`
|
|
235
|
-
| `cacheExpiryNotFoundSeconds` | `number` | `259200`
|
|
236
|
-
| `timeoutSeconds` | `number` | `10`
|
|
237
|
-
| `cacheDatabasePath` | `string` | `"cache/https-availability.
|
|
232
|
+
| Option | Type | Default | Description |
|
|
233
|
+
| ---------------------------- | -------- | -------------------------------- | ------------------------------------------------------------- |
|
|
234
|
+
| `cacheExpiryFoundSeconds` | `number` | `2592000` | Cache duration for successful HTTPS checks (default: 30 days) |
|
|
235
|
+
| `cacheExpiryNotFoundSeconds` | `number` | `259200` | Cache duration for failed HTTPS checks (default: 3 days) |
|
|
236
|
+
| `timeoutSeconds` | `number` | `10` | Request timeout in seconds |
|
|
237
|
+
| `cacheDatabasePath` | `string` | `"cache/https-availability.csv"` | Path to the CSV cache database file |
|
|
238
238
|
|
|
239
239
|
### `nice-checkers/internal-links`
|
|
240
240
|
|
|
@@ -301,7 +301,7 @@ Ensures that package assets loaded from CDNs (like jsDelivr) are using the lates
|
|
|
301
301
|
{
|
|
302
302
|
"cacheExpirySeconds": 172800,
|
|
303
303
|
"timeoutSeconds": 10,
|
|
304
|
-
"cacheDatabasePath": "cache/latest-packages.
|
|
304
|
+
"cacheDatabasePath": "cache/latest-packages.csv",
|
|
305
305
|
"skipUrlPatterns": ["googletagmanager.com"]
|
|
306
306
|
}
|
|
307
307
|
]
|
|
@@ -311,12 +311,12 @@ Ensures that package assets loaded from CDNs (like jsDelivr) are using the lates
|
|
|
311
311
|
|
|
312
312
|
#### Configuration options
|
|
313
313
|
|
|
314
|
-
| Option | Type | Default
|
|
315
|
-
| -------------------- | ---------- |
|
|
316
|
-
| `cacheExpirySeconds` | `number` | `172800`
|
|
317
|
-
| `timeoutSeconds` | `number` | `10`
|
|
318
|
-
| `cacheDatabasePath` | `string` | `"cache/latest-packages.
|
|
319
|
-
| `skipUrlPatterns` | `string[]` | `[]`
|
|
314
|
+
| Option | Type | Default | Description |
|
|
315
|
+
| -------------------- | ---------- | ----------------------------- | ----------------------------------------------------------- |
|
|
316
|
+
| `cacheExpirySeconds` | `number` | `172800` | Cache duration for package version checks (default: 2 days) |
|
|
317
|
+
| `timeoutSeconds` | `number` | `10` | Request timeout in seconds |
|
|
318
|
+
| `cacheDatabasePath` | `string` | `"cache/latest-packages.csv"` | Path to the CSV cache database file |
|
|
319
|
+
| `skipUrlPatterns` | `string[]` | `[]` | Array of URL patterns to skip checking |
|
|
320
320
|
|
|
321
321
|
### `nice-checkers/match-regex`
|
|
322
322
|
|
|
@@ -582,21 +582,14 @@ yarn format
|
|
|
582
582
|
- `yarn test:watch` runs the tests in watch mode
|
|
583
583
|
- `yarn test:coverage` runs the tests and generates a coverage report
|
|
584
584
|
- `yarn lint` runs TypeScript type checking
|
|
585
|
+
- `yarn check:package` checks the built package with publint and arethetypeswrong
|
|
585
586
|
- `yarn format` formats files with Prettier and markdownlint
|
|
586
587
|
|
|
587
588
|
Changes are ready to push when `yarn format && yarn lint && yarn test` passes.
|
|
588
589
|
|
|
589
|
-
### Editor setup
|
|
590
|
+
### Editor setup
|
|
590
591
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
```sh
|
|
594
|
-
yarn dlx @yarnpkg/sdks vscode
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
Then select the workspace TypeScript version.
|
|
598
|
-
|
|
599
|
-
`yarn format` and the lint workflow both run `npx prettier@latest`. The editor's Prettier extension can be a different version, so the command above is the one that matches CI.
|
|
592
|
+
`yarn format` and the lint workflow both run `npx prettier@latest`. The editor's Prettier extension can be a different version, so `yarn format` is the one that matches CI.
|
|
600
593
|
|
|
601
594
|
### Testing notes
|
|
602
595
|
|
|
@@ -608,7 +601,7 @@ Package versions use [Semantic Versioning](https://semver.org/).
|
|
|
608
601
|
|
|
609
602
|
1. Finish the changes that belong in the release.
|
|
610
603
|
1. Bump `peerDependencies` when a newly supported html-validate version requires it.
|
|
611
|
-
1. Run `yarn && yarn format && yarn lint && yarn build && yarn test`.
|
|
604
|
+
1. Run `yarn && yarn format && yarn lint && yarn build && yarn test && yarn check:package`.
|
|
612
605
|
1. Bump `version` in package.json in a commit by itself.
|
|
613
606
|
1. Create a GitHub release for that version. [publish.yml](.github/workflows/publish.yml) publishes the package to npm.
|
|
614
607
|
|
|
@@ -617,9 +610,11 @@ Package versions use [Semantic Versioning](https://semver.org/).
|
|
|
617
610
|
Do this every month or so and please send a PR here if you see updates available:
|
|
618
611
|
|
|
619
612
|
1. Identify external Actions in [.github/workflows](./.github/workflows) scripts and look for available new versions. Review and then update to the new version if it is safe. GitHub-supported Actions (i.e. under the actions/ organization) may require only cursory review.
|
|
620
|
-
1. Review the Node.js version in `.node-version`. Update it when a newer version is appropriate. `fnm install` reads that file.
|
|
613
|
+
1. Review the Node.js version in `.node-version`. Update it when a newer version is appropriate. `fnm install` reads that file. This local pin is separate from the versions the package supports.
|
|
614
|
+
1. Review the supported Node.js versions against the [Node.js release schedule](https://nodejs.org/en/about/previous-releases). This package supports the Current, Active LTS, and Maintenance LTS release lines, the same as html-validate. It does not support a Node.js version that the oldest html-validate in `peerDependencies` has dropped from its `engines`. `engines.node` in package.json is the floor, and tsdown compiles to that floor. When a release line reaches end-of-life, or a `peerDependencies` bump raises html-validate's floor, raise `engines.node` and update the Node.js versions in [test.yml](.github/workflows/test.yml) in the same commit.
|
|
621
615
|
1. Review the Yarn version in `package.json` (`packageManager`). Update it with `yarn set version stable && yarn` when a newer stable version is appropriate. [Yarn's install instructions](https://yarnpkg.com/getting-started/install) document that command.
|
|
622
616
|
1. Review direct dependencies with `yarn upgrade-interactive`.
|
|
617
|
+
1. Check whether [TypeScript issue #63769](https://github.com/microsoft/TypeScript/issues/63769) is fixed and whether Vite still warns about Plug'n'Play ([Vite pull request #21906](https://github.com/vitejs/vite/pull/21906)). When neither blocks Plug'n'Play, remove `nodeLinker` from `.yarnrc.yml`.
|
|
623
618
|
1. Download the Schema.org vocabulary from <https://schema.org/docs/developers.html> and save it as `src/vendor/schemaorg-current-https.json`. Schema.org does not publish that file as an npm package, so the update is manual.
|
|
624
619
|
|
|
625
620
|
## References
|
|
@@ -628,11 +623,12 @@ Do this every month or so and please send a PR here if you see updates available
|
|
|
628
623
|
1. This project uses the MIT license, the same license as [node.js-template](https://github.com/fulldecent/node.js-template).
|
|
629
624
|
1. We would prefer if fnm supported build attestations since it is installed as a binary ([issue #1588](https://github.com/Schniz/fnm/issues/1588)).
|
|
630
625
|
1. Node.js ignore rules are inlined from [Node.gitignore](https://github.com/github/gitignore/blob/main/Node.gitignore). This project also ignores `/cache`, the fixture files that tests rewrite, and `package-lock.json`. `package-lock.json` is ignored because dependencies are locked with `yarn.lock`.
|
|
631
|
-
1. `.yarnrc.yml` sets `enableScripts` to true (Yarn 4.14 defaults to false) and `npmMinimalAgeGate` to 0 (Yarn 4.12 defaults to one day). `approvedGitRepositories` is `"**"`, which approves every git dependency. [Yarn: Security](https://yarnpkg.com/features/security)
|
|
626
|
+
1. `.yarnrc.yml` sets `enableScripts` to true (Yarn 4.14 defaults to false) and `npmMinimalAgeGate` to 0 (Yarn 4.12 defaults to one day). `approvedGitRepositories` is `"**"`, which approves every git dependency. [Yarn: Security](https://yarnpkg.com/features/security). It also sets `nodeLinker: pnpm` instead of the default, Plug'n'Play, because TypeScript 7 and Vite do not support Plug'n'Play. The comments in that file link to both upstream issues.
|
|
632
627
|
1. Prettier options are in [.prettierrc](.prettierrc). [node.js-template](https://github.com/fulldecent/node.js-template) has no application source and therefore no Prettier config. Formatting still uses `npx prettier@latest`, the same command as that template's lint workflow.
|
|
633
628
|
1. `.prettierignore` ignores `*.md`, the same as the template. It also ignores `tests/fixtures` and `src/vendor`. Fixture HTML is the exact input for `required-reports.json`, which records line, column, and byte offset. `src/vendor/schemaorg-current-https.json` is a file downloaded from Schema.org.
|
|
634
629
|
1. markdownlint disables MD013, the same as the template, and sets MD024 `siblings_only`. Each rule section repeats the headings "Configuration" and "Configuration options". `siblings_only` allows that because each heading sits under a different rule.
|
|
635
|
-
1. [test.yml](.github/workflows/test.yml) runs `yarn lint`, `yarn test`, and `yarn build
|
|
630
|
+
1. [test.yml](.github/workflows/test.yml) runs `yarn lint`, `yarn test`, and `yarn build`. Then it checks the package with publint and arethetypeswrong, packs it, and loads it into html-validate from ESM and from CommonJS. The CommonJS test uses html-validate's `cjsResolver`, which loads plugins with `require()`. The test script in node.js-template is `true`, which is enough for a package with no behavior of its own. This job runs on Node.js 22, 24, and 26, the Maintenance LTS, Active LTS, and Current release lines. `.node-version` stays at 24.
|
|
631
|
+
1. [tsdown.config.ts](tsdown.config.ts) builds `dist/` from `src/index.ts`: `.js` and `.d.ts` for `import`, `.cjs` and `.d.cts` for `require`, matching `exports` in package.json. `tsc --noEmit` type checks and does not publish. The build is not minified so that people can debug the rules. html-validate is a peer dependency and is not bundled. CommonJS is kept for html-validate's `cjsResolver`, so the build turns off tsdown's `legacyCjs` warning.
|
|
636
632
|
1. [publish.yml](.github/workflows/publish.yml) publishes to npm when a GitHub release is published. node.js-template sets `"private": true` and is not an npm package.
|
|
637
633
|
1. This project is built based on [best practices documented in node.js-template](https://github.com/fulldecent/node.js-template).
|
|
638
634
|
1. This project is built based on [best practices documented in project-template](https://github.com/fulldecent/project-template), release 1.0.0.
|