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

Specify default values of options in the README #325

Closed
Hirse opened this issue Mar 26, 2017 · 2 comments
Closed

Specify default values of options in the README #325

Hirse opened this issue Mar 26, 2017 · 2 comments

Comments

@Hirse
Copy link
Contributor

Hirse commented Mar 26, 2017

The Readme lists the available option of the parse function, but doesn't specify the default value for all of them.
From what I gathered from the source, it might make sense to update the example of the usage section to the following:

var espree = require("espree");

var ast = espree.parse(code, {

    // attach range information to each node
    range: false,

    // attach line/column location information to each node
    loc: false,

    // create a top-level comments array containing all comments
    comment: false,

    // attach comments to the closest relevant node as leadingComments and
    // trailingComments
    attachComment: false,

    // create a top-level tokens array containing all tokens
    tokens: false,

    // set to 3, 5 (default), 6, 7, or 8 to specify the version of ECMAScript syntax you want to use. 
    // You can also set to 2015 (same as 6), 2016 (same as 7), or 2017 (same as 8) to use the year-based naming.
    ecmaVersion: 5,

    // specify which type of script you're parsing (script or module, default is script)
    sourceType: "script",

    // specify additional language features
    ecmaFeatures: {

        // enable JSX parsing
        jsx: false,

        // enable return in global scope
        globalReturn: false,

        // enable implied strict mode (if ecmaVersion >= 5)
        impliedStrict: false,

        // allow experimental object rest/spread
        experimentalObjectRestSpread: false
    }
});
@kaicataldo
Copy link
Member

Sorry for the delay in responding to this. I think this change makes sense - how could we make it clear these are the default values? And would you be willing to make a PR?

@Hirse
Copy link
Contributor Author

Hirse commented Jun 19, 2017

Done: #342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants