Skip to main content

comma-spacing

Enforce consistent spacing before and after commas.

Attributes

  • Included in configs
    • ✅ Recommended
    • 🔒 Strict
  • Fixable
    • 🔧 Automated Fixer
    • 💡 Suggestion Fixer
  • 💭 Requires type information

Rule Details

This rule extends the base eslint/comma-spacing rule. It adds support for trailing comma in a types parameters list.

How to Use

.eslintrc.cjs
module.exports = {
// Note: you must disable the base rule as it can report incorrect errors
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": "warn"
};

Options

See eslint/comma-spacing options.

Taken with ❤️ from ESLint core

Resources