Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vfile-reporter

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile-reporter

vfile utility to create a report for a file

  • 7.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
499K
decreased by-4.28%
Maintainers
1
Weekly downloads
 
Created

What is vfile-reporter?

The vfile-reporter package is used to format and report messages from vfile objects, which are used to represent files with associated metadata and messages. It is particularly useful in the context of processing files with tools like unified, remark, and rehype.

What are vfile-reporter's main functionalities?

Basic Reporting

This feature allows you to generate a basic report from a vfile object. The report includes messages such as warnings or errors associated with the file.

const vfile = require('vfile');
const vfileReporter = require('vfile-reporter');

const file = vfile({path: 'example.md', contents: 'Hello, world!'});
file.message('Warning: something is not right', {line: 1, column: 1});

console.log(vfileReporter([file]));

Custom Reporters

This feature allows you to create custom reporters to format the messages in a way that suits your needs. The example shows a custom reporter that formats messages with file path, line, and column information.

const vfile = require('vfile');
const vfileReporter = require('vfile-reporter');

const file = vfile({path: 'example.md', contents: 'Hello, world!'});
file.message('Warning: something is not right', {line: 1, column: 1});

const customReporter = (files) => {
  return files.map(file => file.messages.map(msg => `${file.path}:${msg.line}:${msg.column} - ${msg.reason}`).join('\n')).join('\n');
};

console.log(customReporter([file]));

Other packages similar to vfile-reporter

Keywords

FAQs

Package last updated on 04 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc