Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

runtime(js): fix useTemplate #1862

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

runtime(js): fix useTemplate #1862

wants to merge 1 commit into from

Conversation

smorimoto
Copy link
Member

Template is another one that is already widely used and documented.

Signed-off-by: Sora Morimoto <sora@morimoto.io>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR updates various JavaScript runtime files to use template literals for string concatenation, thereby improving code readability and consistency.

  • Updated string concatenation in file path calculations of fs_fake.js
  • Replaced concatenated error messages and string operations with template literals in multiple runtime files
  • Standardized formatting across modules including sys.js, fs.js, str.js, wasm/runtime.js, graphics.js, ieee_754.js, parsing.js, unix.js, ints.js, io.js, jslib.js, and marshal.js

Reviewed Changes

File Description
runtime/js/fs_fake.js Converted concatenation syntax in path and regex generation to template literals
runtime/js/sys.js Updated error message and value formatting to template literals
runtime/js/fs.js Standardized string concatenation for error messages and function returns
runtime/js/str.js Reformatted escape sequence concatenation to use template literal
runtime/wasm/runtime.js Changed string construction to template literals for clarity
runtime/js/graphics.js Converted string concatenations for canvas operations into template literals
runtime/js/ieee_754.js Updated float formatting functions to use template literals
runtime/js/parsing.js Refactored log message concatenations to template literals
runtime/js/unix.js Updated system error message construction to template literals
runtime/js/ints.js Simplified integer conversion using String()
runtime/js/io.js Converted error message concatenations to template literals
runtime/js/jslib.js Updated log message formatting with template literals
runtime/js/marshal.js Replaced string concatenation with template literals in error handling

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Copy link
Member

@hhugo hhugo left a comment

Choose a reason for hiding this comment

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

I don't like complex expressions inside templates. They makes review harder in my experience.
I think I would prefer if templates only embed simple identifiers.

@hhugo hhugo marked this pull request as draft March 27, 2025 08:39
@smorimoto smorimoto added the js label Apr 1, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants