Registry / testing / vfile-to-eslint

vfile-to-eslint

JSON →
library4.0.0jsnpmunverified

Converts VFile instances into ESLint-compatible LintResult arrays, enabling use of ESLint formatters with non-ESLint linting tools like remark. v4.0.0 is the current stable release; maintained by the unified collective, with TypeScript types included. ESM-only since v1, no CJS support. Differentiates by bridging vfile ecosystem to ESLint output format.

npm install vfile-to-eslint
INSTALL
IMPORT
SIG · VFILE-TO-ESLINT
V
vfile-to-eslint
testingjavascriptv4.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

toESLint
✓ import { toESLint } from 'vfile-to-eslint'
✗ import toESLint from 'vfile-to-eslint'
Only named export; no default export, so default import results in undefined.
LintResult
✓ import type { LintResult } from 'vfile-to-eslint'
✗ import { LintResult } from 'vfile-to-eslint' (at runtime)
TypeScript only; type import is necessary to avoid runtime error.
require (CommonJS)
✓ const { toESLint } = await import('vfile-to-eslint')
✗ const { toESLint } = require('vfile-to-eslint')
vfile-to-eslint is ESM-only; require() throws ERR_REQUIRE_ESM.

Processes a markdown file with remark-lint and outputs results using an ESLint formatter via toESLint.

import { remark } from 'remark'; import gfm from 'remark-gfm'; import frontmatter from 'remark-frontmatter'; import lint from 'remark-lint'; import eslintFormatterPretty from 'eslint-formatter-pretty'; import { toESLint } from 'vfile-to-eslint'; const file = await remark() .use(frontmatter) .use(gfm) .use(lint) .process('## Hello world!'); console.log(eslintFormatterPretty(toESLint([file])));
Debug
Known issues
gotchatoESLint expects an array of VFile objects; passing a single VFile will cause errors.
fix
Wrap the file in an array: toESLint([file])
affects: >=1.0.0
gotchaThe output LintResult may not fully map all VFile properties to ESLint format; non-standard properties are lost.
fix
Check the VFile for any additional metadata not captured by the LintResult type and handle separately.
affects: >=1.0.0
breakingvfile-to-eslint v4 drops support for Node.js 14, requires Node 16+.
fix
Upgrade Node.js to version 16 or higher.
affects: >=4.0.0
breakingNo default export; only named export toESLint. Using default import results in undefined.
fix
Use named import: import { toESLint } from 'vfile-to-eslint'
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'vfile-to-eslint' or its corresponding type declarations
Missing dependency or incorrect import path in TypeScript project.
fix
Run 'npm install vfile-to-eslint' or ensure tsconfig.json includes node module resolution.
ERR_REQUIRE_ESM
Using require() to import an ESM-only package in a CommonJS context.
fix
Use dynamic import: const { toESLint } = await import('vfile-to-eslint') or convert to ESM.
TypeError: files is not iterable
Passed a single VFile instead of an array of VFiles to toESLint.
fix
Wrap the file in an array: toESLint([file])
'default' is not exported by vfile-to-eslint
Trying to import a default export which does not exist.
fix
Use named import: import { toESLint } from 'vfile-to-eslint'
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
vfilerequiredCore dependency for VFile type; required for input and output types.
unifiedoptionalCommonly used together for linting pipelines, though not a direct dependency.
Agent activity
6 hits · last 30 days
node
6
Resources
vfile-to-eslint — npm install vfile-to-eslint · libregistry