Skip to main content

space-infix-ops

danger
This rule will soon be moved to eslint-stylistic. 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