{"id":40282349,"url":"https://github.com/fulldecent/html-validate-nice-checkers","last_synced_at":"2026-04-08T19:00:29.192Z","repository":{"id":316345804,"uuid":"1062979337","full_name":"fulldecent/html-validate-nice-checkers","owner":"fulldecent","description":"HTML-validate plugin and rules you should always use","archived":false,"fork":false,"pushed_at":"2026-04-02T23:12:19.000Z","size":693,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T06:58:07.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fulldecent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T02:14:18.000Z","updated_at":"2026-03-06T19:01:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2371e69-e5fc-417a-8a6a-afa2d28c1ebe","html_url":"https://github.com/fulldecent/html-validate-nice-checkers","commit_stats":null,"previous_names":["fulldecent/html-validate-nice-checkers"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/fulldecent/html-validate-nice-checkers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fhtml-validate-nice-checkers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fhtml-validate-nice-checkers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fhtml-validate-nice-checkers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fhtml-validate-nice-checkers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fulldecent","download_url":"https://codeload.github.com/fulldecent/html-validate-nice-checkers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fhtml-validate-nice-checkers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31569400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-20T04:04:33.972Z","updated_at":"2026-04-08T19:00:29.185Z","avatar_url":"https://github.com/fulldecent.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :cherry_blossom: Nice Checkers\n\n[![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)\n\nAn opinionated collection of essential HTML validation rules that promote best practices™ for web development. Use this plugin with [HTML-validate](https://html-validate.org/).\n\n## Features\n\n- :white_check_mark: **Turnkey validation**: 11 rules covering SEO, security, accessibility, and best practices\n- :white_check_mark: **TypeScript**: full type definitions included\n- :warning: **Dual module support**: works with both ESM (`import`) and CJS (`require`) (known issue: ESM and CommonJS builds are [sometimes not building correctly](https://github.com/fulldecent/html-validate-nice-checkers/issues/6))\n- :white_check_mark: **Tree shakeable**: import only what you need\n- :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)\n- :white_check_mark: **Comprehensive testing**: high test coverage with realistic fixtures\n\n## Installation\n\nThese 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.\n\n### Add package dev dependency\n\n_Nice Checkers is a **dev** dependency for you because you need it to test your website, not to deploy it._\n\n```sh\n# Using Yarn\nyarn add -D html-validate-nice-checkers\n\n# Using npm\nnpm install --dev html-validate-nice-checkers\n```\n\n### Update your HTML-validate configuration\n\nThis example assumes you are using the .htmlvalidate.mjs configuration flavor. HTML-validate also [supports other configuration flavors](https://html-validate.org/usage/index.html#configuration).\n\n```diff\n  import { defineConfig } from \"html-validate\";\n+ import { NiceCheckersPlugin } from \"@fulldecent/nice-checkers-plugin\"\n\n  export default defineConfig({\n-   \"extends\": [\"htmlvalidate:recommended\"]\n+   \"plugins\": [NiceCheckersPlugin],\n+   \"extends\": [\"htmlvalidate:recommended\", \"nice-checkers-plugin:recommended\"]\n  });\n```\n\n## Rules\n\nAll rules are enabled by default when you extend from `nice-checkers-plugin:recommended`. Find introductions and configuration options for each rule below.\n\n### `nice-checkers/alternate-language-url`\n\nEnsures that all alternate language links (`\u003clink rel=\"alternate\" hreflang=\"...\"\u003e`) use fully qualified URLs with protocol (https://). This follows Google's best practices for international and multilingual websites.\n\nAccording to [Google's documentation on localized versions](https://developers.google.com/search/docs/specialty/international/localized-versions), alternate language links must use fully qualified URLs:\n\n\u003e \"The value of the hreflang attribute identifies the language (in ISO 639-1 format) and optionally a region (in ISO 3166-1 Alpha 2 format) of an alternate URL. **The href attribute contains the full URL of the alternate version.**\"\n\nUsing relative or protocol-relative URLs can cause search engines to misinterpret or ignore your international content signals.\n\n```diff\n- \u003c!-- Incorrect: relative path --\u003e\n- \u003clink rel=\"alternate\" hreflang=\"es\" href=\"/es/page\" /\u003e\n- \u003clink rel=\"alternate\" hreflang=\"fr\" href=\"../fr/page.html\" /\u003e\n+ \u003c!-- Correct: fully qualified URL --\u003e\n+ \u003clink rel=\"alternate\" hreflang=\"es\" href=\"https://example.com/es/page\" /\u003e\n+ \u003clink rel=\"alternate\" hreflang=\"fr\" href=\"https://example.fr/page\" /\u003e\n```\n\n#### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/alternate-language-url\": \"error\"\n  }\n}\n```\n\n#### Configuration options\n\nThis rule has no configurable options.\n\n### `nice-checkers/canonical-link`\n\nEnsures that each HTML document contains a single canonical link element pointing to the preferred URL for that page. This rule helps with SEO by preventing duplicate content issues and clarifies the primary URL for search engines.\n\nAlso this rule enforces that your public URL does not end with a file extension (e.g. `.html`) or an index (`/index`). Each character in your URL is valuable real estate and you should not expose such implementation details in your URL.\n\n```diff\n  \u003c!doctype html\u003e\n  \u003chtml lang=\"en\"\u003e\n    \u003chead\u003e\n      \u003cmeta charset=\"utf-8\" /\u003e\n      \u003ctitle\u003eMy first website about horses\u003c/title\u003e\n+     \u003clink rel=\"canonical\" href=\"https://example.com/horses\" /\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n      This page is missing a required canonical link element in the head.\n    \u003c/body\u003e\n  \u003c/html\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/canonical-link\": \"error\"\n  }\n}\n```\n\n### Configuration options\n\nThis rule has no configurable options.\n\n### `nice-checkers/external-links`\n\nValidates that all external links are live and accessible. This rule helps maintain website quality by catching broken external links before they go live, improving user experience and SEO.\n\n**Note:** This rule automatically skips validation of:\n\n- `\u003clink rel=\"canonical\"\u003e` - Canonical URLs point to the site itself and may not be published yet during development/preview\n- `\u003clink rel=\"alternate\"\u003e` - Alternate language URLs also point to the site itself and may not exist during development\n\nThis allows you to validate your HTML before publishing, even when the canonical and alternate URLs reference the final production URLs.\n\n```diff\n- \u003ca href=\"https://wrong-subdomain.example.com\"\u003eThis link is broken\u003c/a\u003e\n+ \u003ca href=\"https://example.com/nonexistent-page\"\u003eThis link works\u003c/a\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/external-links\": [\n      \"error\",\n      {\n        \"proxyUrl\": \"\",\n        \"skipRegexes\": [\"://example.com\", \"://localhost\"],\n        \"cacheExpiryFoundSeconds\": 2592000,\n        \"cacheExpiryNotFoundSeconds\": 259200,\n        \"timeoutSeconds\": 5,\n        \"cacheDatabasePath\": \"cache/external-links.db\",\n        \"userAgent\": \"Mozilla/5.0 (compatible; html-validate-nice-checkers)\"\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option                          | Type       | Default                                                   | Description                                                |\n| ------------------------------- | ---------- | --------------------------------------------------------- | ---------------------------------------------------------- |\n| `proxyUrl`                      | `string`   | `\"\"`                                                      | Proxy URL to use for HTTP requests                         |\n| `skipRegexes`                   | `string[]` | `[]`                                                      | Array of regex patterns for URLs to skip checking          |\n| `cacheExpiryFoundSeconds`       | `number`   | `2592000`                                                 | Cache duration for successful checks (default: 30 days)    |\n| `cacheExpiryNotFoundSeconds`    | `number`   | `259200`                                                  | Cache duration for failed checks (default: 3 days)         |\n| `timeoutSeconds`                | `number`   | `5`                                                       | Request timeout in seconds                                 |\n| `cacheDatabasePath`             | `string`   | `\"cache/external-links.db\"`                               | Path to the cache database file                            |\n| `userAgent`                     | `string`   | `\"Mozilla/5.0 (compatible; html-validate-nice-checkers)\"` | User agent string for HTTP requests                        |\n| `manuallyReviewedPath`          | `string`   | `\"\"`                                                      | Path to CSV file with manually reviewed URLs (see below)   |\n| `manuallyReviewedExpirySeconds` | `number`   | `31536000`                                                | Expiry time for manually reviewed URLs (default: 365 days) |\n\n#### Manually reviewed URLs\n\nSome websites resist automated checking (anti-scraping, rate limiting, etc.). You can maintain a CSV file of manually reviewed URLs that should be treated as valid:\n\n**CSV format:**\n\n```csv\nurl,last_approved_timestamp\nhttps://anti-scraping-site.example.com/page,1764877136\nhttps://example.com/manually-verified,1764877136\n```\n\n- The first line must be the header: `url,last_approved_timestamp`\n- `url`: The exact URL to approve (must match exactly, including protocol and path)\n- `last_approved_timestamp`: Unix timestamp (seconds since epoch) when you last verified the URL\n\nURLs in this file are approved if:\n\n1. The URL matches exactly\n2. Current time \u003c (last_approved_timestamp + manuallyReviewedExpirySeconds)\n\nThis allows time-limited manual approvals that automatically expire, ensuring you periodically re-verify that URLs still exist.\n\n### `nice-checkers/https-links`\n\nReports insecure HTTP links that are accessible via HTTPS, encouraging the use of secure connections. This rule promotes security best practices by identifying opportunities to upgrade to HTTPS.\n\n```diff\n- \u003ca href=\"http://example.com/page\"\u003eShould use HTTPS\u003c/a\u003e\n- \u003cimg src=\"http://cdn.example.com/image.webp\" alt=\"Image\" /\u003e\n+ \u003ca href=\"https://example.com/page\"\u003eUses HTTPS\u003c/a\u003e\n+ \u003cimg src=\"https://cdn.example.com/image.webp\" alt=\"Image\" /\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/https-links\": [\n      \"warn\",\n      {\n        \"cacheExpiryFoundSeconds\": 2592000,\n        \"cacheExpiryNotFoundSeconds\": 259200,\n        \"timeoutSeconds\": 10,\n        \"cacheDatabasePath\": \"cache/https-availability.db\"\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option                       | Type     | Default                         | Description                                                   |\n| ---------------------------- | -------- | ------------------------------- | ------------------------------------------------------------- |\n| `cacheExpiryFoundSeconds`    | `number` | `2592000`                       | Cache duration for successful HTTPS checks (default: 30 days) |\n| `cacheExpiryNotFoundSeconds` | `number` | `259200`                        | Cache duration for failed HTTPS checks (default: 3 days)      |\n| `timeoutSeconds`             | `number` | `10`                            | Request timeout in seconds                                    |\n| `cacheDatabasePath`          | `string` | `\"cache/https-availability.db\"` | Path to the cache database file                               |\n\n### `nice-checkers/internal-links`\n\nValidates that all internal links point to existing files in your project. This rule prevents broken internal navigation and missing resource references.\n\n**Case-sensitive checking:** This rule performs case-sensitive file matching even on case-insensitive file systems (like macOS default). A link to `/abc.webp` will fail if the actual file is `/AbC.webp`, ensuring your code works correctly on Linux servers where case matters.\n\n```diff\n- \u003ca href=\"/nonexistent-page\"\u003eBroken internal link\u003c/a\u003e\n- \u003cimg src=\"../images/missing.webp\" alt=\"Missing image\" /\u003e\n- \u003ca href=\"/Logo.png\"\u003eWrong case (actual file: logo.png)\u003c/a\u003e\n+ \u003ca href=\"/about\"\u003eWorking internal link\u003c/a\u003e\n+ \u003cimg src=\"../images/logo.webp\" alt=\"Company logo\" /\u003e\n+ \u003ca href=\"/logo.png\"\u003eCorrect case\u003c/a\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/internal-links\": [\n      \"error\",\n      {\n        \"webRoot\": \"./build\",\n        \"alternativeExtensions\": [\".html\", \".php\"],\n        \"indexFile\": \"index.html\"\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option                  | Type       | Default        | Description                                 |\n| ----------------------- | ---------- | -------------- | ------------------------------------------- |\n| `webRoot`               | `string`   | `\"./build\"`    | Root directory for resolving absolute links |\n| `alternativeExtensions` | `string[]` | `[\".html\"]`    | Extensions to check for extensionless links |\n| `indexFile`             | `string`   | `\"index.html\"` | Default file to look for in directory links |\n\n### `nice-checkers/latest-packages`\n\nEnsures that package assets loaded from CDNs (like jsDelivr) are using the latest version and have proper SRI attributes. This rule promotes security and ensures you're using up-to-date packages.\n\n```diff\n- \u003c!-- Outdated package without SRI --\u003e\n- \u003cscript src=\"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js\"\u003e\u003c/script\u003e\n+ \u003c!-- Latest package with SRI --\u003e\n+ \u003cscript\n+   src=\"https://cdn.jsdelivr.net/npm/bootstrap@.../dist/js/bootstrap.min.js\"\n+   integrity=\"sha384-...\"\n+   crossorigin=\"anonymous\"\n+ \u003e\u003c/script\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/latest-packages\": [\n      \"warn\",\n      {\n        \"cacheExpirySeconds\": 172800,\n        \"timeoutSeconds\": 10,\n        \"cacheDatabasePath\": \"cache/latest-packages.db\",\n        \"skipUrlPatterns\": [\"googletagmanager.com\"]\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option               | Type       | Default                      | Description                                                 |\n| -------------------- | ---------- | ---------------------------- | ----------------------------------------------------------- |\n| `cacheExpirySeconds` | `number`   | `172800`                     | Cache duration for package version checks (default: 2 days) |\n| `timeoutSeconds`     | `number`   | `10`                         | Request timeout in seconds                                  |\n| `cacheDatabasePath`  | `string`   | `\"cache/latest-packages.db\"` | Path to the cache database file                             |\n| `skipUrlPatterns`    | `string[]` | `[]`                         | Array of URL patterns to skip checking                      |\n\n### `nice-checkers/match-regex`\n\nRequires page source to match all `mustMatch` regexes and none of the `mustNotMatch` regexes. This rule is off by default because it requires user-provided patterns.\n\nUse this to enforce that specific content or HTML elements are present on every page, or to forbid certain words or patterns. All patterns are evaluated with the `s` (dotAll) flag enabled, so they can match across multiple lines.\n\nWhen configuring via JSON, patterns must be given as strings. When configuring via JavaScript or TypeScript, each entry may be either a string or a `RegExp` instance. For `RegExp` inputs, all existing user flags are preserved and `s` is added if not already present.\n\nFor example, you might require a specific footer script on every page:\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/match-regex\": [\n      \"error\",\n      {\n        \"mustMatch\": [\n          \"\u003cscript src=\\\"/assets/global/site\\\\.js\\\\?[0-9a-f]+\\\" async\u003e\u003c/script\u003e\\\\s*\u003c/body\u003e\"\n        ],\n        \"mustNotMatch\": [\"naughty\"]\n      }\n    ]\n  }\n}\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/match-regex\": [\n      \"error\",\n      {\n        \"mustMatch\": [],\n        \"mustNotMatch\": []\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option         | Type                   | Default | Description                                  |\n| -------------- | ---------------------- | ------- | -------------------------------------------- |\n| `mustMatch`    | `(string \\| RegExp)[]` | `[]`    | Patterns that the page source must match     |\n| `mustNotMatch` | `(string \\| RegExp)[]` | `[]`    | Patterns that the page source must not match |\n\n### `nice-checkers/mailto-awesome`\n\nEnforces that `mailto:` links contain specific parameters to improve user experience. This rule ensures email links provide helpful context to users.\n\n```diff\n- \u003ca href=\"mailto:contact@example.com\"\u003eSend email\u003c/a\u003e\n+ \u003ca href=\"mailto:contact@example.com?subject=Website%20Inquiry\u0026body=Hello,%20I%20would%20like%20to...\"\u003eSend email\u003c/a\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/mailto-awesome\": [\n      \"error\",\n      {\n        \"requiredParameters\": [\"subject\", \"body\"]\n      }\n    ]\n  }\n}\n```\n\n### Configuration options\n\n| Option               | Type       | Default | Description                                                                  |\n| -------------------- | ---------- | ------- | ---------------------------------------------------------------------------- |\n| `requiredParameters` | `string[]` | `[]`    | Array of parameters that must be present (e.g., `[\"subject\", \"body\", \"cc\"]`) |\n\n### `nice-checkers/no-jquery`\n\nIf you are still using jQuery after 2022, please try to open your favorite chatbot and ask how to replace it with vanilla JavaScript. Your page will run faster. And it is very possible that your chatbot can do this entire operation in one go without interactive back-and-forth.\n\n```diff\n- \u003cscript src=\"https://code.jquery.com/jquery-3.6.0.min.js\"\u003e\u003c/script\u003e\n- \u003cscript src=\"../js/jquery.min.js\"\u003e\u003c/script\u003e\n```\n\n### Configuration\n\n```json\n{\n  \"rules\": {\n    \"nice-checkers/no-jquery\": \"error\"\n  }\n}\n```\n\n### Configuration options\n\nThis rule has no configurable options.\n\n### `nice-checkers/alternate-language-links`\n\nThis rule enforces best practices for alternate language links (`\u003clink rel=\"alternate\" hreflang=\"...\"\u003e`) in the `\u003chead\u003e` of HTML documents, as recommended by authoritative and established sources:\n\n- [Google Search Central: specify alternate language pages](https://developers.google.com/search/docs/specialty/international/localized-versions)\n- [W3C HTML Standard: link types](https://html.spec.whatwg.org/multipage/links.html#link-type-alternate)\n\nNote that these sources we reference have a conflict. One says that you may use relative URLs and the other says you must use fully qualified URLs. To be conservative, we require fully qualified URLs.\n\n**Activation:** this checker is only active if one or more `\u003clink rel=\"alternate\" hreflang=\"...\"\u003e` elements exist in the document `\u003chead\u003e`.\n\n**Checks performed:**\n\n1. **Self-link requirement:**\n   - There must be at least one `\u003clink rel=\"alternate\" hreflang=\"...\"\u003e` whose `href` exactly matches the canonical URL of the page.\n   - The `hreflang` of this self-link must match the page's `\u003chtml lang=\"...\"\u003e` attribute, if set.\n   - The canonical URL must exist (enforced by another checker).\n\n2. **Fully qualified URLs:**\n   - Every alternate language link must use a fully qualified URL (must include a scheme, e.g., `https://`).\n\n3. **Reciprocal linking:**\n   - Every alternate language page linked out to must reciprocate by linking back to the current page's canonical URL via its own `\u003clink rel=\"alternate\" hreflang=\"...\"\u003e`.\n   - The `hreflang` of the reciprocal link on the remote page must match the `\u003chtml lang=\"...\"\u003e` of the current page (if set).\n   - This is enforced by fetching the remote page and verifying its `\u003chead\u003e` contains the correct reciprocal link.\n\n**Example:**\n\n- The English page must link to itself and to the French page.\n- The French page (`https://example.com/page-fr`) must link back to the English canonical page, and the `hreflang` must match the English page’s `\u003chtml lang=\"en\"\u003e`.\n\n**References:**\n\n- [Google: specify alternate language pages](https://developers.google.com/search/docs/specialty/international/localized-versions)\n- [W3C: link type 'alternate'](https://html.spec.whatwg.org/multipage/links.html#link-type-alternate)\n\n## Disabled html-validate core rules\n\n`nice-checkers-plugin:recommended` explicitly turns off the following built-in html-validate rules because they conflict with common HTML minification tools.\n\n### `no-implicit-button-type` and `no-implicit-input-type`\n\nHTML minifiers such as [`@minify-html/node`](https://github.com/wilsonzlin/minify-html) strip the `type` attribute from `\u003cbutton\u003e` and `\u003cinput\u003e` elements when it equals the HTML-spec default value (e.g. `type=\"submit\"` on `\u003cbutton\u003e`, `type=\"text\"` on `\u003cinput\u003e`). This is valid per the spec and reduces page size, but it causes false-positive warnings from these two core rules when validating **minified** output.\n\n```js\nimport { minify } from '@minify-html/node'\n\nconst html = '\u003cbutton type=\"submit\"\u003eGo\u003c/button\u003e\u003cinput type=\"text\" name=\"q\"\u003e'\nconst minified = minify(Buffer.from(html), {\n  /* options */\n})\n// → \"\u003cbutton\u003eGo\u003c/button\u003e\u003cinput name=q\u003e\"\n// type=\"submit\" and type=\"text\" are stripped as they are HTML defaults\n```\n\nExtending `nice-checkers-plugin:recommended` disables both rules so that projects validating minified output do not need a workaround.\n\nIf you author your HTML by hand (i.e. you are **not** validating minified output) and want to enforce these rules, you can re-enable them explicitly in your own configuration:\n\n```json\n{\n  \"extends\": [\"htmlvalidate:recommended\", \"nice-checkers-plugin:recommended\"],\n  \"rules\": {\n    \"no-implicit-button-type\": \"error\",\n    \"no-implicit-input-type\": \"error\"\n  }\n}\n```\n\nSee [issue #23](https://github.com/fulldecent/html-validate-nice-checkers/issues/23) for the full discussion.\n\n## Development\n\nThis package is built with TypeScript and supports both ESM and CommonJS module systems. Thank you for contributing improvements to this project!\n\n:warning: Known issue: ESM and CommonnJS builds are [sometimes not building correctly](https://github.com/fulldecent/html-validate-nice-checkers/issues/6).\n\n### Install\n\n```sh\n# Clone the repository\ngit clone https://github.com/yourusername/html-validate-nice-checkers.git\ncd html-validate-nice-checkers\n\n# Setup Node, for example using nvm\nnvm use\n\n# Enable Yarn Berry\ncorepack enable\n\n# Install dependencies\nyarn install\n```\n\n### Hint: VS Code setup for Yarn Berry\n\nThese notes are [from the Yarn project](https://yarnpkg.com/getting-started/editor-sdks#).\n\n```sh\nyarn dlx @yarnpkg/sdks vscode\n```\n\nand YES, use workspace TypeScript version.\n\n### [Development scripts](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/package.json)\n\n- `yarn build` builds the package\n- `yarn build:watch` builds the package in watch mode\n- `yarn test` runs the tests once\n- `yarn test:watch` runs the tests in watch mode\n- `yarn test:coverage` runs the tests and generates a coverage report\n- `yarn lint` runs TypeScript type checking\n- `yarn format` formats all source files with Prettier\n\n### Testing notes\n\nWhen 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.\n\n## Publishing to [npm registry](https://www.npmjs.com/package/@fulldecent/nice-checkers-plugin)\n\n@fulldecent will periodically create a GitHub release and this triggers [the npm publish workflow](https://github.com/fulldecent/html-validate-nice-checkers/blob/main/.github/workflows/publish.yml).\n\n## Maintenance\n\nPeriodically, load schemaorg-current-https.jsonld file from \u003chttps://schema.org/docs/developers.html\u003e 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.\n\n## Browser support\n\nThis 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.\n\n## Contributing\n\nEnsure your changes pass `yarn format \u0026\u0026 yarn lint \u0026\u0026 yarn test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldecent%2Fhtml-validate-nice-checkers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffulldecent%2Fhtml-validate-nice-checkers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldecent%2Fhtml-validate-nice-checkers/lists"}