Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a standardized ES6 file extension? If so, what is it?

I'm wondering if there's a standardized file extension for ES6 yet. So far I've seen .es6 and .es6.js as two options, but I'm curious if one is generally better supported by third party packages and tools. And if Mozilla is leaning a particular direction.

like image 688
CaptSaltyJack Avatar asked Jul 16 '15 17:07

CaptSaltyJack


People also ask

What is ES6 standard?

JavaScript ES6 (also known as ECMAScript 2015 or ECMAScript 6) is the newer version of JavaScript that was introduced in 2015. ECMAScript is the standard that JavaScript programming language uses. ECMAScript provides the specification on how JavaScript programming language should work.

What is the extension of JavaScript file?

JavaScript files have the file extension .js.

What does ES6 mean?

What is ES6? ES6 stands for ECMAScript 6. ECMAScript was created to standardize JavaScript, and ES6 is the 6th version of ECMAScript, it was published in 2015, and is also known as ECMAScript 2015.

What is ES or ECMAScript or ES6?

ES6 Syntax. EcmaScript (ES) is a standardised scripting language for JavaScript (JS). The current ES version supported in modern browsers is ES5. However, ES6 tackles a lot of the limitations of the core language, making it easier for devs to code.


1 Answers

There's no formal ES6/JS extension, although majority of people seem to prefer .js. ECMAScript specific suffixes aren't common.

Mozilla is using two extensions within Firefox and FirefoxOS: .js and .jsm. No ECMA Script specific suffixes.

For Gecko (the layout engine written largely in JS), they use both .js and .jsm. Example: one of the DOM modules source code.

In some other subprojects, such as Gaia, they use .js only. Example: "system" app for Firefox OS.

Note: .jsm is something specific to Gecko - it's a Javascript module.

Note: ECMAScript 6 is a standard that is later implemented in Firefox as Javascript. So those two terms are closely related, and are almost synonyms (source).

Heads up: source code on the Gecko side has the syntax that is plain JS with some extensions - some of which ended up in ECMA Script 6, some not. In general, though, Mozillians tend to follow ECMA Script spec closely. Possible differences are listed here.

like image 150
kamituel Avatar answered Sep 22 '22 18:09

kamituel