Repository: ember-cli/ember-cli
Pull request #8564 (2019-04-08 22:58:05)

Adds babel-eslint as the default ESlint parser
`ember-cli-babel` now supports class fields and decorators out of the
box, and we're currently on track to ship decorators as on by default in
Ember 3.10. However, users will get ESLint errors if they attempt to use
decorators, since it's default parser does not yet support them.

This PR adds the `babel-eslint` parser, which will allow things to work
as expected and has been what we've been recommending to early adopters
for some time.

It's worth noting that the next major version of `babel-eslint` seems to
be breaking, and will apparently _require_ a `.babelrc`. I'm not sure
whether or not we'll be able to support that, given `ember-cli-babel`
handles that type of configuration for us. We can probably continue
using `babel-eslint@10` until that gets sorted out.


Patch:
diff --git a/blueprints/app/files/.eslintrc.js b/blueprints/app/files/.eslintrc.js
index e407177cf..bcc44a953 100644
--- a/blueprints/app/files/.eslintrc.js
+++ b/blueprints/app/files/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/blueprints/app/files/package.json b/blueprints/app/files/package.json
index 29c56f5b2..3de93e395 100644
--- a/blueprints/app/files/package.json
+++ b/blueprints/app/files/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "~<%= emberCLIVersion %>",
diff --git a/blueprints/module-unification-addon/files/.eslintrc.js b/blueprints/module-unification-addon/files/.eslintrc.js
index e645c8e2b..657ee6fd5 100644
--- a/blueprints/module-unification-addon/files/.eslintrc.js
+++ b/blueprints/module-unification-addon/files/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/blueprints/module-unification-app/files/.eslintrc.js b/blueprints/module-unification-app/files/.eslintrc.js
index 2b50b69a4..0262f3d0f 100644
--- a/blueprints/module-unification-app/files/.eslintrc.js
+++ b/blueprints/module-unification-app/files/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/blueprints/module-unification-app/files/package.json b/blueprints/module-unification-app/files/package.json
index 66bd656d0..c6b2cc1e0 100644
--- a/blueprints/module-unification-app/files/package.json
+++ b/blueprints/module-unification-app/files/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "github:ember-cli/ember-cli",


Test patch:
diff --git a/tests/fixtures/addon/.eslintrc.js b/tests/fixtures/addon/.eslintrc.js
index 3a1abe9eb..93a9cfb56 100644
--- a/tests/fixtures/addon/.eslintrc.js
+++ b/tests/fixtures/addon/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/addon/npm/package.json b/tests/fixtures/addon/npm/package.json
index ace636abc..05f909569 100644
--- a/tests/fixtures/addon/npm/package.json
+++ b/tests/fixtures/addon/npm/package.json
@@ -26,6 +26,7 @@
   },
   "devDependencies": {
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-cli": "~<%= emberCLIVersion %>",
     "ember-cli-dependency-checker": "^3.1.0",
diff --git a/tests/fixtures/addon/yarn/package.json b/tests/fixtures/addon/yarn/package.json
index 4887d48e2..443e7b79f 100644
--- a/tests/fixtures/addon/yarn/package.json
+++ b/tests/fixtures/addon/yarn/package.json
@@ -26,6 +26,7 @@
   },
   "devDependencies": {
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-cli": "~<%= emberCLIVersion %>",
     "ember-cli-dependency-checker": "^3.1.0",
diff --git a/tests/fixtures/app/.eslintrc.js b/tests/fixtures/app/.eslintrc.js
index bab8ff522..d1e20558d 100644
--- a/tests/fixtures/app/.eslintrc.js
+++ b/tests/fixtures/app/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/app/npm/package.json b/tests/fixtures/app/npm/package.json
index 066a81374..f6d43c1a5 100644
--- a/tests/fixtures/app/npm/package.json
+++ b/tests/fixtures/app/npm/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "~<%= emberCLIVersion %>",
diff --git a/tests/fixtures/app/yarn/package.json b/tests/fixtures/app/yarn/package.json
index 6575a0f68..0adf382b1 100644
--- a/tests/fixtures/app/yarn/package.json
+++ b/tests/fixtures/app/yarn/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "~<%= emberCLIVersion %>",
diff --git a/tests/fixtures/module-unification-addon/.eslintrc.js b/tests/fixtures/module-unification-addon/.eslintrc.js
index e645c8e2b..657ee6fd5 100644
--- a/tests/fixtures/module-unification-addon/.eslintrc.js
+++ b/tests/fixtures/module-unification-addon/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/module-unification-addon/npm/.eslintrc.js b/tests/fixtures/module-unification-addon/npm/.eslintrc.js
index 2b5147733..43c0e36b3 100644
--- a/tests/fixtures/module-unification-addon/npm/.eslintrc.js
+++ b/tests/fixtures/module-unification-addon/npm/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/module-unification-addon/npm/package.json b/tests/fixtures/module-unification-addon/npm/package.json
index b5cba4e02..43f46f873 100644
--- a/tests/fixtures/module-unification-addon/npm/package.json
+++ b/tests/fixtures/module-unification-addon/npm/package.json
@@ -26,6 +26,7 @@
   },
   "devDependencies": {
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-cli": "<%= emberCLIVersion %>",
     "ember-cli-dependency-checker": "^3.1.0",
diff --git a/tests/fixtures/module-unification-addon/yarn/.eslintrc.js b/tests/fixtures/module-unification-addon/yarn/.eslintrc.js
index 2b5147733..43c0e36b3 100644
--- a/tests/fixtures/module-unification-addon/yarn/.eslintrc.js
+++ b/tests/fixtures/module-unification-addon/yarn/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/module-unification-addon/yarn/package.json b/tests/fixtures/module-unification-addon/yarn/package.json
index ee964baa3..0cdc94920 100644
--- a/tests/fixtures/module-unification-addon/yarn/package.json
+++ b/tests/fixtures/module-unification-addon/yarn/package.json
@@ -26,6 +26,7 @@
   },
   "devDependencies": {
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-cli": "<%= emberCLIVersion %>",
     "ember-cli-dependency-checker": "^3.1.0",
diff --git a/tests/fixtures/module-unification-app/.eslintrc.js b/tests/fixtures/module-unification-app/.eslintrc.js
index 2b50b69a4..0262f3d0f 100644
--- a/tests/fixtures/module-unification-app/.eslintrc.js
+++ b/tests/fixtures/module-unification-app/.eslintrc.js
@@ -1,5 +1,6 @@
 module.exports = {
   root: true,
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaVersion: 2018,
     sourceType: 'module'
diff --git a/tests/fixtures/module-unification-app/npm/package.json b/tests/fixtures/module-unification-app/npm/package.json
index d55c0e38a..0691ee73c 100644
--- a/tests/fixtures/module-unification-app/npm/package.json
+++ b/tests/fixtures/module-unification-app/npm/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "github:ember-cli/ember-cli",
diff --git a/tests/fixtures/module-unification-app/yarn/package.json b/tests/fixtures/module-unification-app/yarn/package.json
index 370cf9b4d..90067789c 100644
--- a/tests/fixtures/module-unification-app/yarn/package.json
+++ b/tests/fixtures/module-unification-app/yarn/package.json
@@ -20,6 +20,7 @@
   "devDependencies": {
     "@ember/jquery": "^0.6.0",
     "@ember/optional-features": "^0.7.0",
+    "babel-eslint": "^10.0.2",
     "broccoli-asset-rev": "^3.0.0",
     "ember-ajax": "^5.0.0",
     "ember-cli": "github:ember-cli/ember-cli",