yaml-eslint-parser is a critical utility for integrating YAML linting into the ESLint ecosystem, transforming YAML files into an Abstract Syntax Tree (AST) that is fully compatible with ESLint's API. This enables developers to use standard ESLint rules and plugins (like `eslint-plugin-yml`) to lint YAML configuration, data, and schema files, ensuring consistent formatting and catching potential issues. Currently at stable version 2.0.0, the package demonstrates an active release cadence with regular patch and minor updates, and recent major version bumps aligning with Node.js LTS releases. Its key differentiator is its foundation on the robust `yaml` package by Eemeli, providing accurate and spec-compliant YAML parsing, along with options to specify the YAML version (e.g., 1.1 or 1.2) for documents lacking an explicit `%YAML` directive. This approach contrasts with older or simpler parsers that might not provide a full AST or be as spec-compliant, making it a reliable choice for advanced YAML linting needs.
Verified import paths — ran on the pinned version, not inferred.
ESLint v9+ uses flat configuration which is ESM-first, requiring `import` syntax for parsers. Previous versions (ESLint v8-) could use CommonJS `require()` in `.eslintrc.js` files, but the parser itself was referenced as a string.
Used for TypeScript-based custom ESLint rules or direct AST manipulation, providing type definitions for the generated YAML AST nodes.
For direct programmatic parsing outside of the ESLint configuration context, enabling custom tools or deeper integration. Also exports `getStaticYAMLValue`.
Demonstrates configuring `yaml-eslint-parser` as the parser for `.yaml` and `.yml` files in an ESLint v9+ flat configuration file (`eslint.config.js`). It also shows how to apply `parserOptions`.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.