This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Added es6.erb fileType for source.js.rails#61
Open
bbugh wants to merge 1 commit intoatom:masterfrom
bbugh:fix-es6.erb
Open
Added es6.erb fileType for source.js.rails#61bbugh wants to merge 1 commit intoatom:masterfrom bbugh:fix-es6.erb
bbugh wants to merge 1 commit intoatom:masterfrom
bbugh:fix-es6.erb
Conversation
winstliu
reviewed
Oct 21, 2017
| 'name': 'JavaScript (Rails)' | ||
| 'fileTypes': [ | ||
| 'js.erb' | ||
| 'js.erb', |
Contributor
Filetypes have been simple enough thus far that we haven't had to add specs for them :). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Sprockets 4 beta (finally) adds functionality for compiling ES6 as part of the asset pipeline. Hurray! They've decided that the filename must end in
.es6, which when combined with.erblike.js.erbends up with files likebestfileever.es6.erb. Unfortunately, this package doesn't recognize that. This very tiny PR adds.es6.erbto the fileType list so that it selects the file syntax correctly (currently it's guessing HTML).Here's where Sprockets describes this setup: https://github.com/rails/sprockets/blob/master/UPGRADING.md#es6-support
Benefits
People who are trying to use modern JavaScript in their Rails files won't have to suffer with HTML syntax or have to manually choose the file type over and over.
Possible Drawbacks
Sprockets might choose to use some other sane file extension (like
.js.erb?!) but we're stuck with it for now. If that happens, this package would still be covering the existing cases.Applicable Issues
There was surprisingly no tests for fileType selection for any of the grammars, and I'm unsure how to add them. It worked on my machine® though.