Skip to content
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

refactor: Use template literals instead of string concatenation when building popup HTML #1464

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

Conversation

tora-pan
Copy link
Contributor

@tora-pan tora-pan commented Mar 19, 2023

The inline variable replacement of template literals allows us to remain the desired HTML shape of the string.

Renamed variables for better readability.

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Merging #1464 (52467cb) into main (905358e) will increase coverage by 0.23%.
The diff coverage is 80.82%.

@@            Coverage Diff             @@
##             main    #1464      +/-   ##
==========================================
+ Coverage   79.62%   79.86%   +0.23%     
==========================================
  Files           7        7              
  Lines        3004     3005       +1     
  Branches      189      189              
==========================================
+ Hits         2392     2400       +8     
+ Misses        607      600       -7     
  Partials        5        5              
Impacted Files Coverage Δ
extension/data.ts 83.01% <80.82%> (+0.68%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@melink14 melink14 changed the title refactor: Use template strings to read more like HTML refactor: Use template literals instead of string concatenation when building popup HTML Mar 19, 2023
Copy link
Owner

@melink14 melink14 left a comment

Choose a reason for hiding this comment

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

This seems fine overall but will need to take a block of time to study it since it produced a non-trivial diff.

Since several of the branches don't have tests (not your fault) we might want to add those first so we can be confident in the refactor. (I can do it as well if you don't have time or desire)

Finally, I agree the variable renaming is good but I would probably have done that in it's own PR first since it leads to cleaner diffs and easier to review PR. That said, it's only a minor inconvenience in this case so it's not worth struggling with git to split it! It's something to consider in the future though!

I also updated the title and body a little bit to have the title focus on exactly what was done and the body give extra context for why (and thanks for separately mentioning renames! that's very important when combining changes!). It was very close already though so only needed minor tweaks ('need' is a strong word here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants