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

Enforce no mix interpolation #19700

Merged
merged 4 commits into from Dec 20, 2018
Merged

Conversation

erwinmombay
Copy link
Member

Instead of outright banning non literal strings, we just want to make sure the user doesn't interleave template literal interpolation and strformat style interpolation as this makes the transformers job of tracking positioning harder.

@erwinmombay erwinmombay changed the title Enforce no mix Enforce no mix interpolation Dec 6, 2018
@erwinmombay erwinmombay added this to In progress in December Binary Size War Room via automation Dec 6, 2018
Copy link
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Why not convert all these to %s strings?

@erwinmombay
Copy link
Member Author

@jridgewell do you mean for the whole codebase? The was the original plan. but now we want to allow template literals if the user wants to since we can generate the string format message (%s) in the transformer.

@jridgewell
Copy link
Contributor

No, I mean these corrected uses. If we're just gonna convert them in the transformer, why not convert them now?

@erwinmombay
Copy link
Member Author

@jridgewell thats fair. will fix

@erwinmombay
Copy link
Member Author

@jridgewell done

@erwinmombay erwinmombay force-pushed the enforce-no-mix branch 5 times, most recently from dbcc962 to 29e4701 Compare December 19, 2018 20:28
Instead of outright banning non literal strings, we just want to make
sure the user doesn't interleave template literal interpolation and
strformat style interpolation as this makes the transformers job of
tracking positioning harder.
@erwinmombay erwinmombay merged commit ab2d631 into ampproject:master Dec 20, 2018
December Binary Size War Room automation moved this from In progress to Done Dec 20, 2018
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* enforce no mixing of interpolation styles

* refactor the no-non-string-log-args lint rule to no-mixed-interpolation

Instead of outright banning non literal strings, we just want to make
sure the user doesn't interleave template literal interpolation and
strformat style interpolation as this makes the transformers job of
tracking positioning harder.

* switch to strformat the mixed call sites

* skip failing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants