Skip to content

Lint: use strict equality, avoid numeric loss of precision - #39667

Merged
Josh-Cena merged 2 commits into
mdn:mainfrom
Josh-Cena:eqeqeq
May 27, 2025
Merged

Josh-Cena merged 2 commits into
mdn:mainfrom
Josh-Cena:eqeqeq

Conversation

@Josh-Cena

Copy link
Copy Markdown
Member

Avoid some features that commonly indicate subtle bugs:

  • Loose equality is forbidden by our style guide
  • Numeric literals that don't evaluate to the value they represent. I also fixed Suggestion: generate noteTable from only one octave #37617 so I don't have to type so many numeric literals
  • Avoid constant binary expressions (those whose result is deterministic)
  • Removed one example that involves sparse arrays since typed arrays can't be sparse anyway

@Josh-Cena
Josh-Cena requested review from a team, Rob--W, chrisdavidmills and sideshowbarker and removed request for a team May 25, 2025 08:52
@github-actions github-actions Bot added Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs Content:WebExt WebExtensions docs Content:WebAPI Web API docs Content:JS JavaScript docs Content:Learn Learning area docs (outside of one of the Learn:* subtags) Content:Games Games docs Content:PWA Progressive Web Apps content labels May 25, 2025
@Josh-Cena
Josh-Cena requested review from bsmth and removed request for a team, Rob--W, chrisdavidmills and sideshowbarker May 25, 2025 08:52
@github-actions github-actions Bot added the size/m [PR only] 51-500 LoC changed label May 25, 2025
@github-actions

github-actions Bot commented May 25, 2025 •

Copy link
Copy Markdown
Contributor
Preview URLs (66 pages)
Flaws (34)

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

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/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/Web/API/HTMLButtonElement/reportValidity
Title: HTMLButtonElement: reportValidity() method
Flaw count: 1

  • macros:
    • Macro produces link /en-US/docs/Web/API/HTMLElement/invalid_event which is a redirect

URL: /en-US/docs/Web/API/Web_Audio_API/Controlling_multiple_parameters_with_ConstantSourceNode
Title: Controlling multiple parameters with ConstantSourceNode
Flaw count: 1

  • macros:
    • Macro produces link /en-US/docs/Web/API/Web_Audio_API/Tools which is a redirect

URL: /en-US/docs/Web/API/Web_Audio_API/Simple_synth
Title: Example and tutorial: Simple synth keyboard
Flaw count: 1

  • macros:
    • Macro produces link /en-US/docs/Web/API/Web_Audio_API/Tools which is a redirect

URL: /en-US/docs/Web/API/Web_components/Using_custom_elements
Title: Using custom elements
Flaw count: 3

  • macros:
    • Macro produces link /en-US/docs/Web/Web_Components/Using_custom_elements which is a redirect
    • Macro produces link /en-US/docs/Web/Web_Components/Using_shadow_DOM which is a redirect
    • Macro produces link /en-US/docs/Web/Web_Components/Using_templates_and_slots which is a redirect

URL: /en-US/docs/Web/API/WebRTC_API/Perfect_negotiation
Title: Establishing a connection: The WebRTC perfect negotiation pattern
Flaw count: 1

  • macros:
    • Can't resolve /en-US/docs/Web/API/RTCDtlsTransport/statechange_event

URL: /en-US/docs/Web/API/WebRTC_API/Using_Encoded_Transforms
Title: Using WebRTC Encoded Transforms
Flaw count: 1

  • macros:
    • Can't resolve /en-US/docs/Web/API/RTCDtlsTransport/statechange_event
External URLs (1)

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/findLast
Title: TypedArray.prototype.findLast()

(comment last updated: 2025-05-27 12:12:32)

@bsmth bsmth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks 👍🏻

@Josh-Cena
Josh-Cena merged commit ffa6f58 into mdn:main May 27, 2025
@Josh-Cena
Josh-Cena deleted the eqeqeq branch May 27, 2025 12:53
zachernuk pushed a commit to zachernuk/content that referenced this pull request Jun 4, 2025
* Lint: use strict equality, avoid numeric loss of precision

* Fix
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Content:CSS Cascading Style Sheets docs Content:Games Games docs Content:HTML Hypertext Markup Language docs Content:JS JavaScript docs Content:Learn Learning area docs (outside of one of the Learn:* subtags) Content:PWA Progressive Web Apps content 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.

Suggestion: generate noteTable from only one octave

2 participants