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

JS: Strip trailing/leading whitespace in externs (+ warn) #589

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marzipankaiser
Copy link
Contributor

@marzipankaiser marzipankaiser commented Sep 11, 2024

Fixes #569.

This basically applies this suggestion: #569 (comment)
but generates a warning instead of an error.

We do not seem to use this anywhere.

val end = l.last
val mid = l.tail.init
if (start.matches("""^\s.*""") || end.matches(""".*\s$""")) {
Context.warning("Extern string in js has trailing / leading whitespace. This will be removed.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this warning can be very annoying, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be - we're not using it anywhere yet, so...
I can also remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the perfect place for a warning, tbh. It will fire only on new code that is potentially problematic. :)

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

Successfully merging this pull request may close these issues.

Multiline control externs broken by JS semicolon insertion
3 participants