Registry / serialization / toml-eslint-parser

toml-eslint-parser

JSON →
library1.0.3jsnpmunverified

toml-eslint-parser is a specialized parser designed to convert TOML (Tom's Obvious, Minimal Language) formatted text into an Abstract Syntax Tree (AST) that is fully compatible with ESLint. This enables developers to lint TOML files within the ESLint ecosystem, applying stylistic and structural checks similar to how JavaScript files are processed. The package is currently at version 1.0.3 and maintains an active development status, featuring regular patch releases for fixes and documentation updates, and minor releases for new features like enhanced TOML specification support. Major versions, such as the recent v1.0.0, introduce breaking changes, notably the transition to an ESM-only package. A key differentiator is its robust support for the stable TOML 1.0.0 specification, alongside experimental support for the unreleased TOML 1.1.0, offering early adoption for upcoming TOML features. While it can be integrated directly into an ESLint configuration, it is often recommended to use it in conjunction with `eslint-plugin-toml`, which conveniently bundles this parser and provides a comprehensive set of TOML-specific linting rules.

npm install toml-eslint-parser
INSTALL
IMPORT
SIG · TOML-ESLINT-PARSER
T
toml-eslint-parser
serializationjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

tomlParser
import * as tomlParser from 'toml-eslint-parser';
const tomlParser = require('toml-eslint-parser');
Since v1.0.0, the package is ESM-only and must be imported using ES Modules syntax.
TOMLVersionOption
import type { TOMLVersionOption } from 'toml-eslint-parser';
Imports for types are typically used in TypeScript environments to specify parser options.
parser as default export
import tomlParser from 'toml-eslint-parser';
While `* as` is common for parsers, a direct default import may also be possible depending on module resolution and how the main export is configured in `package.json`.

Demonstrates configuring `toml-eslint-parser` in an `eslint.config.js` file for parsing TOML files, specifying TOML 1.1.0.

import * as tomlParser from 'toml-eslint-parser'; export default [ { files: ["**/*.toml"], languageOptions: { parser: tomlParser, parserOptions: { tomlVersion: "1.1.0" // Explicitly set TOML version } } } ];
Debug
Known issues
breakingVersion 1.0.0 transitioned to an ESM-only package, removing CommonJS support. This requires environments that support ES Modules.
fix
Update your import statements from `require()` to `import` syntax. Ensure your project's `package.json` specifies `"type": "module"` or files use the `.mjs` extension for ES Modules in Node.js.
affects: >=1.0.0
breakingThe package now requires Node.js versions `^20.19.0 || ^22.13.0 || >=24`.
fix
Upgrade your Node.js runtime to a compatible version.
affects: >=1.0.0
gotchaSupport for TOML 1.1.0 is currently experimental, as the specification is still under development. Breaking changes related to TOML 1.1.0 parsing may occur in minor releases of this parser.
fix
For maximum stability, stick to `tomlVersion: "1.0.0"`. If using `1.1.0`, be prepared for potential adjustments in future minor updates of the parser.
affects: >=0.11.0
gotchaThe `parserOptions.tomlVersion: "latest"` alias points to the most recent TOML specification supported (currently 1.1.0). This alias may shift to a newer TOML version in future minor releases of `toml-eslint-parser`, potentially introducing subtle changes in parsing behavior.
fix
To lock parsing behavior to a specific TOML standard, explicitly set `parserOptions.tomlVersion` to a version string like `"1.0.0"` or `"1.1.0"` instead of `"latest"`.
affects: >=0.11.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Attempting to `require()` the package after version 1.0.0, which is ESM-only.
fix
Change CommonJS `require` statements to ES Module `import` statements. For Node.js, ensure your `package.json` includes `"type": "module"` or use `.mjs` file extensions.
Error: The engine "node" is incompatible with this module. Expected version "^20.19.0 || ^22.13.0 || >=24". Got "v18.x.x"
Running the package with an unsupported Node.js version.
fix
Update your Node.js environment to a version compatible with the package's `engines` field (e.g., Node.js 20.19.0+, 22.13.0+, or 24+).
Parsing error: Unknown TOML version '2.0.0'
Specifying an unsupported or invalid `tomlVersion` in `parserOptions`.
fix
Review the `parserOptions.tomlVersion` setting in your ESLint configuration and ensure it's one of the supported values: `"1.0.0"`, `"1.1.0"`, `"1.0"`, `"1.1"`, `"latest"`, or `"next"`.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
toml-eslint-parser — npm install toml-eslint-parser · libregistry