{"id":15697090,"url":"https://github.com/ota-meshi/yaml-eslint-parser","last_synced_at":"2025-04-13T21:12:34.947Z","repository":{"id":40246261,"uuid":"283406200","full_name":"ota-meshi/yaml-eslint-parser","owner":"ota-meshi","description":"A YAML parser that produces output compatible with ESLint","archived":false,"fork":false,"pushed_at":"2025-03-05T12:39:50.000Z","size":1286,"stargazers_count":11,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T21:12:25.100Z","etag":null,"topics":["ast","eslint","eslint-custom-parser","eslint-parser","yaml-parser"],"latest_commit_sha":null,"homepage":"https://ota-meshi.github.io/yaml-eslint-parser/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ota-meshi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ota-meshi","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-07-29T05:23:43.000Z","updated_at":"2025-03-05T12:39:52.000Z","dependencies_parsed_at":"2024-04-12T11:42:25.378Z","dependency_job_id":"a8d012ab-d29a-4039-9706-fd96228e403e","html_url":"https://github.com/ota-meshi/yaml-eslint-parser","commit_stats":{"total_commits":170,"total_committers":4,"mean_commits":42.5,"dds":0.611764705882353,"last_synced_commit":"7f0a1d3772fdf28ed261ac071b5a16c55bee3d46"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Fyaml-eslint-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Fyaml-eslint-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Fyaml-eslint-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Fyaml-eslint-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ota-meshi","download_url":"https://codeload.github.com/ota-meshi/yaml-eslint-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782259,"owners_count":21160717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","eslint","eslint-custom-parser","eslint-parser","yaml-parser"],"created_at":"2024-10-03T19:11:51.919Z","updated_at":"2025-04-13T21:12:34.919Z","avatar_url":"https://github.com/ota-meshi.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ota-meshi"],"categories":[],"sub_categories":[],"readme":"# yaml-eslint-parser\n\nA YAML parser that produces output [compatible with ESLint](https://eslint.org/docs/developer-guide/working-with-custom-parsers#all-nodes).\n\n_This parser is backed by excellent [yaml](https://github.com/eemeli/yaml) package and it is heavily inspired by [yaml-unist-parser](https://github.com/ikatyang/yaml-unist-parser) package._\n\n[![NPM license](https://img.shields.io/npm/l/yaml-eslint-parser.svg)](https://www.npmjs.com/package/yaml-eslint-parser)\n[![NPM version](https://img.shields.io/npm/v/yaml-eslint-parser.svg)](https://www.npmjs.com/package/yaml-eslint-parser)\n[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads\u0026colorB=green\u0026suffix=/day\u0026query=$.downloads\u0026uri=https://api.npmjs.org//downloads/point/last-day/yaml-eslint-parser\u0026maxAge=3600)](http://www.npmtrends.com/yaml-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dw/yaml-eslint-parser.svg)](http://www.npmtrends.com/yaml-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dm/yaml-eslint-parser.svg)](http://www.npmtrends.com/yaml-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dy/yaml-eslint-parser.svg)](http://www.npmtrends.com/yaml-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dt/yaml-eslint-parser.svg)](http://www.npmtrends.com/yaml-eslint-parser)\n[![Build Status](https://github.com/ota-meshi/yaml-eslint-parser/workflows/CI/badge.svg?branch=master)](https://github.com/ota-meshi/yaml-eslint-parser/actions?query=workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/ota-meshi/yaml-eslint-parser/badge.svg?branch=master)](https://coveralls.io/github/ota-meshi/yaml-eslint-parser?branch=master)\n\n## Installation\n\n```bash\nnpm install --save-dev yaml-eslint-parser\n```\n\n## Usage\n\n### Configuration\n\nUse `.eslintrc.*` file to configure parser. See also: [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring).\n\nExample **.eslintrc.js**:\n\n```js\nmodule.exports = {\n  overrides: [\n    {\n      files: [\"*.yaml\", \"*.yml\"],\n      parser: \"yaml-eslint-parser\",\n    },\n  ],\n};\n```\n\n### Advanced Configuration\n\nThe following additional configuration options are available by specifying them in [parserOptions](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options) in your ESLint configuration file.\n\nExample **.eslintrc.js**:\n\n```js\nmodule.exports = {\n  overrides: [\n    {\n      files: [\"*.yaml\", \"*.yml\"],\n      parser: \"yaml-eslint-parser\",\n      // Additional configuration options\n      parserOptions: {\n        defaultYAMLVersion: \"1.2\",\n      },\n    },\n  ],\n};\n```\n\n#### `parserOptions.defaultYAMLVersion`\n\nSet to `\"1.2\"` or `\"1.1\"`. Select the YAML version used by documents without a `%YAML` directive.  \nIf not specified, the [yaml](https://eemeli.org/yaml/)'s default `version` option (`\"1.2\"`) is used.  \nSee \u003chttps://eemeli.org/yaml/#document-options\u003e for details.\n\n## Usage for Custom Rules / Plugins\n\n- [AST.md](./docs/AST.md) is AST specification.\n- [block-mapping.ts](https://github.com/ota-meshi/eslint-plugin-yml/blob/master/src/rules/block-mapping.ts) is an example.\n- You can see the AST on the [Online DEMO](https://ota-meshi.github.io/yaml-eslint-parser/).\n\n## Usage for Directly\n\nExample:\n\n```ts\nimport type { AST } from \"yaml-eslint-parser\";\nimport { parseYAML, getStaticYAMLValue } from \"yaml-eslint-parser\";\n\nconst code = `\namerican:\n  - Boston Red Sox\n  - Detroit Tigers\n  - New York Yankees\nnational:\n  - New York Mets\n  - Chicago Cubs\n  - Atlanta Braves\n`;\n\nconst ast: AST.YAMLProgram = parseYAML(code);\nconsole.log(ast);\n\nconst value = getStaticYAMLValue(ast);\nconsole.log(value);\n```\n\n## Related Packages\n\n- [eslint-plugin-jsonc](https://github.com/ota-meshi/eslint-plugin-jsonc) ... ESLint plugin for JSON, JSON with comments (JSONC) and JSON5.\n- [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) ... ESLint plugin for YAML.\n- [eslint-plugin-toml](https://github.com/ota-meshi/eslint-plugin-toml) ... ESLint plugin for TOML.\n- [eslint-plugin-json-schema-validator](https://github.com/ota-meshi/eslint-plugin-json-schema-validator) ... ESLint plugin that validates data using JSON Schema Validator.\n- [jsonc-eslint-parser](https://github.com/ota-meshi/jsonc-eslint-parser) ... JSON, JSONC and JSON5 parser for use with ESLint plugins.\n- [toml-eslint-parser](https://github.com/ota-meshi/toml-eslint-parser) ... TOML parser for use with ESLint plugins.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fota-meshi%2Fyaml-eslint-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fota-meshi%2Fyaml-eslint-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fota-meshi%2Fyaml-eslint-parser/lists"}