gund / eslint-plugin-deprecation

ESLint rule that reports usage of deprecated code
GNU Lesser General Public License v3.0
329 stars 38 forks source link

Include deprecated jsx prop checks #81

Open sebakerckhof opened 8 months ago

sebakerckhof commented 8 months ago

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:

gmathieu commented 6 months ago

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 commented 6 months ago

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

gund commented 4 months ago

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 commented 4 months ago

Looking forward to this feature!

CommanderRedYT commented 1 week ago

Hi, is there any progress on this topic?