{"id":25537,"library":"eslint-plugin-yaml","title":"eslint-plugin-yaml","description":"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.","status":"active","version":"1.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/aminya/eslint-plugin-yaml","tags":["javascript","eslint","eslintplugin","eslint-plugin","yaml","yml","eslint-plugin-yaml","eslint-plugin-yml","typescript"],"install":[{"cmd":"npm install eslint-plugin-yaml","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-yaml","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-yaml","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - required to run the plugin","package":"eslint","optional":false}],"imports":[{"note":"Default export is the plugin object. For CommonJS, use require('eslint-plugin-yaml').default.","wrong":"const pluginYaml = require('eslint-plugin-yaml')","symbol":"pluginYaml","correct":"import pluginYaml from 'eslint-plugin-yaml'"},{"note":"For flat config (ESLint 9+), use default import and access .configs.recommended. Legacy config uses plugin:yaml/legacy.","wrong":"require('eslint-plugin-yaml').configs.recommended","symbol":"configs.recommended","correct":"import pluginYaml from 'eslint-plugin-yaml'; pluginYaml.configs.recommended"},{"note":"Rules are available as a map on the plugin object.","wrong":"require('eslint-plugin-yaml').rules","symbol":"rules","correct":"import pluginYaml from 'eslint-plugin-yaml'; pluginYaml.rules"}],"quickstart":{"code":"// eslint.config.mjs (ESLint 9+)\nimport pluginYaml from 'eslint-plugin-yaml';\n\nexport default [\n  pluginYaml.configs.recommended,\n  {\n    rules: {\n      'yaml/no-empty-key': 'error',\n      'yaml/no-empty-value': 'error',\n    }\n  }\n];\n\n// Then lint: npx eslint .","lang":"typescript","description":"Shows how to use eslint-plugin-yaml with ESLint 9 flat config, importing the plugin and applying its recommended config plus custom rules."},"warnings":[{"fix":"Review rule configurations; update custom parser settings if any.","message":"v1.1.0 rewrote the parser from js-yaml to an ESLint-based parser; rules and behavior may differ.","severity":"breaking","affected_versions":">=1.1.0 <1.2.0"},{"fix":"Use ESLint 9+ and migrate to eslint.config.js/flat config.","message":"v1.0.0 dropped support for ESLint 8 and flat config is required.","severity":"breaking","affected_versions":">=1.0.0 <1.1.0"},{"fix":"Use Node >=12.","message":"v0.5.0 dropped Node 10 support.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Migrate to flat config with pluginYaml.configs.recommended.","message":"Legacy .eslintrc config (plugin:yaml/legacy) is deprecated in favor of flat config.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use .default for CommonJS, or use ESM import.","message":"CommonJS require must use .default: const pluginYaml = require('eslint-plugin-yaml').default","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install eslint-plugin-yaml --save-dev.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'eslint-plugin-yaml'"},{"fix":"Ensure only one version is installed and remove duplicate overrides.","cause":"Multiple versions or duplicate plugin registrations.","error":"Error: Plugin 'yaml' was conflicted between 'eslint-plugin-yaml' and ..."},{"fix":"Use require('eslint-plugin-yaml').default instead of require('eslint-plugin-yaml').","cause":"Using CommonJS require without .default to access default export.","error":"TypeError: Cannot read properties of undefined (reading 'configs')"},{"fix":"Use flat config with pluginYaml.configs.recommended.","cause":"Using legacy config string with ESLint 9 or plugin version 1.0+.","error":"ESLint couldn't find the config 'plugin:yaml/legacy'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}