Skip to content

Commit 4dc647e

Browse files
alecmevota-meshi
andauthoredMay 24, 2024··
Fix yaml import in ESM (#187)
* Make it fail in ESM mode * Fix yaml import in ESM Fix #175 * Add changeset --------- Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
1 parent 98261f2 commit 4dc647e

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed
 

‎.changeset/spotty-brooms-switch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"yaml-eslint-parser": patch
3+
---
4+
5+
Fix `yaml` import in ESM

‎.github/workflows/NodeCI.yml

+9
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,12 @@ jobs:
4444
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3
4545
with:
4646
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
strict-type-check:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
52+
- name: Install Packages
53+
run: npm install -f
54+
- name: Strict type-check
55+
run: npm run strict-type-check

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"benchmark": "ts-node --transpile-only benchmark/index.ts",
2626
"prerelease": "npm run clean && npm run build",
2727
"release": "changeset publish",
28-
"version:ci": "env-cmd -e version-ci npm run build:meta && changeset version"
28+
"version:ci": "env-cmd -e version-ci npm run build:meta && changeset version",
29+
"strict-type-check": "tsc --project ./tsconfig.build.json --noEmit --module esnext --moduleResolution bundler"
2930
},
3031
"repository": {
3132
"type": "git",

‎src/utils.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { parseDocument } from "yaml";
2-
import type { Directives } from "yaml/dist/doc/directives";
1+
import { parseDocument, type DocumentOptions } from "yaml";
32
import type {
43
YAMLProgram,
54
YAMLContent,
@@ -15,7 +14,7 @@ import type {
1514
} from "./ast";
1615
import { tagNodeResolvers, tagResolvers } from "./tags";
1716

18-
export type YAMLVersion = Directives["yaml"]["version"];
17+
export type YAMLVersion = NonNullable<DocumentOptions["version"]>;
1918

2019
export type YAMLContentValue =
2120
| string

0 commit comments

Comments
 (0)
Please sign in to comment.