@lit-pigeon/lint 0.1.4 → 0.1.6
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 +47 -0
- package/package.json +21 -4
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @lit-pigeon/lint
|
|
2
|
+
|
|
3
|
+
Pre-flight QA for [Lit Pigeon](https://github.com/snxstudio/lit-pigeon)
|
|
4
|
+
documents. Catches the mistakes that break emails in the wild: missing image
|
|
5
|
+
alt text, low button contrast, links without an absolute `http(s)`, `mailto`
|
|
6
|
+
or `tel` URL, malformed merge tags, preview text length, likely spam-trigger
|
|
7
|
+
content, and empty rows. An async pass adds
|
|
8
|
+
network checks — total image weight and link reachability.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @lit-pigeon/lint
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { lintDocument, lintDocumentAsync } from '@lit-pigeon/lint';
|
|
20
|
+
|
|
21
|
+
// Synchronous — pure, fast, no network. Safe to run on every keystroke.
|
|
22
|
+
const report = lintDocument(doc);
|
|
23
|
+
console.log(report.summary); // { errors, warnings, infos }
|
|
24
|
+
for (const issue of report.issues) {
|
|
25
|
+
console.log(`${issue.severity} [${issue.rule}] ${issue.path}: ${issue.message}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Async — adds image-weight + link-reachability (uses global fetch by default).
|
|
29
|
+
const full = await lintDocumentAsync(doc, { timeoutMs: 5000 });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Compose a custom rule set by passing `{ rules }` (or `{ asyncRules }`). The
|
|
33
|
+
built-in rules are exported individually — `altTextRule`, `contrastRule`,
|
|
34
|
+
`linksRule`, `mergeTagsRule`, `spamScoreRule`, `previewTextRule`,
|
|
35
|
+
`emptyContentRule`, `imageWeightRule`, `linkReachabilityRule` — alongside the
|
|
36
|
+
`defaultRules` and `defaultAsyncRules` arrays. These checks are also exposed as
|
|
37
|
+
`/lint` and `/lint/async` endpoints by [`@lit-pigeon/rest`](../rest).
|
|
38
|
+
|
|
39
|
+
Hero blocks have no alt text field, so `alt-text/missing` is always reported
|
|
40
|
+
for them; filter that rule for hero blocks if you gate sending on errors. See
|
|
41
|
+
[Server-side](../../docs/guide/server-side.md#lit-pigeonlint).
|
|
42
|
+
|
|
43
|
+
Part of [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) — open-source drag-and-drop email editor.
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-pigeon/lint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Pre-flight QA for Lit Pigeon documents — alt text, contrast, link, merge-tag, spam-score, image-weight, and link-reachability checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
17
19
|
],
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@lit-pigeon/core": "^0.
|
|
21
|
+
"@lit-pigeon/core": "^0.4.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@types/node": "^25.9.1",
|
|
23
25
|
"typescript": "^5.5.0",
|
|
24
|
-
"vitest": "^
|
|
26
|
+
"vitest": "^4.1.12"
|
|
25
27
|
},
|
|
26
28
|
"publishConfig": {
|
|
27
29
|
"access": "public"
|
|
@@ -32,6 +34,21 @@
|
|
|
32
34
|
"directory": "packages/lint"
|
|
33
35
|
},
|
|
34
36
|
"license": "MIT",
|
|
37
|
+
"homepage": "https://github.com/snxstudio/lit-pigeon/tree/main/packages/lint#readme",
|
|
38
|
+
"bugs": "https://github.com/snxstudio/lit-pigeon/issues",
|
|
39
|
+
"author": "Lit Pigeon Contributors",
|
|
40
|
+
"keywords": [
|
|
41
|
+
"email",
|
|
42
|
+
"email-template",
|
|
43
|
+
"email-editor",
|
|
44
|
+
"mjml",
|
|
45
|
+
"html-email",
|
|
46
|
+
"lit",
|
|
47
|
+
"web-components",
|
|
48
|
+
"lint",
|
|
49
|
+
"accessibility",
|
|
50
|
+
"qa"
|
|
51
|
+
],
|
|
35
52
|
"scripts": {
|
|
36
53
|
"build": "tsc",
|
|
37
54
|
"dev": "tsc -w",
|