How to use the vue-eslint-parser.parseForESLint function in vue-eslint-parser

To help you get started, we’ve selected a few vue-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 SonarSource / SonarJS / eslint-bridge / src / parser.ts View on Github external
export function parseVueSourceFile(fileContent: string): SourceCode | ParsingError {
  let exceptionToReport: ParseException | null = null;
  for (const config of [PARSER_CONFIG_MODULE, PARSER_CONFIG_SCRIPT]) {
    try {
      const result = VueJS.parseForESLint(fileContent, config);
      return new SourceCode(fileContent, result.ast as any);
    } catch (exception) {
      exceptionToReport = exception;
    }
  }
  // if we reach this point, we are sure that "exceptionToReport" is defined
  return {
    line: exceptionToReport!.lineNumber,
    message: exceptionToReport!.message,
    code: ParseExceptionCode.Parsing,
  };
}

vue-eslint-parser

The ESLint custom parser for `.vue` files.

MIT
Latest version published 3 months ago

Package Health Score

89 / 100
Full package analysis

Similar packages