Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
type X = number | (string | number);
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-duplicate-type-constituents": "error",
},
};
tsconfig
Expected Result
This code snippet does contain a duplicate type constituent. The rule does report it, but only if the parentheses (which are unnecessary) are removed.
Actual Result
The duplicate type constituent is not reported by the rule.
Additional Info
Reported by @auvred in #9479 (comment).
- Do we care about this issue?
- We'd need to implement a bit of recursion in order to account for this.
- You can only get into this scenario if you have enabled this rule, you are not using ESLint Stylistic (with its
no-extra-parens
rule), and you are not using a formatter (like Prettier). - Are there similar cases with extraneous parentheses in other rules, and are they handled or not?