Skip to content

Configs: add consistent-type-assertions as off in disable-type-checked #7723

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
2 tasks done
6XGate opened this issue Oct 4, 2023 · 8 comments
Closed
2 tasks done
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config

Comments

@6XGate
Copy link

6XGate commented Oct 4, 2023

Before You File a Proposal Please Confirm You Have Done The Following...

Description

'@typescript-eslint/consistent-type-assertions' should be off in 'plugin:@typescript-eslint/disable-type-checked'

Impacted Configurations

disable-type-checked

Additional Info

This seems to be a missing part to disable-type-checked.

@6XGate 6XGate added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config triage Waiting for team members to take a look labels Oct 4, 2023
@bradzacher
Copy link
Member

bradzacher commented Oct 4, 2023

Could you provide any information? Why do you think this? What's the motivation?

The rule doesn't use type information at all so it doesn't seem to fit the bill.

@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 Oct 4, 2023
@Josh-Cena
Copy link
Member

This rule does not use type information and so doesn't need to be disabled. The point of this config is to disable those that need types, not those that can only be run in TypeScript files.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
@Josh-Cena Josh-Cena removed the awaiting response Issues waiting for a reply from the OP or another party label Oct 4, 2023
@bradzacher
Copy link
Member

not those that can only be run in TypeScript files

This rule should also be fine to run in JS files cos you can't have an import that's only used as a type in a JS file.

@Josh-Cena
Copy link
Member

You mean... "you can't have type assertions in JS" 😄

@6XGate
Copy link
Author

6XGate commented Oct 5, 2023

Weird as I was getting the error about needing a parserService and setting the project when that rule was enabled. If that's the case, it should be safe to close this as it is not doing that now.

@Josh-Cena
Copy link
Member

Josh-Cena commented Oct 10, 2023

We have others complaining too, including @JamesHenry and those under #6885. Since @JoshuaKGoldberg proved that it works in https://github.com/JoshuaKGoldberg/repros/tree/consistent-type-assertions-type-information, we will keep it closed until more information can be provided. @6XGate it may help if you can provide a minimal repro showing it not working.

@meeroslav
Copy link

meeroslav commented Oct 10, 2023

Hi, I have reproduced this in my PR, adding v6 to Nx repo.

To reproduce:

  • clone this PR feat(linter): update typescript-eslint to v6 nrwl/nx#19548
  • install dependencies with pnpm i --frozen-lockfile
  • run pnpm nx lint nx-dev --skip-nx-cache (this should result in the following error)
    Screenshot 2023-10-10 at 22 52 37
  • go to node_modules/@nx/eslint-plugin/src/configs/react-typescript.js and comment out @typescript-eslint/consistent-type-assertions on line 22
  • run again pnpm nx lint nx-dev --skip-nx-cache
  • the run should now be successful

It's not a minimal repro, but I hope it's not a big hassle.

@6XGate
Copy link
Author

6XGate commented Oct 11, 2023

I landed on this issue making a library for building ESLint configs and I am not sure what combination of conditions I created to produce the issue. If it appears again, I'll try to unravel it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config
Projects
None yet
Development

No branches or pull requests

4 participants