Skip to content

feat(linter) eslint-plugin-unicorn consistent function scoping#4948

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping
Aug 19, 2024
Merged

feat(linter) eslint-plugin-unicorn consistent function scoping#4948
graphite-app[bot] merged 1 commit intomainfrom
c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Aug 17, 2024

No description provided.

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 17, 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 17, 2024
Copy link
Contributor Author

camc314 commented Aug 17, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @camc314 and the rest of your teammates on Graphite Graphite

@camc314 camc314 force-pushed the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch 3 times, most recently from e180201 to 86a6d0e Compare August 17, 2024 19:13
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 17, 2024

CodSpeed Performance Report

Merging #4948 will not alter performance

Comparing c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping (247120f) with main (185eb20)

Summary

✅ 29 untouched benchmarks

@camc314 camc314 force-pushed the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch 5 times, most recently from 79e1a5e to 47f476d Compare August 17, 2024 19:58
@camc314 camc314 requested a review from DonIsaac August 17, 2024 19:58
@camc314 camc314 marked this pull request as ready for review August 17, 2024 19:59
@camc314 camc314 force-pushed the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch from 47f476d to 91d431e Compare August 17, 2024 20:28
@DonIsaac
Copy link
Contributor

Will review this afternoon.

@camc314 camc314 force-pushed the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch 3 times, most recently from f879f74 to 5ca0d45 Compare August 18, 2024 17:53
@DonIsaac DonIsaac added C-enhancement Category - New feature or request 0-merge Merge with Graphite Merge Queue labels Aug 19, 2024
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 19, 2024

Merge activity

  • Aug 18, 11:24 PM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 18, 11:29 PM EDT: DonIsaac added this pull request to the Graphite merge queue.
  • Aug 18, 11:32 PM EDT: DonIsaac merged this pull request with the Graphite merge queue.

@DonIsaac DonIsaac force-pushed the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch from fc7459b to 247120f Compare August 19, 2024 03:29
@graphite-app graphite-app bot merged commit 247120f into main Aug 19, 2024
@graphite-app graphite-app bot deleted the c/08-17-feat_linter_eslint-plugin-unicorn_consistent_function_scoping branch August 19, 2024 03:32
@Boshen
Copy link
Member

Boshen commented Aug 19, 2024

This broke ecosystem CI, https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/10448337921/job/28928727073

Is category correctness correct here?

@DonIsaac
Copy link
Contributor

I think so, but this should not ban callback functions. If @camc314 is unable to address this today then I will

@camc314
Copy link
Contributor Author

camc314 commented Aug 19, 2024

maybe this rule should ignore tests?

  x eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
   ,-[examples/napi/__tests__/error-msg.spec.ts:7:41]
 6 |   // @ts-expect-error
 7 |   t.throws(() => receiveString(function a() {}), {
   :                                         ^
 8 |     message:
   `----
  help: Move this function to the outer scope.

but i think it's ok for it to report call back functions? if you were adding an event listener multiple times, by moving the event listener to the outer scope (if possible), you avoid creating a function for each event you listen to - instead you'd just listen to one.

@Boshen
Copy link
Member

Boshen commented Aug 20, 2024

We don't have a good way to detect test files.

The warnings in preact is way too much https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/10461140451/job/28969595249

Should we change the category or improve the rule to make ecosystem CI green?

@DonIsaac
Copy link
Contributor

IMO, let's change the level until an improvement is merged. I'll get this in.

@DonIsaac
Copy link
Contributor

DonIsaac commented Aug 20, 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.

3 participants