How to use the @typescript-eslint/parser/package.json.version function in @typescript-eslint/parser

To help you get started, we’ve selected a few @typescript-eslint/parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fkling / astexplorer / website / src / parsers / js / typescript-eslint-parser.js View on Github external
import defaultParserInterface from './utils/defaultESTreeParserInterface';
import pkg from '@typescript-eslint/parser/package.json';

const ID = '@typescript-eslint/parser';

export default {

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage || '',
  locationProps: new Set(['loc', 'start', 'end', 'range']),

  loadParser(callback) {
    require(['@typescript-eslint/parser'], callback);

  parse(parser, code, options) {
    return parser.parse(code, options);

  getDefaultOptions() {
    return {
      range: true,
      loc: false,
      tokens: false,