Skip to content

Docs: differences between recommended and strict configs not mentioned on the website #8712

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
doberkofler opened this issue Mar 18, 2024 · 8 comments · Fixed by #8718 or #8719
Closed
4 tasks done
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working documentation Documentation ("docs") that needs adding/updating locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@doberkofler
Copy link
Contributor

doberkofler commented Mar 18, 2024

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

The playground does currently not allow to specify 7.3.0

Repro Code

The rule @typescript-eslint/no-floating-promises no longer seems to have the option ignoreVoid set to true by default in 7.3.0.
When upgrading from 7.2.0 to 7.3.0 the following code report an error and only explicitly specifying ignoreVoid: true it works as in 7.2.0.

const get = async (): Promise<void> => {};

export const useGet = (): void => {
	void get();
};

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-floating-promises": ["error"],
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

No errors when using void

Actual Result

Even when using void an error is reported

Additional Info

No response

@doberkofler doberkofler 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 Mar 18, 2024
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Mar 18, 2024

I can't reproduce this in the playground locally. https://typescript-eslint.io/play/#ts=5.4.2&fileType=.ts&code=IYZwngdgxgBAZgV2gFwJYHsIwO7oE4DWAFAJQwDeMAvgFA0Bu6qAJjvsSQNw1A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oDN4OBDfMwDmtYtA4BbSshTooiaBOiRwYAL4h1QA&tsconfig=&tokens=false will be the link once #8714 is merged & fixes the public website deploy (sorry about that) edit: is the link now.

The default config for the rule hasn't changed:

'@typescript-eslint/no-floating-promises': 'error',

#8364 added the option for rules to have different defaults in recommended vs strict. Is that what you're seeing, maybe?

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Mar 18, 2024
@rubiesonthesky
Copy link
Contributor

I think this changed for strict rule set. In recommended it was not complaining with void. But when enabling strict rule set after update, I got bunch of errors.

@JoshuaKGoldberg
Copy link
Member

Got it - I'm realizing now I really should have done more to document this. Sorry for the confusion. I'll retarget this as a docs issue and send a PR very soon.

@JoshuaKGoldberg JoshuaKGoldberg changed the title Bug: no-floating-promises ignoreVoid option no longer true by default in 7.3.0 Docs: differences between recommended and strict configs not mentioned on the website Mar 18, 2024
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Mar 18, 2024
@JoshuaKGoldberg JoshuaKGoldberg added documentation Documentation ("docs") that needs adding/updating accepting prs Go ahead, send a pull request that resolves this issue and removed awaiting response Issues waiting for a reply from the OP or another party labels Mar 18, 2024
@bradzacher
Copy link
Member

@JoshuaKGoldberg i would probably say that this is one of those changes a lot of people would disagree with and want to reconfigure.

Using void to demark a promise as intentionally floating is something a lot of people like as it's much less verbose than a disable comment (and doesn't have the same stigma).

The other config changes are tweaks to rules - but this one is a pretty big shift in the coding style.

Perhaps we should revert this specific config change and save it for a major, given how disruptive it will be for users?

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Mar 18, 2024

Yeah, makes sense. I'll send that too. 👍

@rubiesonthesky
Copy link
Contributor

@JoshuaKGoldberg could you also add a note to release notes that some default settings may have changed between recommended and strict? I’m not sure how that would be worded but I think that is the first place people will look right now :)

@JoshuaKGoldberg
Copy link
Member

Good idea, thanks! Added to https://github.com/typescript-eslint/typescript-eslint/releases/tag/v7.3.0.

@JoshuaKGoldberg
Copy link
Member

https://github.com/typescript-eslint/typescript-eslint/releases/tag/v7.3.1 is released with the revert.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
@bradzacher bradzacher added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 14, 2025
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 documentation Documentation ("docs") that needs adding/updating locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants