Registry / testing / eslint-plugin-yaml

eslint-plugin-yaml

JSON →
library1.1.3jsnpmunverified

An ESLint plugin that provides linting for YAML files (`.yaml`, `.yml`). Current stable version is 1.1.3, released March 2025. It uses an ESLint-based YAML parser (not js-yaml) since v1.1.0, enabling integration with ESLint's rule system. Supports both ESLint 9 flat config (ESM/CJS) and legacy ESLint 8 configs. Ships TypeScript types. Differentiators: first-class ESLint compatibility with YAML-specific rules, support for multiple YAML documents, and active maintenance with recent dependency updates.

npm install eslint-plugin-yaml
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-YAML
E
eslint-plugin-yaml
testingjavascriptv1.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pluginYaml
import pluginYaml from 'eslint-plugin-yaml'
const pluginYaml = require('eslint-plugin-yaml')
Default export is the plugin object. For CommonJS, use require('eslint-plugin-yaml').default.
configs.recommended
import pluginYaml from 'eslint-plugin-yaml'; pluginYaml.configs.recommended
require('eslint-plugin-yaml').configs.recommended
For flat config (ESLint 9+), use default import and access .configs.recommended. Legacy config uses plugin:yaml/legacy.
rules
import pluginYaml from 'eslint-plugin-yaml'; pluginYaml.rules
require('eslint-plugin-yaml').rules
Rules are available as a map on the plugin object.

Shows how to use eslint-plugin-yaml with ESLint 9 flat config, importing the plugin and applying its recommended config plus custom rules.

// eslint.config.mjs (ESLint 9+) import pluginYaml from 'eslint-plugin-yaml'; export default [ pluginYaml.configs.recommended, { rules: { 'yaml/no-empty-key': 'error', 'yaml/no-empty-value': 'error', } } ]; // Then lint: npx eslint .
Debug
Known issues
breakingv1.1.0 rewrote the parser from js-yaml to an ESLint-based parser; rules and behavior may differ.
fix
Review rule configurations; update custom parser settings if any.
affects: >=1.1.0 <1.2.0
breakingv1.0.0 dropped support for ESLint 8 and flat config is required.
fix
Use ESLint 9+ and migrate to eslint.config.js/flat config.
affects: >=1.0.0 <1.1.0
breakingv0.5.0 dropped Node 10 support.
fix
Use Node >=12.
affects: >=0.5.0
deprecatedLegacy .eslintrc config (plugin:yaml/legacy) is deprecated in favor of flat config.
fix
Migrate to flat config with pluginYaml.configs.recommended.
affects: >=1.0.0
gotchaCommonJS require must use .default: const pluginYaml = require('eslint-plugin-yaml').default
fix
Use .default for CommonJS, or use ESM import.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'eslint-plugin-yaml'
Package not installed or not in node_modules.
fix
Run npm install eslint-plugin-yaml --save-dev.
Error: Plugin 'yaml' was conflicted between 'eslint-plugin-yaml' and ...
Multiple versions or duplicate plugin registrations.
fix
Ensure only one version is installed and remove duplicate overrides.
TypeError: Cannot read properties of undefined (reading 'configs')
Using CommonJS require without .default to access default export.
fix
Use require('eslint-plugin-yaml').default instead of require('eslint-plugin-yaml').
ESLint couldn't find the config 'plugin:yaml/legacy'.
Using legacy config string with ESLint 9 or plugin version 1.0+.
fix
Use flat config with pluginYaml.configs.recommended.
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies
eslintrequiredpeer dependency - required to run the plugin
Agent activity
5 hits · last 30 days
node
4
Resources
eslint-plugin-yaml — npm install eslint-plugin-yaml · libregistry