Giter Site home page Giter Site logo

Comments (5)

getTobiasNielsen avatar getTobiasNielsen commented on May 23, 2024

I thought maybe I could help.

Would it be totally out of the question to make this whole project TS, but also able to parse at a TS level?

from eslint-plugin-react-hook-form.

andykao1213 avatar andykao1213 commented on May 23, 2024

@getTobiasNielsen please feel free to open a PR for this!

Would it be totally out of the question to make this whole project TS, but also able to parse at a TS level?

I don't really understand your question. Do you mean if the rules from this plugin support TypeScript?

from eslint-plugin-react-hook-form.

getTobiasNielsen avatar getTobiasNielsen commented on May 23, 2024

I don't really understand your question. Do you mean if the rules from this plugin support TypeScript?

Making it so, the rules would also be able to apply to TS features, I've done some research, there are two points to this:

  • One is that it might make it easier to identify when something is from RHF when the linter understands TS.
  • Second that there are some people that try to use RHF in a way that is in conflict with typescript, because large parts of RHF is invariant, and it might make sense to warn there that the typescript errors they see are due to the invariant nature, and possibly suggest a cast that doesn't conflict with their use. How easy this would be is still unclear to me, but it would be possible to detect in theory down the line.

Besides that, I also meant, converting the project/plugin to TS for the fun of it, although not critical.

from eslint-plugin-react-hook-form.

andykao1213 avatar andykao1213 commented on May 23, 2024

One is that it might make it easier to identify when something is from RHF when the linter understands TS.

Do you mean if there's another api call useForm but it is not from RHF, the plugin should be able to identify this and avoid false alarm? I think it's a good idea.

Second that there are some people that try to use RHF in a way that is in conflict with typescript, because large parts of RHF is invariant, and it might make sense to warn there that the typescript errors they see are due to the invariant nature, and possibly suggest a cast that doesn't conflict with their use. How easy this would be is still unclear to me, but it would be possible to detect in theory down the line.

Could you give an example how people will use RHF conflict with Typescript?

Besides that, I also meant, converting the project/plugin to TS for the fun of it, although not critical.

Yeah I actually think about this before. I think the challenging part will be there's no proper type definition for the AST parser. But once this is setup, it's worth to contribute the type definition back to the eslint community.

from eslint-plugin-react-hook-form.

andykao1213 avatar andykao1213 commented on May 23, 2024

Since the original topic is resolved, I'm closing this issue.
Please feel free to create new issue to track on other topic we discussed here.
Cheers!

from eslint-plugin-react-hook-form.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.