Skip to main content

space-infix-ops

<admonition title="Deprecated" type="warning"> Formatting rules now live in <a href="https://eslint.style">eslint-stylistic</a>. <a href="https://eslint.style/rules/ts/space-infix-ops">@stylistic/ts/space-infix-ops</a> is the replacement for this rule. <br /> See <a href="/blog/deprecating-formatting-rules">Deprecating Formatting Rules</a> for more information. </admonition>

Require spacing around infix operators.

🔧

Some problems reported by this rule are automatically fixable by the --fix ESLint command line option.

This rule extends the base eslint/space-infix-ops rule. It adds support for enum members.

enum MyEnum {
KEY = 'value',
}

Options

See eslint/space-infix-ops options.

How to Use

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"space-infix-ops": "off",
"@typescript-eslint/space-infix-ops": "error"
}
};

Try this rule in the playground ↗

Resources

Taken with ❤️ from ESLint core.