Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using `espree` or `acorn` instead of esprima #332

tunnckoCore opened this issue Mar 23, 2015 · 6 comments · Fixed by #345


Copy link

@tunnckoCore tunnckoCore commented Mar 23, 2015

Hi again. When try to run koa tests it fails because esprima not support generators and many more features actually. So i tried to replace esprima with espree and it works without any changes, because it's almost 100% compatible with esprima - actually it is a fork.

var tree = Esprima.parse(content, {
    loc: true,
    comment: true,
    range: true,
    ecmaFeatures: {
        generators: true

list of es6 features.. or

    ecmaFeatures: {

        // enable parsing of arrow functions
        arrowFunctions: true,

        // enable parsing of let/const
        blockBindings: true,

        // enable parsing of destructured arrays and objects
        destructuring: true,

        // enable parsing of regular expression y flag
        regexYFlag: true,

        // enable parsing of regular expression u flag
        regexUFlag: true,

        // enable parsing of template strings
        templateStrings: true,

        // enable parsing of binary literals
        binaryLiterals: true,

        // enable parsing of ES6 octal literals
        octalLiterals: true,

        // enable parsing unicode code point escape sequences
        unicodeCodePointEscapes: true,

        // enable parsing of default parameters
        defaultParams: true,

        // enable parsing of rest parameters
        restParams: true,

        // enable parsing of for-of statement
        forOf: true,

        // enable parsing computed object literal properties
        objectLiteralComputedProperties: true,

        // enable parsing of shorthand object literal methods
        objectLiteralShorthandMethods: true,

        // enable parsing of shorthand object literal properties
        objectLiteralShorthandProperties: true,

        // Allow duplicate object literal properties (except '__proto__')
        objectLiteralDuplicateProperties: true,

        // enable parsing of generators/yield
        generators: true,

        // enable parsing spread operator
        spread: true,

        // enable parsing classes
        classes: true,

        // enable parsing of modules
        modules: true,

        // enable React JSX parsing
        jsx: true,

        // enable return in global scope
        globalReturn: true

This comment has been minimized.

Copy link

@Marsup Marsup commented Mar 23, 2015

I'd vote for espree considering the way the project is lead.


This comment has been minimized.

Copy link

@tunnckoCore tunnckoCore commented Mar 23, 2015

yea, looks great 👍

@geek geek added the request label Mar 23, 2015

This comment has been minimized.

Copy link

@geek geek commented Mar 23, 2015

Thoughts on esprima v2 ?


This comment has been minimized.

Copy link

@tunnckoCore tunnckoCore commented Mar 23, 2015

2015-03-09: Version 2.1.0

      * Support ES6 class (issue 1001)
      * Support ES6 rest parameter (issue 1011)
      * Expand the location of property getter, setter, and methods (issue 1029)
      * Enable TryStatement transition to a single handler (issue 1031)
      * Support ES6 computed property name (issue 1037)
      * Tolerate unclosed block comment (issue 1041)
      * Support ES6 lexical declaration (issue 1065)

2015-02-06: Version 2.0.0

      * Support ES6 arrow function (issue 517)
      * Support ES6 Unicode code point escape (issue 521)
      * Improve the speed and accuracy of comment attachment (issue 522)
      * Support ES6 default parameter (issue 519)
      * Support ES6 regular expression flags (issue 557)
      * Fix scanning of implicit octal literals (issue 565)
      * Fix the handling of automatic semicolon insertion (issue 574)
      * Support ES6 method definition (issue 620)
      * Support ES6 octal integer literal (issue 621)
      * Support ES6 binary integer literal (issue 622)
      * Support ES6 object literal property value shorthand (issue 624)

seems not enough? not solves my use case - generators


This comment has been minimized.

Copy link

@k-sheth k-sheth commented Apr 3, 2015

+1 for either espree or esprima2. not using generators, but let, const, arrow functions... the basic good stuff

Josiah added a commit to Josiah/lab that referenced this issue Apr 6, 2015
Provides support for ES6 features such as generators.

Suggested in hapijs#332
@geek geek self-assigned this Apr 20, 2015
@geek geek added the dependency label Apr 20, 2015
@geek geek added this to the 5.6.1 milestone Apr 20, 2015
@geek geek mentioned this issue Apr 20, 2015
@geek geek closed this in #345 Apr 20, 2015

This comment has been minimized.

Copy link

@tunnckoCore tunnckoCore commented Apr 20, 2015

@geek awesome! :)

next step, externalize the coverage stuff, haha

@Marsup Marsup added feature and removed request labels Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.