Skip to content

Commit

Permalink
Fix yaml import in ESM (#187)
Browse files Browse the repository at this point in the history
* Make it fail in ESM mode

* Fix yaml import in ESM

Fix #175

* Add changeset

---------

Co-authored-by: Yosuke Ota <[email protected]>
  • Loading branch information
alecmev and ota-meshi authored May 24, 2024
1 parent 98261f2 commit 4dc647e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-brooms-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"yaml-eslint-parser": patch
---

Fix `yaml` import in ESM
9 changes: 9 additions & 0 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ jobs:
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
strict-type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: npm install -f
- name: Strict type-check
run: npm run strict-type-check
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"benchmark": "ts-node --transpile-only benchmark/index.ts",
"prerelease": "npm run clean && npm run build",
"release": "changeset publish",
"version:ci": "env-cmd -e version-ci npm run build:meta && changeset version"
"version:ci": "env-cmd -e version-ci npm run build:meta && changeset version",
"strict-type-check": "tsc --project ./tsconfig.build.json --noEmit --module esnext --moduleResolution bundler"
},
"repository": {
"type": "git",
Expand Down
5 changes: 2 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { parseDocument } from "yaml";
import type { Directives } from "yaml/dist/doc/directives";
import { parseDocument, type DocumentOptions } from "yaml";
import type {
YAMLProgram,
YAMLContent,
Expand All @@ -15,7 +14,7 @@ import type {
} from "./ast";
import { tagNodeResolvers, tagResolvers } from "./tags";

export type YAMLVersion = Directives["yaml"]["version"];
export type YAMLVersion = NonNullable<DocumentOptions["version"]>;

export type YAMLContentValue =
| string
Expand Down

0 comments on commit 4dc647e

Please sign in to comment.