Registry / testing / eslint-plugin-yml

eslint-plugin-yml

JSON →
library3.3.1jsnpmunverified

An ESLint plugin that provides a comprehensive set of linting rules for YAML files, including support for Vue SFC custom blocks and ESLint directive comments. Version 3.3.1 is the latest stable release, with releases occurring every few months. Unlike other YAML linting plugins that use processors without providing AST and source code text to ESLint, eslint-plugin-yml provides full AST support, enabling ESLint directive comments and compatibility with other plugins like eslint-plugin-prettier. Requires Node.js 20+ and ESLint 9.38+.

npm install eslint-plugin-yml
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-YML
E
eslint-plugin-yml
testingjavascriptv3.3.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ import eslintPluginYml from 'eslint-plugin-yml'
✗ const eslintPluginYml = require('eslint-plugin-yml')
This plugin is ESM-only; CommonJS require is not supported.
configs
✓ import { configs } from 'eslint-plugin-yml'
✗ const { configs } = require('eslint-plugin-yml')
Named export for accessing configs like configs.recommended.
rules
✓ import { rules } from 'eslint-plugin-yml'
Named export for accessing individual rules if needed.

Configure ESLint to lint YAML files using the plugin's recommended config, then override specific rules.

import eslintPluginYml from 'eslint-plugin-yml'; export default [ ...eslintPluginYml.configs.recommended, { rules: { 'yml/block-mapping': 'error', 'yml/no-empty-key': 'error', }, }, ];
Debug
Known issues
breakingv3.0.0 changed shareable configs to use ESLint v9 language config API (language: 'yml/yaml') instead of legacy parser approach. Existing configs using languageOptions.parser will no longer work.
fix
Update your eslint.config.js to use the new language configuration (language: 'yml/yaml') instead of specifying parser in languageOptions.
affects: >=3.0.0
deprecatedThe plugin only supports ESLint v8 or earlier with v1.x; from v2.0.0 onwards, it requires ESLint v9.
fix
Upgrade ESLint to v9.38.0 or later.
affects: >=2.0.0
gotchaThe plugin is ESM-only. Using require() will throw an error.
fix
Use import syntax or switch to dynamic import() for CommonJS projects if necessary.
affects: >=2.0.0
gotchaWhen used with Vue SFC, vue-eslint-parser v7.3.0+ is required. Older versions are incompatible.
fix
Ensure vue-eslint-parser is at version 7.3.0 or higher.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-yml/dist/index.mjs from /path/to/eslint.config.js not supported.
Using CommonJS require() to import an ESM-only module.
fix
Change require() to import statement: import eslintPluginYml from 'eslint-plugin-yml'
Cannot find module 'eslint-plugin-yml' or its corresponding type declarations.
The package does not include TypeScript definitions by default; you may need @types/eslint-plugin-yml.
fix
Install @types/eslint-plugin-yml as a dev dependency: npm install --save-dev @types/eslint-plugin-yml
ConfigError: Config (flat): Key 'languageOptions' is not allowed for config at index 1. Use 'language' instead.
Using deprecated languageOptions.parser in v3.0.0+.
fix
Replace languageOptions.parser with language: 'yml/yaml' in your config.
Upgrade
Version history
3.3.1latest on npm
Audit
Dependencies
eslintrequiredPeer dependency; plugin requires ESLint >=9.38.0 to function properly.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-yml — npm install eslint-plugin-yml · libregistry