yaml-eslint-parser
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    yaml-eslint-parser

    A YAML parser that produces output compatible with ESLint.

    This parser is backed by excellent yaml package and it is heavily inspired by yaml-unist-parser package.

    NPM license NPM version NPM downloads NPM downloads NPM downloads NPM downloads NPM downloads Build Status Coverage Status

    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"
            }
        ]
    }

    Usage for Custom Rules / Plugins

    Usage for Directly

    Example:

    import type { AST } from "yaml-eslint-parser"
    import { parseYAML, getStaticYAMLValue } from "yaml-eslint-parser"
    
    const code = `
    american:
      - Boston Red Sox
      - Detroit Tigers
      - New York Yankees
    national:
      - New York Mets
      - Chicago Cubs
      - Atlanta Braves
    `
    
    const ast: AST.YAMLProgram = parseYAML(code)
    console.log(ast)
    
    const value = getStaticYAMLValue(ast)
    console.log(value)

    Related Packages

    Install

    npm i yaml-eslint-parser

    DownloadsWeekly Downloads

    224,843

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    85.2 kB

    Total Files

    35

    Last publish

    Collaborators

    • ota-meshi