Skip to main content

no-extra-parens

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.

Disallow unnecessary parentheses.

🔧

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

Examples

This rule extends the base eslint/no-extra-parens rule. It adds support for TypeScript type assertions.

Options

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-extra-parens": "off",
"@typescript-eslint/no-extra-parens": "error"
}
};
Try this rule in the playground ↗

See eslint/no-extra-parens options.

How to Use

Resources

Taken with ❤️ from ESLint core