How to use the @typescript-eslint/parser.parse 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 typescript-eslint / typescript-eslint / packages / benchmark / parsers.js View on Github external
function runTSParser(directory, files) {
  for (const file of files) {
    const result = tsParser.parse(
      fs.readFileSync(path.join(__dirname, file), 'utf8'),
        comment: true,
        tokens: true
    if (result.type !== 'Program') {
      throw new Error('something went wrong');