Hello,
I ran into an issue where some of the lines from the ERB and Vue installers were not added to my environment.js, though this could apply to any of the installers.
I figured out after looking through the source that it was because I added semicolons to my environment.js
I can see a couple solutions for how to resolve this:
I've been thinking about this some more and realized that using a standard eslint config will also change quotes from single to double.
I'm currently working on a PR, and my regex is now looking like this (with both kinds of quotes and optional semicolon):
/require\(('|")@rails\/webpacker('|")\);?\n/
Another solution I came up with is avoid the quotes and semicolon completely:
/@rails\/webpacker.*\n/
Do either of these seem like good solutions? I also thought a helper method may be useful which converts a string like "require('@rails/webpacker')\n" to a regular expression that accounts for the quotes and the semicolon so regular expressions don't have to be written for every single string.
Kind of related, is there a reason not to use semicolons (and double quotes) by default?
Kind of related, is there a reason not to use semicolons (and double quotes) by default?
It's a contentious topic amongst developers. I fall on the "include semicolons" side since there are cases where ASI does not work. That being said, I respect that this repo falls on the "omit semicolons" side.
Single/double quotes are kind of interchangeable in JS, but not in ruby. If you submit a PR, I can provide feedback there. (it's easier to discuss with file context)
Done, thanks for the feedback