Package Exports
- yaml-eslint-parser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (yaml-eslint-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
yaml-eslint-parser
A YAML parser that produces output compatible with ESLint.
This parser is backed by excellent yaml and yaml-unist-parser packages.
Installation
npm install --save-dev yaml-eslint-parser
Usage
Configuration
Use .eslintrc.*
file to configure parser. See also: https://eslint.org/docs/user-guide/configuring.
Example .eslintrc.js:
module.exports = {
"overrides": [
{
"files": ["*.yaml", "*.yml"],
"parser": "yaml-eslint-parser"
}
]
}
Running ESLint from the command line
If you want to run eslint
from the command line, make sure you include the .yaml
extension using the --ext
option or a glob pattern, because ESLint targets only .js
files by default.
Examples:
eslint --ext .js,.yaml,.yml src
eslint "src/**/*.{js,yaml,yml}"
Editor Integrations
Visual Studio Code
Use the dbaeumer.vscode-eslint extension that Microsoft provides officially.
You have to configure the eslint.validate
option of the extension to check .yaml
files, because the extension targets only *.js
or *.jsx
files by default.
Example .vscode/settings.json:
{
"eslint.validate": [
"javascript",
"javascriptreact",
"yaml"
]
}