Skip to content

range and loc options are always true #694

Closed
@ehmicky

Description

@ehmicky

What code were you trying to parse?

typescriptEstree.parse('true', {range: false, loc: false})

What did you expect to happen?

The returned node should not include the range or loc properties.

What actually happened?

{
  "type": "Program",
  "body": [
    {
      "type": "ExpressionStatement",
      "expression": {
        "type": "Literal",
        "value": true,
        "raw": "true",
        "range": [
          0,
          4
        ],
        "loc": {
          "start": {
            "line": 1,
            "column": 0
          },
          "end": {
            "line": 1,
            "column": 4
          }
        }
      },
      "range": [
        0,
        4
      ],
      "loc": {
        "start": {
          "line": 1,
          "column": 0
        },
        "end": {
          "line": 1,
          "column": 4
        }
      }
    }
  ],
  "sourceType": "script",
  "range": [
    0,
    4
  ],
  "loc": {
    "start": {
      "line": 1,
      "column": 0
    },
    "end": {
      "line": 1,
      "column": 4
    }
  }
}

Versions

package version
@typescript-eslint/typescript-estree 1.11.0
TypeScript 3.5.3
node 12.6.0
npm 6.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershas prthere is a PR raised to close thispackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions