{"id":13483990,"url":"https://github.com/vfile/vfile-reporter","last_synced_at":"2025-06-11T21:40:42.210Z","repository":{"id":36578183,"uuid":"40884129","full_name":"vfile/vfile-reporter","owner":"vfile","description":"utility to create a report for a vfile","archived":false,"fork":false,"pushed_at":"2025-01-03T13:54:19.000Z","size":912,"stargazers_count":37,"open_issues_count":0,"forks_count":9,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-03T04:46:37.929Z","etag":null,"topics":["file","format","report","reporter","vfile","vfile-reporter","vfile-util","virtual"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","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/vfile.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"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":"unifiedjs","open_collective":"unified"}},"created_at":"2015-08-17T10:05:50.000Z","updated_at":"2025-02-28T07:29:34.000Z","dependencies_parsed_at":"2024-01-13T18:24:33.810Z","dependency_job_id":"5c0a4929-cdbb-4a9e-bca1-a1404ee0466f","html_url":"https://github.com/vfile/vfile-reporter","commit_stats":{"total_commits":153,"total_committers":4,"mean_commits":38.25,"dds":0.02614379084967322,"last_synced_commit":"36b98284e20615e9aaa862be10d105175cfa64bb"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfile","download_url":"https://codeload.github.com/vfile/vfile-reporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245871734,"owners_count":20686252,"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":["file","format","report","reporter","vfile","vfile-reporter","vfile-util","virtual"],"created_at":"2024-07-31T17:01:17.660Z","updated_at":"2025-03-27T15:30:52.903Z","avatar_url":"https://github.com/vfile.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["JavaScript"],"sub_categories":[],"readme":"# vfile-reporter\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[vfile][] utility to create a report.\n\n![Example screenshot of vfile-reporter][screenshot]\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`reporter(files[, options])`](#reporterfiles-options)\n  * [`Options`](#options)\n* [Example](#example)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package create a textual report from files showing the warnings that\noccurred while processing.\nMany CLIs of tools that process files, whether linters (such as ESLint) or\nbundlers (such as esbuild), have similar functionality.\n\n## When should I use this?\n\nYou can use this package when you want to display a report about what occurred\nwhile processing to a human.\n\nThere are [other reporters][reporters] that display information differently\nlisted in vfile.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install vfile-reporter\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {reporter} from 'https://esm.sh/vfile-reporter@8'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {reporter} from 'https://esm.sh/vfile-reporter@8?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay our module `example.js` looks as follows:\n\n```js\nimport {VFile} from 'vfile'\nimport {reporter} from 'vfile-reporter'\n\nconst one = new VFile({path: 'test/fixture/1.js'})\nconst two = new VFile({path: 'test/fixture/2.js'})\n\none.message('Warning!', {line: 2, column: 4})\n\nconsole.error(reporter([one, two]))\n```\n\n…now running `node example.js` yields:\n\n```txt\ntest/fixture/1.js\n2:4 warning Warning!\n\ntest/fixture/2.js: no issues found\n\n⚠ 1 warning\n```\n\n## API\n\nThis package exports the identifier [`reporter`][api-reporter].\nThat value is also the `default` export.\n\n### `reporter(files[, options])`\n\nCreate a report from one or more files.\n\n###### Parameters\n\n* `files` ([`Array\u003cVFile\u003e`][vfile] or `VFile`)\n  — files to report\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nReport (`string`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `color` (`boolean`, default: `true` when in Node.js and\n  [color is supported][supports-color], or `false`)\n  — use ANSI colors in report\n* `defaultName` (`string`, default: `'\u003cstdin\u003e'`)\n  — Label to use for files without file path; if one file and no `defaultName`\n  is given, no name will show up in the report\n* `verbose` (`boolean`, default: `false`)\n  — show message notes, URLs, and ancestor stack trace if available\n* `quiet` (`boolean`, default: `false`)\n  — do not show files without messages\n* `silent` (`boolean`, default: `false`)\n  — show errors only; this hides info and warning messages, and sets\n  `quiet: true`\n* `traceLimit` (`number`, default: `10`)\n  — max number of nodes to show in ancestors trace); ancestors can be shown\n  when `verbose: true`\n\n## Example\n\nHere’s a small example that looks through a markdown AST for emphasis and\nstrong nodes, and checks whether they use `*`.\nThe message has detailed information which will be shown in verbose mode.\n\n`example.js`:\n\n```js\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFile} from 'vfile'\nimport {reporter} from 'vfile-reporter'\n\nconst file = new VFile({\n  path: new URL('example.md', import.meta.url),\n  value: '# *hi*, _world_!'\n})\nconst value = String(file)\nconst tree = fromMarkdown(value)\nvisitParents(tree, (node, parents) =\u003e {\n  if (node.type === 'emphasis' || node.type === 'strong') {\n    const start = node.position?.start.offset\n\n    if (start !== undefined \u0026\u0026 value.charAt(start) === '_') {\n      const m = file.message('Expected `*` (asterisk), not `_` (underscore)', {\n        ancestors: [...parents, node],\n        place: node.position,\n        ruleId: 'attention-marker',\n        source: 'some-lint-example'\n      })\n      m.note = `It is recommended to use asterisks for emphasis/strong attention when\nwriting markdown.\n\nThere are some small differences in whether sequences can open and/or close…`\n      m.url = 'https://example.com/whatever'\n    }\n  }\n})\n\nconsole.error(reporter([file], {verbose: false}))\n```\n\n…running `node example.js` yields:\n\n```txt\n/Users/tilde/Projects/oss/vfile-reporter/example.md\n1:9-1:16 warning Expected `*` (asterisk), not `_` (underscore) attention-marker some-lint-example\n\n⚠ 1 warning\n```\n\nTo show the info, pass `verbose: true` to `reporter`, and run again:\nand see:\n\n```txt\n/Users/tilde/Projects/oss/vfile-reporter/example.md\n1:9-1:16 warning Expected `*` (asterisk), not `_` (underscore) attention-marker some-lint-example\n  [url]:\n    https://example.com/whatever\n  [note]:\n    It is recommended to use asterisks for emphasis/strong attention when\n    writing markdown.\n\n    There are some small differences in whether sequences can open and/or close…\n  [trace]:\n    at emphasis (1:9-1:16)\n    at heading (1:1-1:17)\n    at root (1:1-1:17)\n\n⚠ 1 warning\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `vfile-reporter@^8`,\ncompatible with Node.js 16.\n\n## Security\n\nUse of `vfile-reporter` is safe.\n\n## Related\n\n* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json)\n  — create a JSON report\n* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty)\n  — create a pretty report\n* [`vfile-reporter-junit`](https://github.com/kellyselden/vfile-reporter-junit)\n  — create a jUnit report\n* [`vfile-reporter-position`](https://github.com/Hocdoc/vfile-reporter-position)\n  — create a report with content excerpts\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to\nget started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organisation, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/vfile/vfile-reporter/workflows/main/badge.svg\n\n[build]: https://github.com/vfile/vfile-reporter/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-reporter.svg\n\n[coverage]: https://codecov.io/github/vfile/vfile-reporter\n\n[downloads-badge]: https://img.shields.io/npm/dm/vfile-reporter.svg\n\n[downloads]: https://www.npmjs.com/package/vfile-reporter\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=vfile-reporter\n\n[size]: https://bundlejs.com/?q=vfile-reporter\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/vfile/vfile/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[support]: https://github.com/vfile/.github/blob/main/support.md\n\n[health]: https://github.com/vfile/.github\n\n[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[vfile]: https://github.com/vfile/vfile\n\n[reporters]: https://github.com/vfile/vfile#reporters\n\n[supports-color]: https://github.com/chalk/supports-color\n\n[screenshot]: screenshot.png\n\n[api-reporter]: #reporterfiles-options\n\n[api-options]: #options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfile%2Fvfile-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-reporter/lists"}