Registry / testing / eslint-plugin-toml

eslint-plugin-toml

JSON →
library1.3.1jsnpmunverified

ESLint plugin for linting TOML files, providing syntax validation, formatting rules (e.g., inline-table-curly-newline, inline-table-curly-spacing), and support for Vue SFC custom blocks. Current stable version is 1.3.1, released monthly with active maintenance. Requires ESLint >=9.38.0 and Node >=20.19.0. Key differentiators: full TOML parsing, ESLint directive support (# eslint-disable-next-line), and integration with editor tools. Alternatives like prettier-plugin-toml focus on formatting only.

npm install eslint-plugin-toml
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-TOML
E
eslint-plugin-toml
testingjavascriptv1.3.1
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.

eslintPluginToml
import eslintPluginToml from 'eslint-plugin-toml'
const eslintPluginToml = require('eslint-plugin-toml')
Default import provides the plugin object; peer dep ESLint >=9.38.0 requires flat config (ESM).
configs
import eslintPluginToml from 'eslint-plugin-toml'; ...eslintPluginToml.configs.recommended
require('eslint-plugin-toml').configs.recommended
Prefer using .configs.recommended or .configs.standard; flat config only.
rules
import eslintPluginToml from 'eslint-plugin-toml'; eslintPluginToml.rules['toml/indent']
Accidentally treating rules toml/indent as a plain string; correct: access via plugin object after import.
parseError
import { parseError } from 'eslint-plugin-toml'
No named export; only default export.

Shows minimal flat config to enable TOML linting via plugin; uses recommended config.

// eslint.config.js import eslintPluginToml from 'eslint-plugin-toml'; export default [ // add more generic rule sets here, such as: // js.configs.recommended, ...eslintPluginToml.configs.recommended, { rules: { // override/add rules settings here, such as: // 'toml/rule-name': 'error' } } ];
Debug
Known issues
breakingESLint <9.38.0 is not supported; plugin requires flat config and language: 'toml/toml' which only works with ESLint >=9.38.0.
fix
Upgrade ESLint to >=9.38.0 and use flat config (eslint.config.js) instead of .eslintrc.
affects: >=1.0.0
deprecatedThe 'flat/' namespace configs (e.g., 'flat/recommended') are deprecated; use unprefixed configs directly.
fix
Replace ...eslintPluginToml.configs['flat/recommended'] with ...eslintPluginToml.configs.recommended.
affects: >=1.3.0
gotchaVue SCF custom block support requires vue-eslint-parser v7.3.0+, but parser not listed as peer dep.
fix
Install vue-eslint-parser@>=7.3.0 if using Vue SFC with TOML custom blocks.
affects: >=1.0.0
gotchaSome rules (e.g., inline-table-curly-spacing) have options like emptyObjects that may change behavior in minor versions.
fix
Review rule options after updates; check CHANGELOG for property changes.
affects: >=1.2.0
Errors
Common errors & fixes
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in ...
Accessing file directly (e.g., require('eslint-plugin-toml/package.json')) which may not be exported.
fix
Use import/require the main plugin object only, not internal files.
Failed to load plugin 'toml': Cannot find module 'eslint-plugin-toml'
Missing dependency or incorrect install.
fix
Run 'npm install --save-dev eslint-plugin-toml' and ensure it's in node_modules.
Configuration for rule 'toml/indent' is invalid: Value ["error", 2] is not a valid rule configuration.
Rule expects options object, not array or wrong severity.
fix
Set severity as string: 'off', 'warn', 'error', then options: { indent: 2 }.
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency, plugin cannot be used without ESLint
Agent activity
13 hits · last 30 days
node
10
Resources
eslint-plugin-toml — npm install eslint-plugin-toml · libregistry