Skip to content

Bug: [no-extra-parens] False positive when used with satisfies keyword #7017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
xsjcTony opened this issue May 10, 2023 · 4 comments
Closed
4 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@xsjcTony
Copy link

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

https://typescript-eslint.io/play/#ts=5.0.4&sourceType=module&code=C4TwDgpgBAYg9nKBeKByARgQwE6qgHzQDMFUBuAWACgBjOAOwGdgoiAbTAc2SgAoBtVCTioANGiy4AulEaZgAS0ZEFERrAT8pASgB0C+jTYBXACZreQ0trJA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge3oA99oBDWsX7RETVBkiJo0DtEjgwAXxBKgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

type Foo = 'bar' | 'foo';
const flag = (['foo', 'bar'] satisfies Foo[]).includes('foo');
//           ^                              ^
// Unnecessary parentheses around expression. 2:14 - 2:15

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-extra-parens": "error"
  },
};

tsconfig

No response

Expected Result

There should be no error

Actual Result

False positive

Additional Info

No response

@xsjcTony xsjcTony added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels May 10, 2023
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels May 10, 2023
@bradzacher
Copy link
Member

We really need to update this rule to use our precedence function instead of using the really disgusting forked logic...!

@xsjcTony
Copy link
Author

xsjcTony commented Jul 10, 2023

Seems the false positive has gone in my projects, but it still exists in the playground. Weird🤣

@bradzacher
Copy link
Member

It should be fixed in the latest version of eslint because I upstreamed a fix for it - eslint/eslint#17302

But the playground hasn't been updated to the latest eslint version yet.

@bradzacher
Copy link
Member

Hi there 👋!

As you may have heard ESLint core is deprecating its formatting rules. We are likewise moving in the same direction and deprecating our formatting rules.

Deprecated rules will be removed in the next major version as their new home is the eslint-stylistic project.

If this issue is important to you please consider filling an issue over at eslint-stylistic which will be the new home for stylistic/formatting rules.

Thanks!

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
@bradzacher bradzacher added the formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. label Nov 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
3 participants