@glion/lint-segment-header-length 0.26.0 → 0.27.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.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ PID1|1||PATID1234^^^HOSP^MR||DOE^JANE||19800101|F
|
|
|
72
72
|
Reported message:
|
|
73
73
|
|
|
74
74
|
```
|
|
75
|
-
The Segment ID
|
|
75
|
+
The Segment ID is 4 characters long; a Segment ID must be exactly 3 characters.
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
A two-character segment name:
|
|
@@ -84,7 +84,7 @@ MS|^~\&|...
|
|
|
84
84
|
Reported message:
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
The Segment ID
|
|
87
|
+
The Segment ID is 2 characters long; a Segment ID must be exactly 3 characters.
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
A segment with an empty Segment ID, such as a line that starts with the field separator, is reported as:
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { SKIP, visitParents } from "unist-util-visit-parents";
|
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const messages = {
|
|
6
6
|
emptySegmentId: "The segment has an empty Segment ID; a Segment ID must be exactly 3 characters.",
|
|
7
|
-
segmentIdLength: (
|
|
7
|
+
segmentIdLength: (length) => `The Segment ID is ${pluralize("character", length, true)} long; a Segment ID must be exactly 3 characters.`
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Hl7v2-lint rule to warn when segment header length is invalid.
|
|
@@ -23,7 +23,7 @@ const hl7v2LintSegmentHeaderLength = lintRule({
|
|
|
23
23
|
message.actual = "";
|
|
24
24
|
return SKIP;
|
|
25
25
|
}
|
|
26
|
-
const message = file.message(messages.segmentIdLength(node.name), {
|
|
26
|
+
const message = file.message(messages.segmentIdLength(node.name.length), {
|
|
27
27
|
ancestors: [...parents, node],
|
|
28
28
|
place: node.position
|
|
29
29
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Root } from \"@glion/ast\";\nimport pluralize from \"pluralize\";\nimport { lintRule } from \"unified-lint-rule\";\nimport { SKIP, visitParents } from \"unist-util-visit-parents\";\n\nconst messages = {\n emptySegmentId:\n \"The segment has an empty Segment ID; a Segment ID must be exactly 3 characters.\",\n segmentIdLength: (
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Root } from \"@glion/ast\";\nimport pluralize from \"pluralize\";\nimport { lintRule } from \"unified-lint-rule\";\nimport { SKIP, visitParents } from \"unist-util-visit-parents\";\n\nconst messages = {\n emptySegmentId:\n \"The segment has an empty Segment ID; a Segment ID must be exactly 3 characters.\",\n segmentIdLength: (length: number) =>\n `The Segment ID is ${pluralize(\"character\", length, true)} long; a Segment ID must be exactly 3 characters.`,\n} as const;\n\n/**\n * Hl7v2-lint rule to warn when segment header length is invalid.\n */\nconst hl7v2LintSegmentHeaderLength = lintRule<Root, undefined>(\n {\n origin: \"hl7v2-lint:segment-header-length\",\n url: \"https://github.com/rethinkhealth/glion/tree/main/packages/lint-segment-header-length#readme\",\n },\n (tree, file) => {\n visitParents<Root, \"segment\">(tree, \"segment\", (node, parents) => {\n if (node.name.length === 3) {\n return SKIP;\n }\n\n if (node.name === \"\") {\n const message = file.message(messages.emptySegmentId, {\n ancestors: [...parents, node],\n place: node.position,\n });\n message.actual = \"\";\n return SKIP;\n }\n\n const message = file.message(messages.segmentIdLength(node.name.length), {\n ancestors: [...parents, node],\n place: node.position,\n });\n message.actual = node.name;\n });\n }\n);\n\nexport default hl7v2LintSegmentHeaderLength;\n"],"mappings":";;;;AAKA,MAAM,WAAW;CACf,gBACE;CACF,kBAAkB,WAChB,qBAAqB,UAAU,aAAa,QAAQ,KAAK,CAAC;CAC7D;;;;AAKD,MAAM,+BAA+B,SACnC;CACE,QAAQ;CACR,KAAK;CACN,GACA,MAAM,SAAS;AACd,cAA8B,MAAM,YAAY,MAAM,YAAY;AAChE,MAAI,KAAK,KAAK,WAAW,EACvB,QAAO;AAGT,MAAI,KAAK,SAAS,IAAI;GACpB,MAAM,UAAU,KAAK,QAAQ,SAAS,gBAAgB;IACpD,WAAW,CAAC,GAAG,SAAS,KAAK;IAC7B,OAAO,KAAK;IACb,CAAC;AACF,WAAQ,SAAS;AACjB,UAAO;;EAGT,MAAM,UAAU,KAAK,QAAQ,SAAS,gBAAgB,KAAK,KAAK,OAAO,EAAE;GACvE,WAAW,CAAC,GAAG,SAAS,KAAK;GAC7B,OAAO,KAAK;GACb,CAAC;AACF,UAAQ,SAAS,KAAK;GACtB;EAEL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glion/lint-segment-header-length",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "hl7v2-lint rule to warn when segment header length is invalid",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"definition",
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"unist-util-visit-parents": "6.0.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@stryker-mutator/core": "10.0.0",
|
|
46
|
+
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
45
47
|
"@types/node": "25.6.0",
|
|
46
48
|
"@types/pluralize": "^0.0.33",
|
|
47
49
|
"@types/unist": "^3.0.3",
|
|
@@ -51,8 +53,8 @@
|
|
|
51
53
|
"typescript": "6.0.3",
|
|
52
54
|
"vfile": "^6.0.3",
|
|
53
55
|
"vitest": "4.1.11",
|
|
54
|
-
"@glion/ast": "0.
|
|
55
|
-
"@glion/builder": "0.
|
|
56
|
+
"@glion/ast": "0.27.0",
|
|
57
|
+
"@glion/builder": "0.27.0",
|
|
56
58
|
"@glion/check-readme": "0.18.0",
|
|
57
59
|
"@glion/testing": "0.18.0",
|
|
58
60
|
"@glion/tsconfig": "0.18.0"
|
|
@@ -64,9 +66,10 @@
|
|
|
64
66
|
"build": "tsdown && tsc --emitDeclarationOnly",
|
|
65
67
|
"check-types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
|
|
66
68
|
"check:readme": "glion-check-readme",
|
|
69
|
+
"mutate": "stryker run",
|
|
70
|
+
"publint": "publint --strict",
|
|
67
71
|
"test": "vitest run",
|
|
68
72
|
"test:coverage": "vitest run --coverage",
|
|
69
|
-
"test:watch": "vitest"
|
|
70
|
-
"publint": "publint --strict"
|
|
73
|
+
"test:watch": "vitest"
|
|
71
74
|
}
|
|
72
75
|
}
|