vfile-message is a JavaScript utility for creating standardized lint messages within the `vfile` ecosystem. It provides a `VFileMessage` class, extending `Error`, that can be used to represent warnings or errors, particularly when a full `VFile` instance is not available or desired. Currently at version 4.0.3, the package maintains an active release cadence with frequent updates focusing on type improvements and minor fixes. Its core differentiator is the ability to generate structured messages with fields like `reason`, `line`, `column`, `ruleId`, and `source`, making them consumable by linters and other processing tools that operate on virtual files. It integrates well with the Unified (unist) ecosystem, offering TypeScript definitions for robust development.
npm install vfile-messageVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a new `VFileMessage` instance with a reason and detailed positional information, then logging it to the console.
Upgrade your Node.js environment to version 16 or later. If unable to upgrade, pin vfile-message to a version below 4.0.0 (e.g., `npm install vfile-message@^3`).
Migrate code accessing `message.position` to `message.place`. For example, `message.position.line` should become `message.place.line`.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json` or using `.mjs` extensions) and switch all imports to use `import { VFileMessage } from 'vfile-message'`.Update any comparisons or checks that specifically relied on `null` (e.g., `property === null`) to check for `undefined` or general falsiness if applicable (e.g., `property == null` to catch both `null` and `undefined`).
Switch to ESM `import` syntax: `import { VFileMessage } from 'vfile-message'`. Ensure your project's `package.json` specifies `"type": "module"` or your file uses the `.mjs` extension.The `position` property was replaced by `place`. Update your code to use `message.place.line`, `message.place.column`, etc., instead of `message.position`.
Upgrade your Node.js environment to version 16 or newer. Alternatively, if upgrading Node.js is not feasible, downgrade `vfile-message` to a v3 release (e.g., `npm install vfile-message@^3`).
No dependency data recorded yet.