Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Include deprecated jsx prop checks #81

Open
sebakerckhof opened this issue Jan 10, 2024 · 5 comments
Open

Include deprecated jsx prop checks #81

sebakerckhof opened this issue Jan 10, 2024 · 5 comments

Comments

@sebakerckhof
Copy link

I noticed that this plugin does not warn for usage of deprecated jsx props.
Since we needed this, I've written this plugin: https://github.com/sebakerckhof/eslint-plugin-deprecated-jsx-props

I originally started with bringing https://github.com/Drawbotics/eslint-plugin-deprecated-props up to date, but its approach is fundamentally flawed, so I ended up rewriting most of it.

Anyway, it seems to work well on our codebase, but I have no desire to maintain it and therefore I wanted to check if you're interested in adopting it as part of this plugin. I could make a PR for it if you're interested.

It has tests to ensure it works with:

  • local types and interfaces
  • external types and interfaces
  • combined / extended types and interfaces
  • spread arguments (for which we make the distinction between optional and required props)
@gmathieu
Copy link

I've run into the same issue.

Within the source file, the deprecation is properly reported:

export interface DialogHeaderProps {
  /** @deprecated use children instead. */
  heading?: string
}

const DialogHeader = React.forwardRef<HTMLElement, DialogHeaderProps>(
  (
    {
      className: classNameProp,
      // eslint-disable-next-line deprecation/deprecation
      heading,

But any consumers of the component outside the source don't report

// no error
<DialogHeader heading="Hire employee" />

VSCode marks the property as deprecated, which means the JSDoc is applied properly.
Screenshot 2024-03-27 at 15 57 17

@sebakerckhof I tried installing your plugin but didn't see an error either :(

@sebakerckhof
Copy link
Author

@gmathieu It works for similar code when I test it. If you can make a reproduction repo, I can take a look.

@gund
Copy link
Owner

gund commented May 20, 2024

Hey @sebakerckhof, I think we can bring your fixes into the current rules in the way that does not introduce extra rule, since this plugin already checks JSX code.
I'm totally fine if you can make a PR for it, but please add unit tests along with the fixes so we can be sure it's working and we won't break it in the future.
Also just a heads up - we are upgrading some dependencies currently and also there is a migration to latest ESLint underway so you might want to hold a bit until both #79 and #86 are merged.

@zhenzhenChange
Copy link

Looking forward to this feature!

@CommanderRedYT
Copy link

Hi, is there any progress on this topic?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants