# User Guide

# 💿 Installation

npm install --save-dev eslint eslint-plugin-toml


  • ESLint v6.0.0 and above
  • Node.js v12.22.x, v14.17.x, v16.x and above

# 📖 Usage

# Configuration

Use .eslintrc.* file to configure rules. See also: https://eslint.org/docs/user-guide/configuring (opens new window).

Example .eslintrc.js:

module.exports = {
  extends: [
    // add more generic rulesets here, such as:
    // 'eslint:recommended',
  rules: {
    // override/add rules settings here, such as:
    // 'toml/rule-name': 'error'

This plugin provides configs:

  • plugin:toml/base ... Configuration to enable correct TOML parsing.
  • plugin:toml/recommended ... Above, plus rules to prevent errors or unintended behavior.
  • plugin:toml/standard ... Above, plus rules to enforce the common stylistic conventions.

Note that these configurations do not enable ESLint's core rules. For example, the following style rules can also be used in TOML.

    "rules": {
        "comma-spacing": "error",
        "no-multi-spaces": ["error", { "exceptions": { "TOMLKeyValue": true } }],
        "no-multiple-empty-lines": "error",
        "no-trailing-spaces": "error"

See the rule list to get the rules that this plugin provides.

# Parser Configuration

If you have specified a parser, you need to configure a parser for .toml.

For example, if you are using the "@babel/eslint-parser", configure it as follows:

module.exports = {
  // ...
  extends: ["plugin:toml/standard"],
  // ...
  parser: "@babel/eslint-parser",
  // Add an `overrides` section to add a parser configuration for TOML.
  overrides: [
      files: ["*.toml"],
      parser: "toml-eslint-parser",
  // ...

# Running ESLint from the command line

If you want to run eslint from the command line, make sure you include the .toml extension using the --ext option (opens new window) or a glob pattern, because ESLint targets only .js files by default.


eslint --ext .js,.toml src
eslint "src/**/*.{js,toml}"

# 💻 Editor Integrations

# Visual Studio Code

Use the dbaeumer.vscode-eslint (opens new window) 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": [

# ❓ FAQ

  • TODO
Last Updated: 6/25/2022, 12:51:06 PM