@fulldecent/nice-checkers-plugin 1.3.7 → 1.3.10
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 +105 -54
- package/dist/index.cjs +322 -322
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +322 -322
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nice Checkers
|
|
2
2
|
|
|
3
|
-
[](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/lint.yml)
|
|
4
|
+
[](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/test.yml)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## What this project does
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Nice Checkers is an [HTML-validate](https://html-validate.org/) plugin with 11 rules for SEO, security, accessibility, and URLs.
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- :white_check_mark: **Comprehensive testing**: high test coverage with realistic fixtures
|
|
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
|
+
|
|
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).
|
|
13
|
+
|
|
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
|
|
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/).
|
|
19
|
+
|
|
20
|
+
### Add the package
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
Install Nice Checkers as a dev dependency. It is used to test the site.
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Yarn:
|
|
23
25
|
|
|
24
26
|
```sh
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
yarn add -D @fulldecent/nice-checkers-plugin
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
npm:
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
npm install
|
|
32
|
+
```sh
|
|
33
|
+
npm install -D @fulldecent/nice-checkers-plugin
|
|
30
34
|
```
|
|
31
35
|
|
|
32
36
|
### Update your HTML-validate configuration
|
|
@@ -458,6 +462,36 @@ Note that these sources we reference have a conflict. One says that you may use
|
|
|
458
462
|
| ------------- | -------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
|
|
459
463
|
| `urlRewrites` | `{ pattern: string, replacement: string }[]` | `[]` | Regex rewrite rules applied to each alternate URL before reciprocal validation. Useful for local fixtures. |
|
|
460
464
|
|
|
465
|
+
### `nice-checkers/schema-org-json-ld`
|
|
466
|
+
|
|
467
|
+
Validates `<script type="application/ld+json">` structured data against the bundled Schema.org vocabulary. This rule catches typos and mistakes in class names, property names, and property values before search engines silently ignore your structured data.
|
|
468
|
+
|
|
469
|
+
```diff
|
|
470
|
+
<script type="application/ld+json">
|
|
471
|
+
{
|
|
472
|
+
"@context": "https://schema.org",
|
|
473
|
+
- "@type": "MyTotallyFakeClass",
|
|
474
|
+
+ "@type": "WebSite",
|
|
475
|
+
"name": "My Awesome Site",
|
|
476
|
+
"url": "https://example.com/"
|
|
477
|
+
}
|
|
478
|
+
</script>
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Configuration
|
|
482
|
+
|
|
483
|
+
```json
|
|
484
|
+
{
|
|
485
|
+
"rules": {
|
|
486
|
+
"nice-checkers/schema-org-json-ld": "error"
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
#### Configuration options
|
|
492
|
+
|
|
493
|
+
This rule has no configurable options.
|
|
494
|
+
|
|
461
495
|
### Example configuration for local build validation
|
|
462
496
|
|
|
463
497
|
```json
|
|
@@ -517,36 +551,30 @@ See [issue #23](https://github.com/fulldecent/html-validate-nice-checkers/issues
|
|
|
517
551
|
|
|
518
552
|
## Development
|
|
519
553
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
### Install
|
|
554
|
+
Clone the repo:
|
|
523
555
|
|
|
524
556
|
```sh
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
557
|
+
git clone https://github.com/fulldecent/html-validate-nice-checkers.git ~/Developer/html-validate-nice-checkers
|
|
558
|
+
cd ~/Developer/html-validate-nice-checkers
|
|
559
|
+
```
|
|
528
560
|
|
|
529
|
-
|
|
530
|
-
nvm use
|
|
561
|
+
Use Node and yarn. The Node version is pinned in [.node-version](.node-version), and the Yarn version is pinned in [package.json](package.json). Quick start with [fnm](https://github.com/Schniz/fnm):
|
|
531
562
|
|
|
532
|
-
|
|
563
|
+
```sh
|
|
564
|
+
fnm install
|
|
565
|
+
fnm use
|
|
533
566
|
corepack enable
|
|
534
|
-
|
|
535
|
-
# Install dependencies
|
|
536
567
|
yarn install
|
|
568
|
+
yarn test
|
|
537
569
|
```
|
|
538
570
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
These notes are [from the Yarn project](https://yarnpkg.com/getting-started/editor-sdks#).
|
|
571
|
+
Format files the lint workflow checks:
|
|
542
572
|
|
|
543
573
|
```sh
|
|
544
|
-
yarn
|
|
574
|
+
yarn format
|
|
545
575
|
```
|
|
546
576
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
### [Development scripts](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/package.json)
|
|
577
|
+
[Development scripts](package.json):
|
|
550
578
|
|
|
551
579
|
- `yarn build` builds the package
|
|
552
580
|
- `yarn build:watch` builds the package in watch mode
|
|
@@ -554,34 +582,57 @@ and YES, use workspace TypeScript version.
|
|
|
554
582
|
- `yarn test:watch` runs the tests in watch mode
|
|
555
583
|
- `yarn test:coverage` runs the tests and generates a coverage report
|
|
556
584
|
- `yarn lint` runs TypeScript type checking
|
|
557
|
-
- `yarn format` formats
|
|
585
|
+
- `yarn format` formats files with Prettier and markdownlint
|
|
586
|
+
|
|
587
|
+
Changes are ready to push when `yarn format && yarn lint && yarn test` passes.
|
|
588
|
+
|
|
589
|
+
### Editor setup for Yarn
|
|
590
|
+
|
|
591
|
+
Yarn installs with Plug'n'Play. An editor that loads TypeScript from a global install will not see this project's version. [Yarn's editor SDK instructions](https://yarnpkg.com/getting-started/editor-sdks) are:
|
|
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.
|
|
558
600
|
|
|
559
601
|
### Testing notes
|
|
560
602
|
|
|
561
603
|
When running `yarn test` to test Nice Checkers itself, you may see two warnings about missing "root" paths. These come from the mock HTTP server (`@jaredwray/mockhttp`) which is only used in our test suite. The warnings are harmless and do not affect test results. We consider this an error in the upstream mock HTTP server package. These warnings do not appear for downstream users who install Nice Checkers to validate their own websites.
|
|
562
604
|
|
|
563
|
-
##
|
|
564
|
-
|
|
565
|
-
1. Add any features that will be in the release.
|
|
566
|
-
2. Bump yarn version if appropriate (`yarn set version latest`).
|
|
567
|
-
3. Bump yarn dependencies if appropriate (`yarn upgrade-interactive`).
|
|
568
|
-
4. Bump package.json `peerDependencies` if new `html-validate` is available.
|
|
569
|
-
5. Bump GitHub Actions `uses:` versions if appropriate.
|
|
570
|
-
6. Ensure `yarn && yarn format && yarn lint && yarn build && yarn test && echo ✅` all pass.
|
|
571
|
-
7. Ensure CI passes.
|
|
572
|
-
8. Bump package.json version. (Use a separate commit by itself for this.)
|
|
573
|
-
9. Use GitHub website to create a tag and a release.
|
|
605
|
+
## Releasing
|
|
574
606
|
|
|
575
|
-
|
|
607
|
+
Package versions use [Semantic Versioning](https://semver.org/).
|
|
576
608
|
|
|
577
|
-
|
|
609
|
+
1. Finish the changes that belong in the release.
|
|
610
|
+
1. Bump `peerDependencies` when a newly supported html-validate version requires it.
|
|
611
|
+
1. Run `yarn && yarn format && yarn lint && yarn build && yarn test`.
|
|
612
|
+
1. Bump `version` in package.json in a commit by itself.
|
|
613
|
+
1. Create a GitHub release for that version. [publish.yml](.github/workflows/publish.yml) publishes the package to npm.
|
|
578
614
|
|
|
579
|
-
|
|
615
|
+
## Maintenance and dependency updates
|
|
580
616
|
|
|
581
|
-
|
|
617
|
+
Do this every month or so and please send a PR here if you see updates available:
|
|
582
618
|
|
|
583
|
-
|
|
619
|
+
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. Also review the Node.js versions in [test.yml](.github/workflows/test.yml). Those versions are the maintenance, active, and current release lines allowed by `engines`, which is separate from the local pin.
|
|
621
|
+
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
|
+
1. Review direct dependencies with `yarn upgrade-interactive`.
|
|
623
|
+
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.
|
|
584
624
|
|
|
585
|
-
##
|
|
625
|
+
## References
|
|
586
626
|
|
|
587
|
-
|
|
627
|
+
1. We use title case for titles and proper nouns; not for headings and things. This includes our README above as well as our workflow rules and other configuration files. If you have a different policy, then please implement it throughout.
|
|
628
|
+
1. This project uses the MIT license, the same license as [node.js-template](https://github.com/fulldecent/node.js-template).
|
|
629
|
+
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
|
+
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)
|
|
632
|
+
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
|
+
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
|
+
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`, then packs the package and imports it from ESM and from CommonJS. The test script in node.js-template is `true`, which is enough for a package with no behavior of its own. This job also runs on Node.js 22, 24, and 26 because `engines` is `>=22` and those are the maintenance, active, and current release lines. `.node-version` stays at 24.
|
|
636
|
+
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
|
+
1. This project is built based on [best practices documented in node.js-template](https://github.com/fulldecent/node.js-template).
|
|
638
|
+
1. This project is built based on [best practices documented in project-template](https://github.com/fulldecent/project-template), release 1.0.0.
|