@fulldecent/nice-checkers-plugin 1.3.8 → 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 CHANGED
@@ -1,32 +1,36 @@
1
- # :cherry_blossom: Nice Checkers
1
+ # Nice Checkers
2
2
 
3
- [![CI](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/ci.yml/badge.svg)](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/ci.yml)
3
+ [![Lint](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/lint.yml)
4
+ [![Test](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/fulldecent/html-validate-nice-checkers/actions/workflows/test.yml)
4
5
 
5
- An opinionated collection of essential HTML validation rules that promote best practices™ for web development. Use this plugin with [HTML-validate](https://html-validate.org/).
6
+ ## What this project does
6
7
 
7
- ## Features
8
+ Nice Checkers is an [HTML-validate](https://html-validate.org/) plugin with 11 rules for SEO, security, accessibility, and URLs.
8
9
 
9
- - :white_check_mark: **Turnkey validation**: 11 rules covering SEO, security, accessibility, and best practices
10
- - :white_check_mark: **TypeScript**: full type definitions included
11
- - :white_check_mark: **Dual module support**: works with both ESM (`import`) and CJS (`require`)
12
- - :white_check_mark: **Tree shakeable**: import only what you need
13
- - :white_check_mark: **Modern tooling**: [built with tsup](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/tsup.config.ts), [tested with Vitest](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/vitest.config.ts), [good IDE hinting](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/tsconfig.json) and [enforced style checking](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/.prettierrc)
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 you will use Nice Checkers as part of a web test suite running Node (20+) and [HTML-validate](https://html-validate.org/). See [GitHub Pages Template](https://github.com/fulldecent/github-pages-template) for an end-to-end example, including GitHub Actions continuous integration, testing and GitHub Pages deployment for all modern best practices.
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
- ### Add package dev dependency
22
+ Install Nice Checkers as a dev dependency. It is used to test the site.
21
23
 
22
- _Nice Checkers is a **dev** dependency for you because you need it to test your website, not to deploy it._
24
+ Yarn:
23
25
 
24
26
  ```sh
25
- # Using Yarn
26
- yarn add -D html-validate-nice-checkers
27
+ yarn add -D @fulldecent/nice-checkers-plugin
28
+ ```
29
+
30
+ npm:
27
31
 
28
- # Using npm
29
- npm install --dev html-validate-nice-checkers
32
+ ```sh
33
+ npm install -D @fulldecent/nice-checkers-plugin
30
34
  ```
31
35
 
32
36
  ### Update your HTML-validate configuration
@@ -547,36 +551,30 @@ See [issue #23](https://github.com/fulldecent/html-validate-nice-checkers/issues
547
551
 
548
552
  ## Development
549
553
 
550
- Thank you for contributing improvements to this project!
551
-
552
- ### Install
554
+ Clone the repo:
553
555
 
554
556
  ```sh
555
- # Clone the repository
556
- git clone https://github.com/yourusername/html-validate-nice-checkers.git
557
- cd html-validate-nice-checkers
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
+ ```
558
560
 
559
- # Setup Node, for example using nvm
560
- 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):
561
562
 
562
- # Enable Yarn Berry
563
+ ```sh
564
+ fnm install
565
+ fnm use
563
566
  corepack enable
564
-
565
- # Install dependencies
566
567
  yarn install
568
+ yarn test
567
569
  ```
568
570
 
569
- ### Hint: VS Code setup for Yarn Berry
570
-
571
- These notes are [from the Yarn project](https://yarnpkg.com/getting-started/editor-sdks#).
571
+ Format files the lint workflow checks:
572
572
 
573
573
  ```sh
574
- yarn dlx @yarnpkg/sdks vscode
574
+ yarn format
575
575
  ```
576
576
 
577
- and YES, use workspace TypeScript version.
578
-
579
- ### [Development scripts](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/package.json)
577
+ [Development scripts](package.json):
580
578
 
581
579
  - `yarn build` builds the package
582
580
  - `yarn build:watch` builds the package in watch mode
@@ -584,34 +582,57 @@ and YES, use workspace TypeScript version.
584
582
  - `yarn test:watch` runs the tests in watch mode
585
583
  - `yarn test:coverage` runs the tests and generates a coverage report
586
584
  - `yarn lint` runs TypeScript type checking
587
- - `yarn format` formats all source files with Prettier
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.
588
600
 
589
601
  ### Testing notes
590
602
 
591
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.
592
604
 
593
- ## Release to [npm registry](https://www.npmjs.com/package/@fulldecent/nice-checkers-plugin)
594
-
595
- 1. Add any features that will be in the release.
596
- 2. Bump yarn version if appropriate (`yarn set version latest`).
597
- 3. Bump yarn dependencies if appropriate (`yarn upgrade-interactive`).
598
- 4. Bump package.json `peerDependencies` if new `html-validate` is available.
599
- 5. Bump GitHub Actions `uses:` versions if appropriate.
600
- 6. Ensure `yarn && yarn format && yarn lint && yarn build && yarn test && echo ✅` all pass.
601
- 7. Ensure CI passes.
602
- 8. Bump package.json version. (Use a separate commit by itself for this.)
603
- 9. Use GitHub website to create a tag and a release.
605
+ ## Releasing
604
606
 
605
- This releases triggers the [the npm publish workflow](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/.github/workflows/publish.yml).
607
+ Package versions use [Semantic Versioning](https://semver.org/).
606
608
 
607
- ## Maintenance
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.
608
614
 
609
- Periodically, load schemaorg-current-https.jsonld file from <https://schema.org/docs/developers.html> and save to src/vendor/schemaorg-current-https.jsonld. Ideally, the sponsors of Schema.org: Google, Inc., Yahoo, Inc., Microsoft Corporation and Yandex should maintain a NPM package for this file that we can depend on. This would allow our package manager to handle updates.
615
+ ## Maintenance and dependency updates
610
616
 
611
- ## Browser support
617
+ Do this every month or so and please send a PR here if you see updates available:
612
618
 
613
- This is a Node.js library designed for build-time HTML validation. For browser usage, ensure your bundler supports the module format you're using. Some of our rules use `cURL` which will not work in the browser. We would like to switch to `fetch()` but [are limited by](https://gitlab.com/html-validate/html-validate/-/issues/317) HTML-validate.
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.
614
624
 
615
- ## Contributing
625
+ ## References
616
626
 
617
- Ensure your changes pass `yarn format && yarn lint && yarn test`.
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.