Skip to content

trpc.useQuery() is not linted by eslint-plugin-react-hooks #2330

Closed as not planned

Description

@itsMapleLeaf

See the playground here: https://codesandbox.io/s/eslint-react-hooks-does-not-lint-on-lowercase-named-namespaces-ojbcw8?file=/src/App.js

The linter rule only recognizes un-namespaced hooks, like useQuery(), or if the namespace is capitalized, like Trpc.useQuery()

I don't think this requires a change in API, but it might be worth changing the convention in the docs with this in mind.

Activity

  1. iway1 commented on Aug 3, 2022

    @iway1
    Contributor

    I just do this:

    export const {useQuery, useMutation} = trpc;

    Then use those in components directly. It's just more dev friendly IMO to import useQuery or useMutation instead of doing trpc.useQuery

  2. KATT commented on Aug 3, 2022

    @KATT
    Member

    Interesting, I didn't know this! Do you know which lint rule it is? I'd like to open an issue

  3. itsMapleLeaf commented on Aug 3, 2022

    @itsMapleLeaf
    Author

    Interesting, I didn't know this! Do you know which lint rule it is? I'd like to open an issue

    The lint rule is react-hooks/rules-of-hooks, and it lives on the react repo https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks

  4. self-assigned this
    on Aug 8, 2022
  5. moved this to ‼️‼️ Ahead of public alpha in Roadmap and prioritieson Aug 8, 2022
  6. KATT commented on Aug 8, 2022

    @KATT
    Member
  7. moved this from ‼️‼️ Ahead of public alpha to 🚧 In Progress in Roadmap and prioritieson Aug 8, 2022
  8. TkDodo commented on Sep 7, 2022

    @TkDodo
    Contributor

    This seems pretty important for v10. Anything we can do to speed-up things on react's side?

  9. KATT commented on Sep 7, 2022

    @KATT
    Member

    This seems pretty important for v10. Anything we can do to speed-up things on react's side?

    If you have any strings to pull in the React team, pull 'em. ☺

  10. removed their assignment
    on Sep 7, 2022
  11. locked as resolved and limited conversation to collaborators on Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions