Skip to content

Commit

Permalink
Bug 1617959: Switch to the babel-eslint parser and turn on support fo…
Browse files Browse the repository at this point in the history
…r optional chaining and nullish coalescing operator syntaxes. r=Standard8

The babel-eslint parser defaults to assuming all scripts are modules. Although
we're moving in that direction it seems reasonable to set the default as regular
scripts for now. All the places that were previously overriding the parser are
already specifying the sourceType in their eslint configs.

I chose to put the babel config in a file that babel itself won't look to avoid
the risk of this config impacting the use of babel elsewhere in the tree.

Differential Revision: https://phabricator.services.mozilla.com/D66127
  • Loading branch information
Mossop committed Mar 13, 2020
1 parent fe6641a commit 0937f05
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .babel-eslint.rc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: [
"@babel/plugin-syntax-optional-chaining",
"@babel/plugin-syntax-nullish-coalescing-operator",
],
};
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ const ignorePatterns = [
];

module.exports = {
parser: "babel-eslint",
parserOptions: {
sourceType: "script",
babelOptions: {
configFile: path.join(__dirname, ".babel-eslint.rc.js"),
},
},
ignorePatterns,
// Ignore eslint configurations in parent directories.
root: true,
Expand Down
1 change: 0 additions & 1 deletion browser/components/newtab/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
// When adding items to this file please check for effects on sub-directories.
parser: "babel-eslint",
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
Expand Down
1 change: 0 additions & 1 deletion devtools/client/debugger/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

module.exports = {
parser: "babel-eslint",
plugins: [
"react",
"mozilla",
Expand Down
62 changes: 43 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"license": "MPL-2.0",
"dependencies": {},
"devDependencies": {
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"babel-eslint": "10.1.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.0",
Expand Down
4 changes: 2 additions & 2 deletions tools/lint/eslint/manifest.tt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"visibility": "public",
"filename": "eslint.tar.gz",
"unpack": true,
"digest": "9426eacaf88ad4b81a5c02f3424a00e0dd424ccb46710acedc1e100bbe710a24b4ad407fe0d5b6540371cc860725cfb191094fcbd7a39a8a47a353d35eaec4d3",
"size": 9817597
"digest": "7e5f5db70f8b7ab6ec389392257ea10480c5b7e3c1721d44d4451ac16427f94b90723c79914eb31715611c5b85683c700344091c457e2f38bbb5a21012627f91",
"size": 9905333
}
]

0 comments on commit 0937f05

Please sign in to comment.