Skip to content

Commit

Permalink
Babel setup for async/await (#1692)
Browse files Browse the repository at this point in the history
* adds babel support for async/await with transpilation to ES2015 generators for backward compatibility with node 6 + working example of function converted to async/await syntax in linter.js

* rewrites run, scan, scanFile, getAddonMetadata and extractMetadata functions

* refactors the rest of the promises in linter.js

* fixes comments from second of review

* reverts unnecessary chahges from third round of review
  • Loading branch information
Milovanova Natalia authored and EnTeQuAk committed Dec 19, 2017
1 parent a62031c commit 2025658
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 294 deletions.
14 changes: 13 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"presets": ["es2015", "stage-2"],
"presets": [
"es2015",
"stage-2"
],
"plugins": [
"transform-class-properties",
"transform-es2015-modules-commonjs",
"syntax-async-functions",
"transform-async-to-generator",
[
"transform-runtime",
{
"polyfill": false,
"regenerator": true
}
]
]
}
7 changes: 6 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rules":{
"no-console": 0,
// Inherited from airbnb via eslint-config-amo
'function-paren-newline': 0,
"function-paren-newline": 0
},
"env": {
"node": true,
Expand All @@ -11,7 +11,12 @@
},
"extends": "amo",
"parser": "babel-eslint",
"plugins": [
"async-await"
],
"settings": {
"async-await/space-after-async": 2,
"async-await/space-after-await": 2,
"import/resolver": {
"node": {
// This adds ./src for relative imports.
Expand Down
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,22 @@
"babel-eslint": "8.0.2",
"babel-jest": "22.0.0",
"babel-loader": "7.1.2",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.6.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-stage-2": "6.24.1",
"babel-runtime": "6.26.0",
"comment-json": "1.1.3",
"coveralls": "3.0.0",
"deepmerge": "2.0.1",
"eslint-config-amo": "1.0.0",
"eslint-plugin-async-await": "0.0.0",
"eslint-plugin-jest": "21.3.2",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-promise": "3.5.0",
"gfm.css": "1.1.1",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.1.0",
Expand All @@ -57,7 +62,7 @@
"is-mergeable-object": "1.1.0",
"isparta": "4.0.0",
"jest": "22.0.1",
"jest-raw-loader": "^1.0.1",
"jest-raw-loader": "1.0.1",
"json-loader": "0.5.7",
"load-grunt-configs": "1.0.0",
"load-grunt-tasks": "3.5.2",
Expand All @@ -66,7 +71,7 @@
"markdown-it": "8.4.0",
"markdown-it-anchor": "4.0.0",
"markdown-it-emoji": "1.4.0",
"raw-loader": "^0.5.1",
"raw-loader": "0.5.1",
"request": "2.83.0",
"sinon": "4.1.3",
"tar": "4.1.0",
Expand All @@ -88,9 +93,9 @@
"eslint-plugin-no-unsafe-innerhtml": "1.0.16",
"esprima": "3.1.3",
"first-chunk-stream": "2.0.0",
"fluent": "^0.4.1",
"fluent": "0.4.1",
"jed": "1.1.1",
"pino": "^4.6.0",
"pino": "4.6.0",
"postcss": "6.0.14",
"probe-image-size": "3.2.0",
"relaxed-json": "1.0.1",
Expand Down
Loading

0 comments on commit 2025658

Please sign in to comment.