@rethinkhealth/hl7v2-lint-segment-header-length 0.2.19 → 0.2.21
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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -18
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Root } from "@rethinkhealth/hl7v2-ast";
|
|
2
2
|
/**
|
|
3
3
|
* hl7v2-lint rule to warn when segment header length is invalid.
|
|
4
4
|
*
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
declare const hl7v2LintSegmentHeaderLength: import("unified-lint-rule").Plugin<
|
|
7
|
+
declare const hl7v2LintSegmentHeaderLength: import("unified-lint-rule").Plugin<Root, undefined>;
|
|
8
8
|
export default hl7v2LintSegmentHeaderLength;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD;;;;GAIG;AACH,QAAA,MAAM,4BAA4B,qDA4BjC,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import pluralize from "pluralize";
|
|
3
3
|
import { lintRule } from "unified-lint-rule";
|
|
4
|
-
import {
|
|
4
|
+
import { SKIP, visitParents } from "unist-util-visit-parents";
|
|
5
5
|
var hl7v2LintSegmentHeaderLength = lintRule(
|
|
6
6
|
{
|
|
7
7
|
origin: "hl7v2-lint:segment-header-length",
|
|
8
8
|
url: "https://github.com/rethinkhealth/hl7v2/tree/main/packages/hl7v2-lint-segment-header-length#readme"
|
|
9
9
|
},
|
|
10
10
|
(tree, file) => {
|
|
11
|
-
visitParents(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
visitParents(
|
|
12
|
+
tree,
|
|
13
|
+
"segment-header",
|
|
14
|
+
(node, parents) => {
|
|
15
|
+
const headerValue = node.value;
|
|
16
|
+
const size = headerValue?.length ?? 0;
|
|
17
|
+
if (size === 3) {
|
|
18
|
+
return SKIP;
|
|
19
|
+
}
|
|
20
|
+
file.message(
|
|
21
|
+
`Unexpected ${size} header length, expected 3 characters, ${size > 3 ? `remove ${size - 3} ${pluralize("character", size - 3)}` : `add ${3 - (size ?? 0)} ${pluralize("character", 3 - (size ?? 0))}`}`,
|
|
22
|
+
{ ancestors: [...parents, node], place: node.position }
|
|
23
|
+
);
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
return SKIP;
|
|
17
|
-
}
|
|
18
|
-
const segment = node;
|
|
19
|
-
const headerValue = segment.name;
|
|
20
|
-
const size = headerValue?.length ?? 0;
|
|
21
|
-
if (size === 3) {
|
|
22
|
-
return SKIP;
|
|
23
|
-
}
|
|
24
|
-
file.message(
|
|
25
|
-
`Unexpected ${size} header length, expected 3 characters, ${size > 3 ? `remove ${size - 3} ${pluralize("character", size - 3)}` : `add ${3 - (size ?? 0)} ${pluralize("character", 3 - (size ?? 0))}`}`,
|
|
26
|
-
{ ancestors: [...parents, node], place: node.position }
|
|
27
|
-
);
|
|
28
|
-
});
|
|
25
|
+
);
|
|
29
26
|
}
|
|
30
27
|
);
|
|
31
28
|
var src_default = hl7v2LintSegmentHeaderLength;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Root } from \"@rethinkhealth/hl7v2-ast\";\nimport pluralize from \"pluralize\";\nimport { lintRule } from \"unified-lint-rule\";\nimport { SKIP, visitParents } from \"unist-util-visit-parents\";\n\n/**\n * hl7v2-lint rule to warn when segment header length is invalid.\n *\n *\n */\nconst hl7v2LintSegmentHeaderLength = lintRule<Root, undefined>(\n {\n origin: \"hl7v2-lint:segment-header-length\",\n url: \"https://github.com/rethinkhealth/hl7v2/tree/main/packages/hl7v2-lint-segment-header-length#readme\",\n },\n (tree, file) => {\n visitParents<Root, \"segment-header\">(\n tree,\n \"segment-header\",\n (node, parents) => {\n const headerValue = node.value;\n const size = headerValue?.length ?? 0;\n\n if (size === 3) {\n return SKIP;\n }\n\n file.message(\n `Unexpected ${size} header length, expected 3 characters, ${\n size > 3\n ? `remove ${size - 3} ${pluralize(\"character\", size - 3)}`\n : `add ${3 - (size ?? 0)} ${pluralize(\"character\", 3 - (size ?? 0))}`\n }`,\n { ancestors: [...parents, node], place: node.position }\n );\n }\n );\n }\n);\n\nexport default hl7v2LintSegmentHeaderLength;\n"],"mappings":";AACA,OAAO,eAAe;AACtB,SAAS,gBAAgB;AACzB,SAAS,MAAM,oBAAoB;AAOnC,IAAM,+BAA+B;AAAA,EACnC;AAAA,IACE,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA,CAAC,MAAM,SAAS;AACd;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC,MAAM,YAAY;AACjB,cAAM,cAAc,KAAK;AACzB,cAAM,OAAO,aAAa,UAAU;AAEpC,YAAI,SAAS,GAAG;AACd,iBAAO;AAAA,QACT;AAEA,aAAK;AAAA,UACH,cAAc,IAAI,0CAChB,OAAO,IACH,UAAU,OAAO,CAAC,IAAI,UAAU,aAAa,OAAO,CAAC,CAAC,KACtD,OAAO,KAAK,QAAQ,EAAE,IAAI,UAAU,aAAa,KAAK,QAAQ,EAAE,CAAC,EACvE;AAAA,UACA,EAAE,WAAW,CAAC,GAAG,SAAS,IAAI,GAAG,OAAO,KAAK,SAAS;AAAA,QACxD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,cAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rethinkhealth/hl7v2-lint-segment-header-length",
|
|
3
3
|
"description": "hl7v2-lint rule to warn when segment header length is invalid",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.21",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Melek Somai",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"vfile": "^6.0.3",
|
|
32
32
|
"vfile-reporter": "^8.1.1",
|
|
33
33
|
"vitest": "^3.2.4",
|
|
34
|
-
"@rethinkhealth/hl7v2-ast": "0.2.
|
|
35
|
-
"@rethinkhealth/hl7v2-builder": "0.2.
|
|
36
|
-
"@rethinkhealth/
|
|
37
|
-
"@rethinkhealth/
|
|
34
|
+
"@rethinkhealth/hl7v2-ast": "0.2.21",
|
|
35
|
+
"@rethinkhealth/hl7v2-builder": "0.2.21",
|
|
36
|
+
"@rethinkhealth/testing": "0.0.1",
|
|
37
|
+
"@rethinkhealth/tsconfig": "0.0.1"
|
|
38
38
|
},
|
|
39
39
|
"repository": "rethinkhealth/hl7v2.git",
|
|
40
40
|
"homepage": "https://www.rethinkhealth.io/hl7v2/docs",
|