Skip to content

Enhancement: [no-deprecated] Allow should support properties inside types #11083

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
Harpush opened this issue Apr 16, 2025 · 5 comments
Closed
4 tasks done
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule 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 triage Waiting for team members to take a look

Comments

@Harpush
Copy link

Harpush commented Apr 16, 2025

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

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/no-deprecated/

Description

When specifying allow you can't allow a property. For example in lib dom I want to allow keyCode under KeyboardEvent.

Fail

const e: KeyboardEvent = ...
e.keyCode;

Pass

const e: KeyboardEvent = ...
e.keyCode;

Additional Info

I think maybe allowing KeyboardEvent.keyCode should be passed to allow nested properties... But not sure if it is flexible enough

@Harpush Harpush added enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Apr 16, 2025
@JoshuaKGoldberg
Copy link
Member

Err the Fail and Pass snippets have the same code, could you edit them to be different please? I'm not following what this is asking for otherwise.

@JoshuaKGoldberg JoshuaKGoldberg 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 Apr 16, 2025
@Harpush
Copy link
Author

Harpush commented Apr 16, 2025

Err the Fail and Pass snippets have the same code, could you edit them to be different please? I'm not following what this is asking for otherwise.

Well to be honest there aren't fail and pass snippets.
When accessing KeyboareEvent.keyCode the keyCode is a deprecated property.
Currently there is no way to allow the keyCode property using the options of the rule.

Anything else missing?

@Harpush
Copy link
Author

Harpush commented Apr 16, 2025

For example maybe something like this:

{
  "allow": [
    { "from": "lib", "name": "KeydownEvent.keyCode" }
    // Or maybe
    { "from": "lib", "name": "KeydownEvent", "property": "keyCode" }
  ]
}

@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look and removed awaiting response Issues waiting for a reply from the OP or another party labels Apr 18, 2025
@JoshuaKGoldberg
Copy link
Member

Oh gotcha, thanks. That is interesting. I can see why you'd want this. 👍 from me on trying to find a good solution here.

This also seems related to #10740. Both of these issues are about expanding TypeOrValueSpecifier to target properties.

@JoshuaKGoldberg
Copy link
Member

Oh gotcha, thanks. That is interesting. I can see why you'd want this. 👍 from me on trying to find a good solution here.

This also seems related to #10740. Both of these issues are about expanding TypeOrValueSpecifier to target properties.

I'll go ahead and mark this as a duplicate, quote the reasoning here, and push that conversation forward a bit. Thanks for filing!

@github-actions github-actions bot 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 May 20, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule 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 triage Waiting for team members to take a look
Projects
None yet
Development

No branches or pull requests

2 participants