Skip to content

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

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

Josh-Cena
Copy link
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 as code owners May 25, 2025 08:52
@Josh-Cena Josh-Cena requested review from chrisdavidmills, sideshowbarker and Rob--W 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 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, chrisdavidmills, sideshowbarker and Rob--W May 25, 2025 08:52
@github-actions github-actions bot added the size/m [PR only] 51-500 LoC changed label May 25, 2025
Copy link
Contributor

github-actions bot commented May 25, 2025

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)

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.

Looks good, thanks 👍🏻

@Josh-Cena Josh-Cena merged commit ffa6f58 into mdn:main May 27, 2025
8 checks passed
@Josh-Cena Josh-Cena deleted the eqeqeq branch May 27, 2025 12:53
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:HTML Hypertext Markup Language docs Content:JS JavaScript docs Content:Learn Learning area docs 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