c3b-lint 0.0.13 → 0.0.14
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 +1 -1
- package/check/html.js +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ markdown that a tool can check, with one command and one config to install. It r
|
|
|
19
19
|
`og:image`, `twitter:card`, one SVG favicon; a `noindex` page is excused the canonical and social tags), no external
|
|
20
20
|
stylesheets (webfonts are self-hosted), stylesheet order (`reset`, `tokens`, `main`, …, page file last),
|
|
21
21
|
the skip-link rule (`<a id="skip-link" href="#main">` first in `<body>` when there is a header or nav, absent
|
|
22
|
-
otherwise, `<main id="main">`), one `<h1>`, `alt` on every image, no inline handlers, no `<style>` or `style=""`
|
|
22
|
+
otherwise, landing on `<main id="main">` — or on the id `<main>` already has), one `<h1>`, `alt` on every image, no inline handlers, no `<style>` or `style=""`
|
|
23
23
|
(except a JS-driven custom property), relative paths only (a Barba site's links outside its container — header, menu — stay root-relative), kebab-case ids and classes, no duplicate ids,
|
|
24
24
|
`integrity` on CDN scripts.
|
|
25
25
|
5. **Project structure**: singular directory names, lowercase kebab-case asset names (and no camera exports), and,
|
package/check/html.js
CHANGED
|
@@ -151,11 +151,14 @@ function checkPage(report, file, source) {
|
|
|
151
151
|
const skipLink = first && first.tagName === 'a' && attr(first, 'id') === 'skip-link';
|
|
152
152
|
const main = all.find((el) => el.name === 'main');
|
|
153
153
|
if (hasChrome) {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
// The skip link lands on <main> by its id: "main" by default, or the id <main> already has
|
|
155
|
+
// (a Barba site scopes each page's CSS by it)
|
|
156
|
+
const target = main && attr(main, 'id');
|
|
157
|
+
if (!target) {
|
|
158
|
+
report.error(file, '<main> carries an id for the skip link to land on (id="main", or the one it already has)');
|
|
156
159
|
}
|
|
157
|
-
if (!
|
|
158
|
-
report.error(file,
|
|
160
|
+
if (!skipLink || attr(first, 'href') !== `#${ target || 'main' }`) {
|
|
161
|
+
report.error(file, `a page with a header or nav starts <body> with <a id="skip-link" href="#${ target || 'main' }">`);
|
|
159
162
|
}
|
|
160
163
|
} else if (skipLink) {
|
|
161
164
|
report.error(at(first), 'a page with no header or nav has no skip link');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c3b-lint",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Lints a co:lab project against the rules a tool can check: ESLint, Stylelint, the 500-line limit and the shared .editorconfig; --init writes the config files.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"type": "module",
|