Skip to content

Commit

Permalink
Specify babylon options
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Oct 5, 2015
1 parent 1e9e1db commit c50cb7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions lib/parsers/javascript.js
@@ -1,6 +1,6 @@
'use strict';

var babel = require('babel'),
var babylon = require('babylon'),
types = require('ast-types'),
extend = require('extend'),
isJSDocComment = require('../../lib/is_jsdoc_comment'),
Expand All @@ -19,6 +19,22 @@ function commentShebang(code) {
return (code[0] === '#' && code[1] === '!') ? '//' + code : code;
}

var parseOpts = {
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
allowHashBang: true,
ecmaVersion: 6,
strictMode: true,
sourceType: 'module',
locations: true,
features: {},
plugins: {
jsx: true,
flow: true
}
};


/**
* Receives a module-dep item,
* reads the file, parses the JavaScript, and parses the JSDoc.
Expand All @@ -30,7 +46,7 @@ function commentShebang(code) {
module.exports = function (data) {
var results = [];
var code = commentShebang(data.source),
ast = babel.parse(code);
ast = babylon.parse(code, parseOpts);

var visited = {};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"ast-types": "^0.8.12",
"babel": "^5.8.23",
"babylon": "^5.8.23",
"brfs": "^1.4.0",
"concat-stream": "^1.5.0",
"doctrine": "^0.6.4",
Expand Down

0 comments on commit c50cb7e

Please sign in to comment.