@riebeckite/plugin-quality 0.0.12 → 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 +69 -69
- package/README_ja.md +59 -59
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# @riebeckite/plugin-quality
|
|
2
|
-
|
|
3
|
-
Static quality and accessibility inspection for generated HTML in Riebeckite.
|
|
4
|
-
|
|
5
|
-
[日本語](./README_ja.md)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
`qualityPlugin()` runs a small set of dependency-free, regex-based rules over
|
|
10
|
-
the HTML produced by the build and reports the findings through the shared
|
|
11
|
-
diagnostics channel. There is no DOM, no axe-core, and no headless browser.
|
|
12
|
-
|
|
13
|
-
At the manifest stage the plugin inspects each public entry's rendered article
|
|
14
|
-
HTML. Integrations that finish HTML generation can additionally call the
|
|
15
|
-
exported `inspectGeneratedHtml` hook for final pages.
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { defineConfig } from "@riebeckite/core";
|
|
21
|
-
import { qualityPlugin } from "@riebeckite/plugin-quality";
|
|
22
|
-
|
|
23
|
-
export default defineConfig({
|
|
24
|
-
// ...
|
|
25
|
-
plugins: [qualityPlugin({ failOn: "error" })],
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Options
|
|
30
|
-
|
|
31
|
-
| Option | Type | Description |
|
|
32
|
-
| ------ | ---- | ----------- |
|
|
33
|
-
| `ignoreRules` | `string[]` | Diagnostic codes to suppress (for example `"quality:empty-link-text"`). |
|
|
34
|
-
| `a11y` | `{ enabled?: boolean }` | Accessibility inspection. Defaults to enabled; set `enabled: false` to disable every rule. |
|
|
35
|
-
| `failOn` | `"error" \| "never"` | Throw on the first build with an error-severity diagnostic during the manifest stage. Defaults to `"never"`. |
|
|
36
|
-
|
|
37
|
-
## Rules
|
|
38
|
-
|
|
39
|
-
| Code | Severity | Description |
|
|
40
|
-
| ---- | -------- | ----------- |
|
|
41
|
-
| `quality:img-alt-missing` | warning | `<img>` without an `alt` attribute. `alt=""` is valid for decorative images. |
|
|
42
|
-
| `quality:duplicate-id` | error | The same `id` value used more than once. |
|
|
43
|
-
| `quality:broken-internal-anchor` | warning | `href="#foo"` with no matching `id="foo"` in the document. |
|
|
44
|
-
| `quality:heading-order` | warning | Skipped heading levels (for example `h1` → `h3`) or headings without any `h1`. |
|
|
45
|
-
| `quality:empty-link-text` | warning | `<a href>` with empty text and no `aria-label`, `title`, or non-empty `img[alt]`. |
|
|
46
|
-
| `quality:html-lang-missing` | warning | `<html>` without a non-empty `lang` attribute (full documents only). |
|
|
47
|
-
| `quality:table-no-header` | warning | `<table>` with data cells but no `<th>`, `scope`, or `headers`. |
|
|
48
|
-
|
|
49
|
-
## API
|
|
50
|
-
|
|
51
|
-
- `qualityPlugin(options?)` — plugin factory.
|
|
52
|
-
- `inspectHtml(html, options?)` — pure function returning `Diagnostic[]`.
|
|
53
|
-
- `inspectGeneratedHtml(page, options?)` — pure function that inspects a final
|
|
54
|
-
page and sets `filePath` to `page.path`.
|
|
55
|
-
- `RULE_CODES` — the stable code identifiers.
|
|
56
|
-
- Types: `QualityOptions`, `InspectOptions`.
|
|
57
|
-
|
|
58
|
-
## Limitations
|
|
59
|
-
|
|
60
|
-
The scanner is regex-based, not a real DOM. It does not validate malformed
|
|
61
|
-
markup, does not track nesting depth, and only handles well-formed, non-nested
|
|
62
|
-
elements when pairing an open tag with its close tag. Comments and
|
|
63
|
-
`<script>`/`<style>` contents are masked before scanning. Rules that depend on
|
|
64
|
-
document structure (heading order, table headers) can therefore miss or
|
|
65
|
-
misattribute findings in unusual markup.
|
|
66
|
-
|
|
67
|
-
## See also
|
|
68
|
-
|
|
69
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
1
|
+
# @riebeckite/plugin-quality
|
|
2
|
+
|
|
3
|
+
Static quality and accessibility inspection for generated HTML in Riebeckite.
|
|
4
|
+
|
|
5
|
+
[日本語](./README_ja.md)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`qualityPlugin()` runs a small set of dependency-free, regex-based rules over
|
|
10
|
+
the HTML produced by the build and reports the findings through the shared
|
|
11
|
+
diagnostics channel. There is no DOM, no axe-core, and no headless browser.
|
|
12
|
+
|
|
13
|
+
At the manifest stage the plugin inspects each public entry's rendered article
|
|
14
|
+
HTML. Integrations that finish HTML generation can additionally call the
|
|
15
|
+
exported `inspectGeneratedHtml` hook for final pages.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { defineConfig } from "@riebeckite/core";
|
|
21
|
+
import { qualityPlugin } from "@riebeckite/plugin-quality";
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
// ...
|
|
25
|
+
plugins: [qualityPlugin({ failOn: "error" })],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Options
|
|
30
|
+
|
|
31
|
+
| Option | Type | Description |
|
|
32
|
+
| ------ | ---- | ----------- |
|
|
33
|
+
| `ignoreRules` | `string[]` | Diagnostic codes to suppress (for example `"quality:empty-link-text"`). |
|
|
34
|
+
| `a11y` | `{ enabled?: boolean }` | Accessibility inspection. Defaults to enabled; set `enabled: false` to disable every rule. |
|
|
35
|
+
| `failOn` | `"error" \| "never"` | Throw on the first build with an error-severity diagnostic during the manifest stage. Defaults to `"never"`. |
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
| Code | Severity | Description |
|
|
40
|
+
| ---- | -------- | ----------- |
|
|
41
|
+
| `quality:img-alt-missing` | warning | `<img>` without an `alt` attribute. `alt=""` is valid for decorative images. |
|
|
42
|
+
| `quality:duplicate-id` | error | The same `id` value used more than once. |
|
|
43
|
+
| `quality:broken-internal-anchor` | warning | `href="#foo"` with no matching `id="foo"` in the document. |
|
|
44
|
+
| `quality:heading-order` | warning | Skipped heading levels (for example `h1` → `h3`) or headings without any `h1`. |
|
|
45
|
+
| `quality:empty-link-text` | warning | `<a href>` with empty text and no `aria-label`, `title`, or non-empty `img[alt]`. |
|
|
46
|
+
| `quality:html-lang-missing` | warning | `<html>` without a non-empty `lang` attribute (full documents only). |
|
|
47
|
+
| `quality:table-no-header` | warning | `<table>` with data cells but no `<th>`, `scope`, or `headers`. |
|
|
48
|
+
|
|
49
|
+
## API
|
|
50
|
+
|
|
51
|
+
- `qualityPlugin(options?)` — plugin factory.
|
|
52
|
+
- `inspectHtml(html, options?)` — pure function returning `Diagnostic[]`.
|
|
53
|
+
- `inspectGeneratedHtml(page, options?)` — pure function that inspects a final
|
|
54
|
+
page and sets `filePath` to `page.path`.
|
|
55
|
+
- `RULE_CODES` — the stable code identifiers.
|
|
56
|
+
- Types: `QualityOptions`, `InspectOptions`.
|
|
57
|
+
|
|
58
|
+
## Limitations
|
|
59
|
+
|
|
60
|
+
The scanner is regex-based, not a real DOM. It does not validate malformed
|
|
61
|
+
markup, does not track nesting depth, and only handles well-formed, non-nested
|
|
62
|
+
elements when pairing an open tag with its close tag. Comments and
|
|
63
|
+
`<script>`/`<style>` contents are masked before scanning. Rules that depend on
|
|
64
|
+
document structure (heading order, table headers) can therefore miss or
|
|
65
|
+
misattribute findings in unusual markup.
|
|
66
|
+
|
|
67
|
+
## See also
|
|
68
|
+
|
|
69
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# @riebeckite/plugin-quality
|
|
2
|
-
|
|
3
|
-
Riebeckite が生成する HTML を静的に検査し、品質とアクセシビリティの問題を報告するプラグインです。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## 概要
|
|
8
|
-
|
|
9
|
-
`qualityPlugin()` は、ビルドで生成された HTML に対して依存パッケージなしの正規表現ベースのルールを実行し、結果を既存の diagnostics に流します。DOM も axe-core もヘッドレスブラウザも使いません。
|
|
10
|
-
|
|
11
|
-
マニフェスト生成の段階では、公開エントリごとの記事 HTML を検査します。HTML 生成を完了する統合側は、公開ページ向けに公開 API の `inspectGeneratedHtml` を追加で呼び出せます。
|
|
12
|
-
|
|
13
|
-
## 使い方
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { defineConfig } from "@riebeckite/core";
|
|
17
|
-
import { qualityPlugin } from "@riebeckite/plugin-quality";
|
|
18
|
-
|
|
19
|
-
export default defineConfig({
|
|
20
|
-
// ...
|
|
21
|
-
plugins: [qualityPlugin({ failOn: "error" })],
|
|
22
|
-
});
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## オプション
|
|
26
|
-
|
|
27
|
-
| オプション | 型 | 説明 |
|
|
28
|
-
| ---------- | -- | ---- |
|
|
29
|
-
| `ignoreRules` | `string[]` | 抑制する diagnostic の code(例: `"quality:empty-link-text"`)。 |
|
|
30
|
-
| `a11y` | `{ enabled?: boolean }` | アクセシビリティ検査。既定は有効で、`enabled: false` で全ルールを止めます。 |
|
|
31
|
-
| `failOn` | `"error" \| "never"` | マニフェスト段階で error の diagnostic があればビルドを失敗させます。既定は `"never"`。 |
|
|
32
|
-
|
|
33
|
-
## ルール一覧
|
|
34
|
-
|
|
35
|
-
| Code | 重大度 | 内容 |
|
|
36
|
-
| ---- | ------ | ---- |
|
|
37
|
-
| `quality:img-alt-missing` | warning | `alt` のない `<img>`。装飾画像の `alt=""` は対象外です。 |
|
|
38
|
-
| `quality:duplicate-id` | error | 同じ `id` が同一文書内で複数回使われています。 |
|
|
39
|
-
| `quality:broken-internal-anchor` | warning | `href="#foo"` に対応する `id="foo"` が文書内にありません。 |
|
|
40
|
-
| `quality:heading-order` | warning | 見出しレベルの飛び(`h1` → `h3` など)、または `h1` が1つもない状態。 |
|
|
41
|
-
| `quality:empty-link-text` | warning | テキストが空で、`aria-label`・`title`・alt 付き `img` もない `<a href>`。 |
|
|
42
|
-
| `quality:html-lang-missing` | warning | 空でない `lang` を持たない `<html>`(完全な文書のみ)。 |
|
|
43
|
-
| `quality:table-no-header` | warning | データセルはあるが `<th>`・`scope`・`headers` がない `<table>`。 |
|
|
44
|
-
|
|
45
|
-
## API
|
|
46
|
-
|
|
47
|
-
- `qualityPlugin(options?)` — プラグインファクトリ。
|
|
48
|
-
- `inspectHtml(html, options?)` — `Diagnostic[]` を返す純粋関数。
|
|
49
|
-
- `inspectGeneratedHtml(page, options?)` — 最終ページを検査し、`filePath` に `page.path` を設定する純粋関数。
|
|
50
|
-
- `RULE_CODES` — 安定した code の一覧。
|
|
51
|
-
- 型: `QualityOptions`、`InspectOptions`。
|
|
52
|
-
|
|
53
|
-
## 制限事項
|
|
54
|
-
|
|
55
|
-
スキャナは正規表現ベースであり、実際の DOM ではありません。不正なマークアップの検証やネストの深さの追跡は行わず、開始タグと終了タグの対応付けは整形式でネストのない要素だけを扱います。走査の前にコメントと `<script>`・`<style>` の中身はマスクします。そのため、文書構造に依存するルール(見出し順、テーブルヘッダー)は、特殊なマークアップでは検出漏れや誤検出が起こりえます。
|
|
56
|
-
|
|
57
|
-
## 関連
|
|
58
|
-
|
|
59
|
-
- [プラグインガイド](../../../docs/ja/plugin-
|
|
1
|
+
# @riebeckite/plugin-quality
|
|
2
|
+
|
|
3
|
+
Riebeckite が生成する HTML を静的に検査し、品質とアクセシビリティの問題を報告するプラグインです。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## 概要
|
|
8
|
+
|
|
9
|
+
`qualityPlugin()` は、ビルドで生成された HTML に対して依存パッケージなしの正規表現ベースのルールを実行し、結果を既存の diagnostics に流します。DOM も axe-core もヘッドレスブラウザも使いません。
|
|
10
|
+
|
|
11
|
+
マニフェスト生成の段階では、公開エントリごとの記事 HTML を検査します。HTML 生成を完了する統合側は、公開ページ向けに公開 API の `inspectGeneratedHtml` を追加で呼び出せます。
|
|
12
|
+
|
|
13
|
+
## 使い方
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { defineConfig } from "@riebeckite/core";
|
|
17
|
+
import { qualityPlugin } from "@riebeckite/plugin-quality";
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
// ...
|
|
21
|
+
plugins: [qualityPlugin({ failOn: "error" })],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## オプション
|
|
26
|
+
|
|
27
|
+
| オプション | 型 | 説明 |
|
|
28
|
+
| ---------- | -- | ---- |
|
|
29
|
+
| `ignoreRules` | `string[]` | 抑制する diagnostic の code(例: `"quality:empty-link-text"`)。 |
|
|
30
|
+
| `a11y` | `{ enabled?: boolean }` | アクセシビリティ検査。既定は有効で、`enabled: false` で全ルールを止めます。 |
|
|
31
|
+
| `failOn` | `"error" \| "never"` | マニフェスト段階で error の diagnostic があればビルドを失敗させます。既定は `"never"`。 |
|
|
32
|
+
|
|
33
|
+
## ルール一覧
|
|
34
|
+
|
|
35
|
+
| Code | 重大度 | 内容 |
|
|
36
|
+
| ---- | ------ | ---- |
|
|
37
|
+
| `quality:img-alt-missing` | warning | `alt` のない `<img>`。装飾画像の `alt=""` は対象外です。 |
|
|
38
|
+
| `quality:duplicate-id` | error | 同じ `id` が同一文書内で複数回使われています。 |
|
|
39
|
+
| `quality:broken-internal-anchor` | warning | `href="#foo"` に対応する `id="foo"` が文書内にありません。 |
|
|
40
|
+
| `quality:heading-order` | warning | 見出しレベルの飛び(`h1` → `h3` など)、または `h1` が1つもない状態。 |
|
|
41
|
+
| `quality:empty-link-text` | warning | テキストが空で、`aria-label`・`title`・alt 付き `img` もない `<a href>`。 |
|
|
42
|
+
| `quality:html-lang-missing` | warning | 空でない `lang` を持たない `<html>`(完全な文書のみ)。 |
|
|
43
|
+
| `quality:table-no-header` | warning | データセルはあるが `<th>`・`scope`・`headers` がない `<table>`。 |
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
- `qualityPlugin(options?)` — プラグインファクトリ。
|
|
48
|
+
- `inspectHtml(html, options?)` — `Diagnostic[]` を返す純粋関数。
|
|
49
|
+
- `inspectGeneratedHtml(page, options?)` — 最終ページを検査し、`filePath` に `page.path` を設定する純粋関数。
|
|
50
|
+
- `RULE_CODES` — 安定した code の一覧。
|
|
51
|
+
- 型: `QualityOptions`、`InspectOptions`。
|
|
52
|
+
|
|
53
|
+
## 制限事項
|
|
54
|
+
|
|
55
|
+
スキャナは正規表現ベースであり、実際の DOM ではありません。不正なマークアップの検証やネストの深さの追跡は行わず、開始タグと終了タグの対応付けは整形式でネストのない要素だけを扱います。走査の前にコメントと `<script>`・`<style>` の中身はマスクします。そのため、文書構造に依存するルール(見出し順、テーブルヘッダー)は、特殊なマークアップでは検出漏れや誤検出が起こりえます。
|
|
56
|
+
|
|
57
|
+
## 関連
|
|
58
|
+
|
|
59
|
+
- [プラグインガイド](../../../docs/ja/reference/plugin-api.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-quality",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@riebeckite/core": "0.0.
|
|
17
|
+
"@riebeckite/core": "0.0.14"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsx": "^4.22.4"
|