Skip to main content

space-infix-ops

danger
We strongly recommend you do not use this rule or any other formatting linter rules. Use a separate dedicated formatter instead. See What About Formatting? for more information.

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',
}

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 ↗

Options

See eslint/space-infix-ops options.

Resources

Taken with ❤️ from ESLint core