Skip to content

feat(linter)!: RulesOfHooks from nursery to correctness#7607

Merged
graphite-app[bot] merged 1 commit intomainfrom
hooks
Dec 3, 2024
Merged

feat(linter)!: RulesOfHooks from nursery to correctness#7607
graphite-app[bot] merged 1 commit intomainfrom
hooks

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented Dec 3, 2024

No description provided.

@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Dec 3, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions Bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Dec 3, 2024
@Boshen
Copy link
Copy Markdown
Member Author

Boshen commented Dec 3, 2024

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 3, 2024

CodSpeed Performance Report

Merging #7607 will not alter performance

Comparing hooks (4eb87ea) with main (bd977cf)

Summary

✅ 29 untouched benchmarks

@Boshen
Copy link
Copy Markdown
Member Author

Boshen commented Dec 3, 2024

@Boshen Boshen requested a review from camc314 December 3, 2024 13:37
@camc314
Copy link
Copy Markdown
Contributor

camc314 commented Dec 3, 2024

So for preact https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/12139527718/job/33847668251
I tested what we're report, and we've the same behaviour as the react rule.

not sure how deep i should go with nuxt-auth given it's Vue and this rule should be disabled when running there

double checking Affine

@Boshen
Copy link
Copy Markdown
Member Author

Boshen commented Dec 3, 2024

So for preact https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/12139527718/job/33847668251 I tested what we're report, and we've the same behaviour as the react rule.

not sure how deep i should go with nuxt-auth given it's Vue and this rule should be disabled when running there

double checking Affine

👍 I'll PR them and turn off this rule when we release.

@camc314
Copy link
Copy Markdown
Contributor

camc314 commented Dec 3, 2024

Affine looks fine as well. it's using v4.6 which doesn't report use hooks whereas v5 does.

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=4.7.4 <5.5.0

YOUR TYPESCRIPT VERSION: 5.5.4

Please only submit bug reports when using the officially supported version.

=============

<path>/AFFiNE/packages/backend/server/src/config/affine.self.ts
  23:3  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  40:3  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  48:1  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  56:1  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  63:1  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  72:1  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  75:1  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  91:3  error  React Hook "AFFiNE.use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks

<path>/AFFiNE/packages/common/infra/src/orm/core/validators/index.ts
  45:24  error  React Hook "use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  46:29  error  React Hook "use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  47:29  error  React Hook "use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  48:27  error  React Hook "use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  49:26  error  React Hook "use" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks

<path>/AFFiNE/packages/frontend/graphql/export-gql-plugin.cjs
    1:20  error  Prefer `node:fs` over `fs`                                                   unicorn/prefer-node-protocol
    2:22  error  Prefer `node:path` over `path`                                               unicorn/prefer-node-protocol
  141:25  error  Correct one of the identical sub-expressions on both sides of operator "||"  sonarjs/no-identical-expressions

<path>/AFFiNE/packages/frontend/native/__tests__/db.spec.mts
  1:1  error  Run autofix to sort these imports!  simple-import-sort/imports

<path>/AFFiNE/tests/kit/electron.ts
   63:15  error  React Hook "use" is called in function "shell" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"        react-hooks/rules-of-hooks
  114:11  error  React Hook "use" is called in function "page" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"         react-hooks/rules-of-hooks
  118:11  error  React Hook "use" is called in function "views" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"        react-hooks/rules-of-hooks
  163:13  error  React Hook "use" is called in function "electronApp" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"  react-hooks/rules-of-hooks
  183:11  error  React Hook "use" is called in function "appInfo" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"      react-hooks/rules-of-hooks

<path>/AFFiNE/tests/kit/mobile.ts
  22:11  error  React Hook "use" is called in function "page" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"  react-hooks/rules-of-hooks

<path>/AFFiNE/tests/kit/playwright.ts
   49:11  error  React Hook "use" is called in function "workspace" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"  react-hooks/rules-of-hooks
   79:11  error  React Hook "use" is called in function "page" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"       react-hooks/rules-of-hooks
  109:11  error  React Hook "use" is called in function "context" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use"    react-hooks/rules-of-hooks

✖ 26 problems (26 errors, 0 warnings)
  3 errors and 0 warnings potentially fixable with the `--fix` option.

Rule                                    | Time (ms) | Relative
:---------------------------------------|----------:|--------:
@typescript-eslint/no-misused-promises  | 12128.460 |    37.3%
rxjs/finnish                            |  4146.726 |    12.7%
@typescript-eslint/no-floating-promises |  3211.715 |     9.9%
import-x/no-extraneous-dependencies     |  2261.244 |     6.9%
react/display-name                      |  1334.184 |     4.1%
import-x/no-duplicates                  |  1314.415 |     4.0%
react/no-direct-mutation-state          |  1214.209 |     3.7%
@typescript-eslint/no-unused-vars       |   781.489 |     2.4%
react/no-unknown-property               |   745.694 |     2.3%
@typescript-eslint/await-thenable       |   694.018 |     2.1%

@Boshen Boshen marked this pull request as ready for review December 3, 2024 14:14
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Dec 3, 2024
Copy link
Copy Markdown
Member Author

Boshen commented Dec 3, 2024

Merge activity

  • Dec 3, 9:15 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 3, 9:15 AM EST: A user added this pull request to the Graphite merge queue.
  • Dec 3, 9:22 AM EST: A user merged this pull request with the Graphite merge queue.

@Boshen Boshen changed the title feat(linter): RulesOfHooks from nursery to correctness feat(linter)!: RulesOfHooks from nursery to correctness Dec 3, 2024
@graphite-app graphite-app Bot merged commit 4eb87ea into main Dec 3, 2024
@graphite-app graphite-app Bot deleted the hooks branch December 3, 2024 14:22
@oxc-bot oxc-bot mentioned this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants