Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(linter): avoid unnecessary work in jsx_a11y/anchor_is_valid rule #5341

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Aug 30, 2024

Follow-on after #5223.

#5223 introduced the line let span = jsx_el.opening_element.name.span();. But the span is only needed when creating a diagnostic when the rule fails (cold path). Avoid the work of getting the span for the common case where the rule passes.

Copy link

graphite-app bot commented Aug 30, 2024

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

Add the label “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 the A-linter Area - Linter label Aug 30, 2024
@overlookmotel overlookmotel marked this pull request as ready for review August 30, 2024 11:37
@overlookmotel overlookmotel requested a review from Dunqing August 30, 2024 11:38
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 30, 2024
Copy link

graphite-app bot commented Aug 30, 2024

Merge activity

  • Aug 30, 7:39 AM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 30, 8:52 AM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 30, 8:52 AM EDT: overlookmotel added this pull request to the Graphite merge queue.
  • Aug 30, 8:57 AM EDT: overlookmotel merged this pull request with the Graphite merge queue.

Copy link

codspeed-hq bot commented Aug 30, 2024

CodSpeed Performance Report

Merging #5341 will not alter performance

Comparing 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule (05636b7) with main (57050ab)

Summary

✅ 28 untouched benchmarks

@overlookmotel overlookmotel removed the 0-merge Merge with Graphite Merge Queue label Aug 30, 2024
@overlookmotel
Copy link
Contributor Author

I've removed the merge label as would like @Dunqing to review - these PRs are tweaks to code he wrote.

@Dunqing
Copy link
Member

Dunqing commented Aug 30, 2024

I've removed the merge label as would like @Dunqing to review - these PRs are tweaks to code he wrote.

I wrote a shit code 🥲

@overlookmotel
Copy link
Contributor Author

I wrote a shit code 🥲

No I didn't mean it like that! It's a massive PR. The whole point of review is that 1 person will never catch everything, it needs a 2nd pair of eyes.

@overlookmotel overlookmotel force-pushed the 08-30-refactor_linter_shorten_code_in_jsx_a11y_aria_activedescendant_has_tabindex_rule branch from fe52833 to 81c95de Compare August 30, 2024 12:07
@overlookmotel overlookmotel force-pushed the 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule branch from 89ea07f to 61fd539 Compare August 30, 2024 12:07
@Dunqing Dunqing changed the base branch from 08-30-refactor_linter_shorten_code_in_jsx_a11y_aria_activedescendant_has_tabindex_rule to graphite-base/5341 August 30, 2024 12:17
@Dunqing Dunqing force-pushed the graphite-base/5341 branch from 81c95de to 57050ab Compare August 30, 2024 12:22
@Dunqing Dunqing force-pushed the 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule branch from 61fd539 to ff6cd35 Compare August 30, 2024 12:22
@Dunqing Dunqing changed the base branch from graphite-base/5341 to main August 30, 2024 12:23
@Dunqing Dunqing force-pushed the 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule branch from ff6cd35 to 7e8c3fa Compare August 30, 2024 12:23
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Aug 30, 2024
…le (#5341)

Follow-on after #5223.

#5223 introduced the line `let span = jsx_el.opening_element.name.span();`. But the span is only needed when creating a diagnostic when the rule fails (cold path). Avoid the work of getting the span for the common case where the rule passes.
@overlookmotel overlookmotel force-pushed the 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule branch from 7e8c3fa to 05636b7 Compare August 30, 2024 12:52
@graphite-app graphite-app bot merged commit 05636b7 into main Aug 30, 2024
24 checks passed
@graphite-app graphite-app bot deleted the 08-30-perf_linter_avoid_unnecessary_work_in_jsx_a11y_anchor_is_valid_rule branch August 30, 2024 12:57
@oxc-bot oxc-bot mentioned this pull request Sep 2, 2024
Boshen added a commit that referenced this pull request Sep 2, 2024
## [0.9.2] - 2024-09-02

### Features

- f81e8a1 linter: Add `oxc/no-async-endpoint-handlers` (#5364)
(DonIsaac)
- b103737 linter: Improve no-accumulating-spread (#5302) (camc314)
- 9c22ce9 linter: Add hyperlinks to diagnostic messages (#5318)
(DonIsaac)
- 1967c67 linter/eslint: Implement no-new-func (#5360) (dalaoshu)
- b867e5f linter/eslint-plugin-promise: Implement catch-or-return
(#5121) (Jelle van der Waa)
- 8d781e7 linter/oxc: Differentiate between array/object in
`no-accumulating-spread` loop diagnostic (#5375) (camc314)
- db55444 linter/oxc: Add fixer for `double-comparisons` (#5378)
(camc314)
- e5c755a linter/promise: Add `spec-only` rule (#5124) (Jelle van der
Waa)
- 4c0861f linter/unicorn: Add fixer for `prefer-type-error` (#5311)
(camc314)
- 084c2d1 linter/vitest: Implement prefer-to-be-object (#5321)
(dalaoshu)

### Bug Fixes

- 11b93af linter/unicorn: Consistent-function-scoping false positive on
assignment expression (#5312) (Arian94)

### Performance

- f052a6d linter: `react/jsx_no_undef` faster check for unbound
references (#5349) (overlookmotel)
- 05636b7 linter: Avoid unnecessary work in `jsx_a11y/anchor_is_valid`
rule (#5341) (overlookmotel)

### Refactor

- afb038e linter: `react/jsx_no_undef` use loop instead of recursion
(#5347) (overlookmotel)
- fe62687 linter: Simplify skipping JSX elements in
`unicorn/consistent_function_scoping` (#5351) (overlookmotel)
- 381d9fe linter: Shorten code in `react/jsx_no_useless_fragment`
(#5350) (overlookmotel)
- 83b9a82 linter: Fix indentation in
`nextjs/no_script_component_in_head` rule (#5338) (overlookmotel)
- 89f0188 linter: Improve docs for `react/jsx_no_target_blank` rule
(#5342) (overlookmotel)
- 57050ab linter: Shorten code in
`jsx_a11y/aria_activedescendant_has_tabindex` rule (#5340)
(overlookmotel)
- ed31d67 linter/jest: Fix indentation in code comment (#5372) (camc314)
- 2499cb9 linter/oxc: Update rule docs for `erasing-op` (#5376)
(camc314)
- 69493d2 linter/oxc: Improve diagnostic for `no-accumulating-spread` in
loops (#5374) (camc314)
- 024b585 linter/oxc: Improve code comment for `no-accumulating-spread`
(#5373) (camc314)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants