hi.
separate the "old well known" JavaScript (ES3, ES5) from the "new modern" JavaScript (ES6, ES2015, ES7, etc). in addition to "visual difference" it may be very useful for transpiling based on file extensions.
new extension for the new JS era.
.es6, but what if _some_ my code is already contains ES7 features? one file will be .es6 and another .es7? .es8?.es2015? same problem as above – numeric extension. .es2016 and so on?.es from Erlang to JavaScript (as well as add .ecmascript if necessary).my personal proposal is .es (furthermore Babel is already can handle it).
what do you think?
I think adopting .es for EcmaScript is the best solution here. There are .erl, .escript and .hrl for Erlang — seems to be more than enough. Also the size of community behind each language should be considered — there are far more people using EcmaScript and there are more and more using ES6+ everyday.
/ cc @raganwald for some JavaScript-foo.
From the JavaScript perspective, .es is a great call for now. I somehow doubt there will be a .es7 or .es8, the community has realized that huge, monolithic major releases is very 1998. So... supporting .es6 is also sensible.
a lot of developers trying ES6/ES7 right now with Babel, even React is now compiled with it. so from this point of view ES7 with Babel (and .es7) is not too far future – I personally actively use Object Rest/Spread (so my .es6 files are not "valid" ES6 :scream_cat:) and saw class properties and decorators in the wild.
from the "official" point of view – ES6 is finally moving faster (V8, IE edge, FF) and ES7 is at "specs collecting" stage (afaik they want to call it ECMAScript 2016).
I'm not against .es6 – it may be very popular this year. I'm about that .es is more future proof and it can cover all of these numeric versions. but I don't know anything about Erlang + .es – how many devs really use it?
@deepsweet according to github search, there are 2,660 files in Erlang containing word "class" with .es extension: https://github.com/search?utf8=%E2%9C%93&q=class+language%3AErlang+extension%3Aes&type=Code&ref=searchresults
@marinintim for comparison: there are 22,194,794 for .js + 7,889 for .es6 + 51,715 for jsx containing word "class"
:scream_cat: imo break syntax highlighting for someone else is not the best idea... on the other hand – .es/.es6 now sounds like .php/.php3 but in fact they are completely different languages. .ecmascript (too long, but I have no ideas)?..
It seems like .es6 has already been added as an extension for JavaScript. Any traction on adding .es7 for JavaScript? I think writing ES7 code is become more popular -- especially as proposals are moving forward. I've been using the .es7 extension personally as well, and it's a slight disappointment to see it's not highlighted as JavaScript. I don't think there would be fear of a conflict there.
I think writing ES7 code is become more popular
I can only find 32 files on GitHub using this extension so I'd rather not add it at this point (see our contributing guidelines for the process).
If you'd like these to be syntax-highlighted then you could use the Emacs or Vim overrides.
I was just about to file an issue requesting .es be changed from Erlang to JavaScript. =)
If you guys are open to it, it'd be great to reconsider. As noted, .es is supported by Babel, by Flow — and even by your guys' own editor, Atom!
https://github.com/atom/language-javascript/blob/master/grammars/javascript.cson (yes .es)
https://github.com/jonathanmarvens/atom-language-erlang/blob/master/grammars/erlang.cson (no .es)
We use .es now to not tie our file extension to a particular version (e.g. we're already using ES7/ES2016 features), and to let us transpile to .js side-by-side. Syntax highlighting and tooling works great everywhere except for the GitHub website, which is a bummer.
Thanks for the consideration!
I was just about to file an issue requesting .es be changed from Erlang to JavaScript. =)
I'm definitely open to adding .es to JavaScript just as long as we can find a reliable heuristic for distinguishing between Erlang and JavaScript.
@aseemk - do you have any suggestions here?
@arfon: Sure. I'm not familiar with Erlang at all, but assuming the Wikipedia page and a quick GitHub search are both reasonable:
https://en.wikipedia.org/wiki/Erlang_(programming_language)
Looks like there should be plenty to differentiate from JS:
-module, -export, etc.%% comments (also % it looks like, maybe beginning of line?)->. at the end of the line (potentially valid JS, but probably almost never the case in practice)There's probably a bunch of JS syntax that isn't valid Erlang too, but hard for me to say.
:+1: to supporting .es for JavaScript / ES6 :+1:
:+1: for .es as JavaScript/ES6
Looks like there should be plenty to differentiate from JS:
@aseemk - would you be willing to have a go at creating a Pull Request for this change?
I'd be happy to try (though realistically not for 2-3 weeks).
I don't really know Ruby, and am new to this Heuristics class as well. =) Did some quick history and blame'ing; would adding this be basically the same as recent pull #2533? Anything more/less?
Finally, would you mind re-opening this issue then? Thanks!
I'd be happy to try (though realistically not for 2-3 weeks).
That's likely to be significantly faster than I will get to this :-\
I don't really know Ruby, and am new to this Heuristics class as well. =) Did some quick history and blame'ing; would adding this be basically the same as recent pull #2533? Anything more/less?
Yeah, #2533 is a good example to follow. Also please take a look at this section of the contributing guidelines as this has notes on how to add a new extension to a language.
Finally, would you mind re-opening this issue then? Thanks!
Done!
@aseemk - did you have a chance to look into this?
I have not, sorry! As usual, I overestimated my time and ability to context switch, etc.
@arfon / @aseemk: I'll happily tackle this tomorrow.
@Alhadis - awesome thanks!
@arfon The tests are failing, and I'm not sure why. Here's the feedback:
1) Failure:
TestGrammars#test_submodules_use_https_links [/Users/johngardner/Forks/GitHub-Linguist/test/test_grammars.rb:118]:
The following submodules don't have an HTTPS link:
* [email protected]:wmertens/sublime-nix.git.
--- expected
+++ actual
@@ -1 +1 @@
-[]
+["[email protected]:wmertens/sublime-nix.git"]
Clearly not related to my changes, but since this is keeping me from building and testing this locally, how can I fix it? EDIT: Never mind, I noticed this is the culprit. I worked around the failing tests by patching my .gitmodules file locally, but I'm leaving it out of the PR for the sake of a cleaner development history (atomic PRs, etc). You may want to patch the protocol the nix submodule's using.
Done! :-)
can it be used right after merging?
@deepsweet Nop, you'll have to wait for the next release of Linguist to see the effects sidewide. They usually come every couple of weeks ;)
This was fixed in #2920
You guys are awesome! Thank you @Alhadis in particular!
Most helpful comment
Done! :-)