Skip to content

Lint: migrate function expressions to arrow functions or declarations #39666

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Josh-Cena
Copy link
Member

Our coding style guide prescribes the use of arrow functions for callbacks, and function declarations for creating identifier bindings. This PR removes most usage of function expressions.

@Josh-Cena Josh-Cena requested review from a team as code owners May 25, 2025 05:54
@Josh-Cena Josh-Cena requested review from chrisdavidmills, hamishwillee, sideshowbarker, scottaohara and willdurand and removed request for a team May 25, 2025 05:54
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:WebExt WebExtensions docs Content:WebAPI Web API docs Content:JS JavaScript docs Content:Learn Learning area docs Content:HTTP HTTP docs Content:Accessibility Accessibility docs Content:Media Media docs Content:Games Games docs Content:Meta Content in the meta docs labels May 25, 2025
@Josh-Cena Josh-Cena removed request for a team and chrisdavidmills May 25, 2025 05:54
@Josh-Cena Josh-Cena requested review from a team, willdurand, wbamberg and scottaohara and removed request for a team May 25, 2025 05:54
@github-actions github-actions bot added the size/m [PR only] 51-500 LoC changed label May 25, 2025
@Josh-Cena Josh-Cena removed request for a team, willdurand, wbamberg and scottaohara May 25, 2025 05:54
Copy link
Contributor

github-actions bot commented May 25, 2025

Preview URLs (48 pages)
Flaws (39)

Note! 37 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Bounce_off_the_walls
Title: Bounce off the walls
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Move_the_ball which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Paddle_and_keyboard_controls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Move_the_ball which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Paddle_and_keyboard_controls which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Build_the_brick_field
Title: Build the brick field
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Game_over which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Collision_detection which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Game_over which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Collision_detection which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Collision_detection
Title: Collision detection
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Build_the_brick_field which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Track_the_score_and_win which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Build_the_brick_field which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Track_the_score_and_win which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Finishing_up
Title: Finishing up
Flaw count: 2

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Mouse_controls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Mouse_controls which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Game_over
Title: Game over
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Paddle_and_keyboard_controls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Build_the_brick_field which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Paddle_and_keyboard_controls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Build_the_brick_field which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Mouse_controls
Title: Mouse controls
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Track_the_score_and_win which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Finishing_up which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Track_the_score_and_win which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Finishing_up which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Move_the_ball
Title: Move the ball
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Create_the_Canvas_and_draw_on_it which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Bounce_off_the_walls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Create_the_Canvas_and_draw_on_it which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Bounce_off_the_walls which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Paddle_and_keyboard_controls
Title: Paddle and keyboard controls
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Bounce_off_the_walls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Game_over which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Bounce_off_the_walls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Game_over which is a redirect

URL: /en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Track_the_score_and_win
Title: Track the score and win
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Collision_detection which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Mouse_controls which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Collision_detection which is a redirect
    • Macro produces link /en-US/docs/Games/Workflows/2D_Breakout_game_pure_JavaScript/Mouse_controls which is a redirect

URL: /en-US/docs/Learn_web_development/Core/Structuring_content/General_embedding_technologies
Title: From object to iframe — general embedding technologies
Flaw count: 1

  • broken_links:
    • /en-US/docs/Learn_web_development/Core/Structuring_content/ is a redirect

URL: /en-US/docs/Web/HTTP/Guides/Browser_detection_using_the_user_agent
Title: Browser detection using the user agent string (UA sniffing)
Flaw count: 4

  • macros:
    • Macro produces link /en-US/docs/Glossary/rendering_engine which is a redirect
  • unknown:
    • No generic content config found
    • no blog root
    • no blog root

(comment last updated: 2025-05-27 11:23:17)

@Josh-Cena Josh-Cena force-pushed the prefer-arrow-callback branch from 4b5d6e4 to c4e2fd1 Compare May 25, 2025 09:45
@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label May 27, 2025
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot added merge conflicts 🚧 [PR only] and removed merge conflicts 🚧 [PR only] Content:Accessibility Accessibility docs labels May 27, 2025
@@ -10,7 +10,7 @@ browser-compat: webextensions.api.contentScriptGlobalScope.cloneInto
This function provides a safe way to take an object defined in a privileged scope and create a [structured clone](/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) of it in a less-privileged scope. It returns a reference to the clone:

```js
var clonedObject = cloneInto(myObject, targetWindow);
const clonedObject = cloneInto(myObject, targetWindow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @rebloor, some code style / modernization changes here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably more appropriate for @Rob--W or @dotproto to comment.

Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM me, thanks. Pinged rebloor for a look if you'd like to wait for his +1.

@Josh-Cena
Copy link
Member Author

Yes, I'm not particularly confident with the WebExt changes. I will wait for @rebloor's opinions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs Content:Games Games docs Content:HTTP HTTP docs Content:JS JavaScript docs Content:Learn Learning area docs Content:Media Media docs Content:Meta Content in the meta docs Content:WebAPI Web API docs Content:WebExt WebExtensions docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants