@nuasite/checks 0.17.2 → 0.18.0

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.
Files changed (2) hide show
  1. package/README.md +79 -79
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,11 +18,11 @@ The package expects `typescript@^5` as a peer dependency.
18
18
  Add the integration to your Astro config:
19
19
 
20
20
  ```ts
21
- import { defineConfig } from 'astro/config'
22
21
  import checks from '@nuasite/checks'
22
+ import { defineConfig } from 'astro/config'
23
23
 
24
24
  export default defineConfig({
25
- integrations: [checks()],
25
+ integrations: [checks()],
26
26
  })
27
27
  ```
28
28
 
@@ -35,19 +35,19 @@ Pass an options object to customise behaviour:
35
35
 
36
36
  ```ts
37
37
  checks({
38
- mode: 'essential', // 'auto' | 'full' | 'essential'
39
- seo: { titleMaxLength: 70 },
40
- geo: { minContentLength: 500 },
41
- performance: { maxHtmlSize: 200_000 },
42
- accessibility: true,
43
- ai: false, // AI-powered checks (requires API key)
44
- failOnError: true,
45
- failOnWarning: false,
46
- reportJson: true, // writes checks-report.json to dist
47
- overrides: {
48
- 'seo/title-missing': 'warning', // downgrade to warning
49
- 'seo/noindex-detected': false, // disable entirely
50
- },
38
+ mode: 'essential', // 'auto' | 'full' | 'essential'
39
+ seo: { titleMaxLength: 70 },
40
+ geo: { minContentLength: 500 },
41
+ performance: { maxHtmlSize: 200_000 },
42
+ accessibility: true,
43
+ ai: false, // AI-powered checks (requires API key)
44
+ failOnError: true,
45
+ failOnWarning: false,
46
+ reportJson: true, // writes checks-report.json to dist
47
+ overrides: {
48
+ 'seo/title-missing': 'warning', // downgrade to warning
49
+ 'seo/noindex-detected': false, // disable entirely
50
+ },
51
51
  })
52
52
  ```
53
53
 
@@ -61,72 +61,72 @@ checks({ performance: false })
61
61
 
62
62
  ### Check modes
63
63
 
64
- | Mode | Behaviour |
65
- | ----------- | ------------------------------------------------ |
66
- | `auto` | Runs `essential` locally, `full` in CI |
67
- | `essential` | Only checks marked as essential |
68
- | `full` | Runs every registered check |
64
+ | Mode | Behaviour |
65
+ | ----------- | -------------------------------------- |
66
+ | `auto` | Runs `essential` locally, `full` in CI |
67
+ | `essential` | Only checks marked as essential |
68
+ | `full` | Runs every registered check |
69
69
 
70
70
  ## Built-in checks
71
71
 
72
72
  ### SEO
73
73
 
74
- | Check | Description |
75
- | ----- | ----------- |
76
- | `seo/title-missing` | Page has no `<title>` tag |
77
- | `seo/title-empty` | `<title>` is empty |
78
- | `seo/title-length` | Title exceeds max length |
79
- | `seo/description-missing` | No meta description |
80
- | `seo/description-length` | Description outside min/max range |
81
- | `seo/canonical-missing` | No canonical link |
82
- | `seo/canonical-invalid` | Canonical URL is malformed |
83
- | `seo/canonical-mismatch` | Canonical doesn't match page URL |
84
- | `seo/json-ld-invalid` | Invalid JSON-LD structured data |
85
- | `seo/multiple-h1` | More than one `<h1>` on a page |
86
- | `seo/no-h1` | No `<h1>` on a page |
87
- | `seo/heading-skip` | Heading levels are skipped (e.g. h2 → h4) |
88
- | `seo/og-title` | Missing Open Graph title |
89
- | `seo/og-description` | Missing Open Graph description |
90
- | `seo/og-image` | Missing Open Graph image |
91
- | `seo/image-alt-missing` | Image without alt attribute |
92
- | `seo/image-alt-quality` | Alt text is generic or unhelpful |
93
- | `seo/meta-duplicate` | Duplicate meta tags |
94
- | `seo/viewport-missing` | No viewport meta tag |
95
- | `seo/noindex-detected` | Page has a noindex directive |
96
- | `seo/twitter-card` | Missing Twitter Card meta tags |
97
- | `seo/robots-txt` | Missing or invalid robots.txt (site-level) |
98
- | `seo/sitemap-xml` | Missing sitemap.xml (site-level) |
74
+ | Check | Description |
75
+ | --------------------------- | ------------------------------------------------------------ |
76
+ | `seo/title-missing` | Page has no `<title>` tag |
77
+ | `seo/title-empty` | `<title>` is empty |
78
+ | `seo/title-length` | Title exceeds max length |
79
+ | `seo/description-missing` | No meta description |
80
+ | `seo/description-length` | Description outside min/max range |
81
+ | `seo/canonical-missing` | No canonical link |
82
+ | `seo/canonical-invalid` | Canonical URL is malformed |
83
+ | `seo/canonical-mismatch` | Canonical doesn't match page URL |
84
+ | `seo/json-ld-invalid` | Invalid JSON-LD structured data |
85
+ | `seo/multiple-h1` | More than one `<h1>` on a page |
86
+ | `seo/no-h1` | No `<h1>` on a page |
87
+ | `seo/heading-skip` | Heading levels are skipped (e.g. h2 → h4) |
88
+ | `seo/og-title` | Missing Open Graph title |
89
+ | `seo/og-description` | Missing Open Graph description |
90
+ | `seo/og-image` | Missing Open Graph image |
91
+ | `seo/image-alt-missing` | Image without alt attribute |
92
+ | `seo/image-alt-quality` | Alt text is generic or unhelpful |
93
+ | `seo/meta-duplicate` | Duplicate meta tags |
94
+ | `seo/viewport-missing` | No viewport meta tag |
95
+ | `seo/noindex-detected` | Page has a noindex directive |
96
+ | `seo/twitter-card` | Missing Twitter Card meta tags |
97
+ | `seo/robots-txt` | Missing or invalid robots.txt (site-level) |
98
+ | `seo/sitemap-xml` | Missing sitemap.xml (site-level) |
99
99
  | `seo/broken-internal-links` | Internal links that point to non-existent pages (site-level) |
100
100
 
101
101
  ### GEO
102
102
 
103
- | Check | Description |
104
- | ----- | ----------- |
105
- | `geo/content-too-short` | Page body text below minimum length |
103
+ | Check | Description |
104
+ | --------------------------- | ----------------------------------- |
105
+ | `geo/content-too-short` | Page body text below minimum length |
106
106
  | `geo/insufficient-headings` | Too few headings for content length |
107
- | `geo/llms-txt` | Missing llms.txt file (site-level) |
107
+ | `geo/llms-txt` | Missing llms.txt file (site-level) |
108
108
 
109
109
  ### Performance
110
110
 
111
- | Check | Description |
112
- | ----- | ----------- |
113
- | `perf/html-size` | HTML document exceeds size limit |
114
- | `perf/image-format` | Images not using modern formats (WebP/AVIF) |
115
- | `perf/image-size` | Image files exceed size limit |
116
- | `perf/lazy-loading` | Above-the-fold images missing lazy loading |
111
+ | Check | Description |
112
+ | ----------------------------- | ------------------------------------------- |
113
+ | `perf/html-size` | HTML document exceeds size limit |
114
+ | `perf/image-format` | Images not using modern formats (WebP/AVIF) |
115
+ | `perf/image-size` | Image files exceed size limit |
116
+ | `perf/lazy-loading` | Above-the-fold images missing lazy loading |
117
117
  | `perf/render-blocking-script` | Render-blocking scripts without async/defer |
118
- | `perf/inline-size` | Inline scripts/styles exceed size limit |
119
- | `perf/total-requests` | Too many external resource requests |
118
+ | `perf/inline-size` | Inline scripts/styles exceed size limit |
119
+ | `perf/total-requests` | Too many external resource requests |
120
120
 
121
121
  ### Accessibility
122
122
 
123
- | Check | Description |
124
- | ----- | ----------- |
125
- | `a11y/lang-attribute` | Missing `lang` attribute on `<html>` |
126
- | `a11y/form-label` | Form inputs without associated labels |
127
- | `a11y/aria-landmarks` | Missing ARIA landmark regions |
128
- | `a11y/link-text` | Links with non-descriptive text ("click here") |
129
- | `a11y/tabindex` | Positive tabindex values that break tab order |
123
+ | Check | Description |
124
+ | --------------------- | ---------------------------------------------- |
125
+ | `a11y/lang-attribute` | Missing `lang` attribute on `<html>` |
126
+ | `a11y/form-label` | Form inputs without associated labels |
127
+ | `a11y/aria-landmarks` | Missing ARIA landmark regions |
128
+ | `a11y/link-text` | Links with non-descriptive text ("click here") |
129
+ | `a11y/tabindex` | Positive tabindex values that break tab order |
130
130
 
131
131
  ## Custom checks
132
132
 
@@ -136,19 +136,19 @@ Register your own checks alongside the built-ins:
136
136
  import type { Check } from '@nuasite/checks'
137
137
 
138
138
  const noTodoCheck: Check = {
139
- kind: 'page',
140
- id: 'custom/no-todo',
141
- name: 'No TODO in production',
142
- domain: 'seo',
143
- defaultSeverity: 'warning',
144
- description: 'Flags pages that still contain TODO markers',
145
- essential: false,
146
- run({ html }) {
147
- if (html.includes('TODO')) {
148
- return [{ message: 'Page contains a TODO marker' }]
149
- }
150
- return []
151
- },
139
+ kind: 'page',
140
+ id: 'custom/no-todo',
141
+ name: 'No TODO in production',
142
+ domain: 'seo',
143
+ defaultSeverity: 'warning',
144
+ description: 'Flags pages that still contain TODO markers',
145
+ essential: false,
146
+ run({ html }) {
147
+ if (html.includes('TODO')) {
148
+ return [{ message: 'Page contains a TODO marker' }]
149
+ }
150
+ return []
151
+ },
152
152
  }
153
153
 
154
154
  checks({ customChecks: [noTodoCheck] })
@@ -160,8 +160,8 @@ Enable `reportJson` to write a machine-readable report to your dist directory
160
160
  after every build:
161
161
 
162
162
  ```ts
163
- checks({ reportJson: true }) // → dist/checks-report.json
164
- checks({ reportJson: 'my-report.json' }) // → dist/my-report.json
163
+ checks({ reportJson: true }) // → dist/checks-report.json
164
+ checks({ reportJson: 'my-report.json' }) // → dist/my-report.json
165
165
  ```
166
166
 
167
167
  ## Development
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/checks"
13
13
  },
14
14
  "license": "Apache-2.0",
15
- "version": "0.17.2",
15
+ "version": "0.18.0",
16
16
  "module": "src/index.ts",
17
17
  "types": "src/index.ts",
18
18
  "type": "module",