eslint-plugin-toml

raw JSON →
1.3.1 verified Sat Apr 25 auth: no javascript

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.

error Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in ...
cause 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.
error Failed to load plugin 'toml': Cannot find module 'eslint-plugin-toml'
cause Missing dependency or incorrect install.
fix
Run 'npm install --save-dev eslint-plugin-toml' and ensure it's in node_modules.
error Configuration for rule 'toml/indent' is invalid: Value ["error", 2] is not a valid rule configuration.
cause Rule expects options object, not array or wrong severity.
fix
Set severity as string: 'off', 'warn', 'error', then options: { indent: 2 }.
breaking ESLint <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.
deprecated The 'flat/' namespace configs (e.g., 'flat/recommended') are deprecated; use unprefixed configs directly.
fix Replace ...eslintPluginToml.configs['flat/recommended'] with ...eslintPluginToml.configs.recommended.
gotcha Vue 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.
gotcha Some 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.
npm install eslint-plugin-toml
yarn add eslint-plugin-toml
pnpm add eslint-plugin-toml