@lit-pigeon/lint 0.1.4 → 0.1.5
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 +42 -0
- package/package.json +20 -3
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
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 text/background contrast, links without an `href`, undefined
|
|
6
|
+
merge tags, likely spam-trigger content, and empty blocks. An async pass adds
|
|
7
|
+
network checks — total image weight and link reachability.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @lit-pigeon/lint
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { lintDocument, lintDocumentAsync } from '@lit-pigeon/lint';
|
|
19
|
+
|
|
20
|
+
// Synchronous — pure, fast, no network. Safe to run on every keystroke.
|
|
21
|
+
const report = lintDocument(doc);
|
|
22
|
+
console.log(report.summary); // { errors, warnings, infos }
|
|
23
|
+
for (const issue of report.issues) {
|
|
24
|
+
console.log(`${issue.severity} [${issue.rule}] ${issue.path}: ${issue.message}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Async — adds image-weight + link-reachability (uses global fetch by default).
|
|
28
|
+
const full = await lintDocumentAsync(doc, { timeoutMs: 5000 });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Compose a custom rule set by passing `{ rules }` (or `{ asyncRules }`). The
|
|
32
|
+
built-in rules are exported individually — `altTextRule`, `contrastRule`,
|
|
33
|
+
`linksRule`, `mergeTagsRule`, `spamScoreRule`, `previewTextRule`,
|
|
34
|
+
`emptyContentRule`, `imageWeightRule`, `linkReachabilityRule` — alongside the
|
|
35
|
+
`defaultRules` and `defaultAsyncRules` arrays. These checks are also exposed as
|
|
36
|
+
`/lint` and `/lint/async` endpoints by [`@lit-pigeon/rest`](../rest).
|
|
37
|
+
|
|
38
|
+
Part of [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) — open-source drag-and-drop email editor.
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
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.5",
|
|
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,10 +13,12 @@
|
|
|
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.3.
|
|
21
|
+
"@lit-pigeon/core": "^0.3.1"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@types/node": "^25.9.1",
|
|
@@ -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",
|