Skip to content

Lint: replace string concatenation with template strings, replace unary plus with Number() #39709

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 6 commits into from
May 30, 2025

Conversation

Josh-Cena
Copy link
Member

Our style guide requires using template literals instead of string concatenation. This PR fixes all remaining cases.

@Josh-Cena Josh-Cena requested review from a team as code owners May 27, 2025 16:35
@Josh-Cena Josh-Cena requested review from wbamberg, estelle, willdurand and bsmth and removed request for a team, wbamberg, estelle and willdurand May 27, 2025 16:35
@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:Accessibility Accessibility docs Content:SVG SVG docs Content:WebDriver WebDriver docs labels May 27, 2025
@github-actions github-actions bot added Content:Games Games docs size/m [PR only] 51-500 LoC changed labels May 27, 2025
Copy link
Contributor

github-actions bot commented May 27, 2025

Preview URLs (80 pages)
Flaws (31)

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

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/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/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/Document_Object_Model/Examples
Title: Examples of web and XML development using the DOM
Flaw count: 2

  • macros:
    • Macro produces link /en-US/docs/Web/API/Document_Object_Model/Events which is a redirect
    • Macro produces link /en-US/docs/Web/API/Document_Object_Model/Whitespace_in_the_DOM which is a redirect

URL: /en-US/docs/Web/API/HTMLInputElement/files
Title: HTMLInputElement: files property
Flaw count: 1

  • broken_links:
    • /en-US/docs/Web/API/HTMLinputElement/webkitEntries is ill cased

URL: /en-US/docs/Web/API/HTMLMediaElement
Title: HTMLMediaElement
Flaw count: 6

  • macros:
    • Can't resolve /en-US/docs/Web/API/MediaController
    • Can't resolve /en-US/docs/Web/API/MediaController
    • Can't resolve /en-US/docs/Web/API/HTMLMediaElement/mozAudioCaptured
    • Can't resolve /en-US/docs/Web/API/HTMLMediaElement/mozFragmentEnd
    • Can't resolve /en-US/docs/Web/API/HTMLMediaElement/mozCaptureStreamUntilEnded
    • and 1 more flaws omitted

URL: /en-US/docs/Web/CSS/@container
Title: @container
Flaw count: 9

  • broken_links:
    • Can't resolve /en-US/docs/Web/CSS/block-contents
    • Can't resolve /en-US/docs/Web/CSS/size-feature
    • Can't resolve /en-US/docs/Web/CSS/style-feature
    • Can't resolve /en-US/docs/Web/CSS/scroll-state-feature
    • Can't resolve /en-US/docs/Web/CSS/function-token
    • and 4 more flaws omitted

URL: /en-US/docs/Web/CSS/calc-keyword
Title: <calc-keyword>
Flaw count: 2

  • macros:
    • Can't resolve /en-US/docs/Web/CSS/calc-product
    • Can't resolve /en-US/docs/Web/CSS/calc-value

URL: /en-US/docs/Web/SVG/Reference/Attribute/alignment-baseline
Title: alignment-baseline
Flaw count: 1

  • macros:
    • Macro produces link /en-US/docs/Glossary//Baseline/Typography which is a redirect

(comment last updated: 2025-05-30 14:28:47)

@Josh-Cena Josh-Cena changed the title Lint: replace string concatenation with template strings Lint: replace string concatenation with template strings, replace unary plus with Number() May 27, 2025
@github-actions github-actions bot added Content:wasm WebAssembly docs size/xl [PR only] >1000 LoC changed labels May 30, 2025
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.

Everything looks good to me except https://pr39709.review.mdn.allizom.net/en-US/docs/Web/API/Document_Object_Model/Examples which has some minor things to fix. Small tidy and we're good to go

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.

Thanks, I think everything's good now 👍🏻

@Josh-Cena Josh-Cena merged commit 6d20009 into mdn:main May 30, 2025
8 checks passed
@Josh-Cena Josh-Cena deleted the prefer-template branch May 30, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Accessibility Accessibility docs 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:SVG SVG docs Content:wasm WebAssembly docs Content:WebAPI Web API docs Content:WebDriver WebDriver docs Content:WebExt WebExtensions docs size/m [PR only] 51-500 LoC changed size/xl [PR only] >1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants