ECMA Script 6 ESLint with lightning:lint

There is an Aura GitHub repo issue ESLint integration breaking ES6 compatible code where it states...

The Winter '18 patch that went out this week made all ES6 syntax valid to the linter.

While this applies directly to Validation When You Save Code Changes with the Developer Console and not Validation During Development Using the Salesforce CLI, it does confirm ES6 is now supported for Lightning development.

You can provide Custom “House Style” Rules using the --config CONFIG option for sfdx force:lightning:lint, but according to the CLI reference:

Only code style rules are used, while the rest are ignored.

So, attempting to specify ESLint parser options, parserOptions, in a .eslintrc.* file (https://eslint.org/docs/user-guide/configuring#specifying-parser-options), will not work.


I don't think it's possible to override es-lint rules used by Lightning Linter and you don't need to do this.

Even that the modern browsers support ES6 syntax natively, but the Lightning Framework supports only ES2015 Strict Mode + Promises. It doesn't support ES6 syntax yet as some old version of google-closure compiler is used to minimize the code, when "Debug" mode is disabled.

By default, the Lightning Component framework runs in production mode. This mode is optimized for performance. It uses the Google Closure Compiler to optimize and minimize the size of the JavaScript code. The method names and code are heavily obfuscated.

Enable Debug Mode for Lightning Components

There is quite old question here Use of ES6 Default Function Parameter Value Spec in Lightning Components and the related issue in Aura GitHub repo https://github.com/forcedotcom/aura/issues/50 but nobody from Salesforce confirmed when ES6 will be supported by Lightning Framework