目录

@typescript-eslint/no-extra-parens

Disallow unnecessary parentheses.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-extra-parens": "error"
  }
}

Options

For details, see @typescript-eslint/no-extra-parens.

Example of Correct Code

// By default, unnecessary parentheses are not allowed in any expression.
(0).toString();

const result = (() => {
  console.info('arrow function');
}) ? '1' : '2';

(/^a$/).test(result);

Example of Incorrect Code

// By default, unnecessary parentheses are not allowed in any expression.
const b = 10;
const c = 20;
export const a = (b * c);

export const d = (a * b) + c;

export const myType = typeof (a);

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.