This ESLint plugin provides linting rules for TOML.
36
stars
398
commits
TypeScript
primary language
Sep 7, 2026
updated
eslint-plugin-toml is ESLint plugin provides linting rules for TOML.
This ESLint plugin provides linting rules for TOML.
<custom-block lang="toml">.vue-eslint-parser v7.3.0 and above.# eslint-disable-next-lineYou can check on the Online DEMO.
See documents.
npm install --save-dev eslint eslint-plugin-toml
Requirements
- ESLint v9.38.0 and above
- Node.js v20.19.x, v22.13.x, v24.x and above
Use eslint.config.js file to configure rules. See also: https://eslint.org/docs/latest/use/configure/configuration-files.
Example 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'
}
}
];
This plugin provides configs:
*.configs.base ... Configuration to enable correct TOML parsing.*.configs.recommended ... Above, plus rules to prevent errors or unintended behavior.*.configs.standard ... Above, plus rules to enforce the common stylistic conventions.*.configs.all ... Configuration to enable correct TOML parsing and all non-deprecated rules. This config is not recommended for production use because it may change with every minor release. Use at your own risk.For backward compatibility, you can also use the flat/* namespace:
*.configs['flat/all']*.configs['flat/base']*.configs['flat/recommended']*.configs['flat/standard']See the rule list to get the rules that this plugin provides.
This plugin provides the following language identifiers for use in ESLint configurations:
toml/toml ... TOML filesFor example, to apply settings specifically to TOML files, you can use the language field in your ESLint configuration:
import eslintPluginToml from 'eslint-plugin-toml';
export default [
{
files: ["*.toml", "**/*.toml"],
plugins: {
toml: eslintPluginToml,
},
language: "toml/toml",
}
]
The configuration above is included in the shareable configs provided by this plugin, so using configs is generally recommended.
See also https://eslint.org/docs/latest/use/configure/plugins#specify-a-language
Use the dbaeumer.vscode-eslint extension that Microsoft provides officially.
You have to configure the eslint.validate option of the extension to check .toml files, because the extension targets only *.js or *.jsx files by default.
Example .vscode/settings.json:
{
"eslint.validate": [
"javascript",
"javascriptreact",
"toml"
]
}
The --fix option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
The rules with the following star :star: are included in the configs.
| Rule ID | Description | Fixable | RECOMMENDED | STANDARD |
|---|---|---|---|---|
| toml/indent | enforce consistent indentation | :wrench: | :star: | |
| toml/keys-order | disallow defining pair keys out-of-order | :wrench: | :star: | |
| toml/no-mixed-type-in-array | disallow mixed data types in array | |||
| toml/no-non-decimal-integer | disallow hexadecimal, octal and binary integer | :wrench: | ||
| toml/no-space-dots | disallow spacing around infix operators | :wrench: | :star: | |
| toml/no-unreadable-number-separator | disallow number separators that to not enhance readability. | :star: | :star: | |
| toml/padding-line-between-pairs | require or disallow padding lines between pairs | :wrench: | :star: | |
| toml/padding-line-between-tables | require or disallow padding lines between tables | :wrench: | :star: | |
| toml/precision-of-fractional-seconds | disallow precision of fractional seconds greater than the specified value. | :star: | :star: | |
| toml/precision-of-integer | disallow precision of integer greater than the specified value. | :star: | :star: | |
| toml/quoted-keys | require or disallow quotes around keys | :wrench: | :star: | |
| toml/tables-order | disallow defining tables out-of-order | :wrench: | :star: | |
| toml/vue-custom-block/no-parsing-error | disallow parsing errors in Vue custom blocks | :star: | :star: |
| Rule ID | Description | Fixable | RECOMMENDED | STANDARD |
|---|---|---|---|---|
| toml/array-bracket-newline | enforce linebreaks after opening and before closing array brackets | :wrench: | :star: | |
| toml/array-bracket-spacing | enforce consistent spacing inside array brackets | :wrench: | :star: | |
| toml/array-element-newline | enforce line breaks between array elements | :wrench: | :star: | |
| toml/comma-style | enforce consistent comma style in array | :wrench: | :star: | |
| toml/inline-table-curly-newline | enforce linebreaks after opening and before closing braces | :wrench: | :star: | |
| toml/inline-table-curly-spacing | enforce consistent spacing inside braces | :wrench: | :star: | |
| toml/inline-table-key-value-newline | enforce placing inline table key-value pairs on separate lines | :wrench: | :star: | |
| toml/key-spacing | enforce consistent spacing between keys and values in key/value pairs | :wrench: | :star: | |
| toml/spaced-comment | enforce consistent spacing after the # in a comment | :wrench: | :star: | |
| toml/table-bracket-spacing | enforce consistent spacing inside table brackets | :wrench: | :star: |
| Rule ID | Replaced by |
|---|---|
| toml/space-eq-sign | toml/key-spacing |
Welcome contributing!
Please use GitHub's Issues/PRs.
npm test runs tests and measures coverage.npm run update runs in order to update readme and recommended configuration.This plugin uses toml-eslint-parser for the parser. Check here to find out about AST.
See the LICENSE file for license rights and limitations (MIT).
TypeScript
98.6%
JavaScript
1.4%
This ESLint plugin provides linting rules for TOML.
36
stars
398
commits
TypeScript
primary language
Sep 7, 2026
updated
eslint-plugin-toml is ESLint plugin provides linting rules for TOML.
This ESLint plugin provides linting rules for TOML.
<custom-block lang="toml">.vue-eslint-parser v7.3.0 and above.# eslint-disable-next-lineYou can check on the Online DEMO.
See documents.
npm install --save-dev eslint eslint-plugin-toml
Requirements
- ESLint v9.38.0 and above
- Node.js v20.19.x, v22.13.x, v24.x and above
Use eslint.config.js file to configure rules. See also: https://eslint.org/docs/latest/use/configure/configuration-files.
Example 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'
}
}
];
This plugin provides configs:
*.configs.base ... Configuration to enable correct TOML parsing.*.configs.recommended ... Above, plus rules to prevent errors or unintended behavior.*.configs.standard ... Above, plus rules to enforce the common stylistic conventions.*.configs.all ... Configuration to enable correct TOML parsing and all non-deprecated rules. This config is not recommended for production use because it may change with every minor release. Use at your own risk.For backward compatibility, you can also use the flat/* namespace:
*.configs['flat/all']*.configs['flat/base']*.configs['flat/recommended']*.configs['flat/standard']See the rule list to get the rules that this plugin provides.
This plugin provides the following language identifiers for use in ESLint configurations:
toml/toml ... TOML filesFor example, to apply settings specifically to TOML files, you can use the language field in your ESLint configuration:
import eslintPluginToml from 'eslint-plugin-toml';
export default [
{
files: ["*.toml", "**/*.toml"],
plugins: {
toml: eslintPluginToml,
},
language: "toml/toml",
}
]
The configuration above is included in the shareable configs provided by this plugin, so using configs is generally recommended.
See also https://eslint.org/docs/latest/use/configure/plugins#specify-a-language
Use the dbaeumer.vscode-eslint extension that Microsoft provides officially.
You have to configure the eslint.validate option of the extension to check .toml files, because the extension targets only *.js or *.jsx files by default.
Example .vscode/settings.json:
{
"eslint.validate": [
"javascript",
"javascriptreact",
"toml"
]
}
The --fix option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
The rules with the following star :star: are included in the configs.
| Rule ID | Description | Fixable | RECOMMENDED | STANDARD |
|---|---|---|---|---|
| toml/indent | enforce consistent indentation | :wrench: | :star: | |
| toml/keys-order | disallow defining pair keys out-of-order | :wrench: | :star: | |
| toml/no-mixed-type-in-array | disallow mixed data types in array | |||
| toml/no-non-decimal-integer | disallow hexadecimal, octal and binary integer | :wrench: | ||
| toml/no-space-dots | disallow spacing around infix operators | :wrench: | :star: | |
| toml/no-unreadable-number-separator | disallow number separators that to not enhance readability. | :star: | :star: | |
| toml/padding-line-between-pairs | require or disallow padding lines between pairs | :wrench: | :star: | |
| toml/padding-line-between-tables | require or disallow padding lines between tables | :wrench: | :star: | |
| toml/precision-of-fractional-seconds | disallow precision of fractional seconds greater than the specified value. | :star: | :star: | |
| toml/precision-of-integer | disallow precision of integer greater than the specified value. | :star: | :star: | |
| toml/quoted-keys | require or disallow quotes around keys | :wrench: | :star: | |
| toml/tables-order | disallow defining tables out-of-order | :wrench: | :star: | |
| toml/vue-custom-block/no-parsing-error | disallow parsing errors in Vue custom blocks | :star: | :star: |
| Rule ID | Description | Fixable | RECOMMENDED | STANDARD |
|---|---|---|---|---|
| toml/array-bracket-newline | enforce linebreaks after opening and before closing array brackets | :wrench: | :star: | |
| toml/array-bracket-spacing | enforce consistent spacing inside array brackets | :wrench: | :star: | |
| toml/array-element-newline | enforce line breaks between array elements | :wrench: | :star: | |
| toml/comma-style | enforce consistent comma style in array | :wrench: | :star: | |
| toml/inline-table-curly-newline | enforce linebreaks after opening and before closing braces | :wrench: | :star: | |
| toml/inline-table-curly-spacing | enforce consistent spacing inside braces | :wrench: | :star: | |
| toml/inline-table-key-value-newline | enforce placing inline table key-value pairs on separate lines | :wrench: | :star: | |
| toml/key-spacing | enforce consistent spacing between keys and values in key/value pairs | :wrench: | :star: | |
| toml/spaced-comment | enforce consistent spacing after the # in a comment | :wrench: | :star: | |
| toml/table-bracket-spacing | enforce consistent spacing inside table brackets | :wrench: | :star: |
| Rule ID | Replaced by |
|---|---|
| toml/space-eq-sign | toml/key-spacing |
Welcome contributing!
Please use GitHub's Issues/PRs.
npm test runs tests and measures coverage.npm run update runs in order to update readme and recommended configuration.This plugin uses toml-eslint-parser for the parser. Check here to find out about AST.
See the LICENSE file for license rights and limitations (MIT).
TypeScript
98.6%
JavaScript
1.4%