How to use the babel-eslint.parseNoPatch function in babel-eslint

To help you get started, we’ve selected a few babel-eslint 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 / utils / eslintUtils.js View on Github external
export function runRule(code, eslint, sourceCode) {
  // Run the ESLint rule on the AST of the provided code.
  // Reference: http://eslint.org/docs/developer-guide/nodejs-api
  const ast = parseNoPatch(code, {
    sourceType: 'module',
  });
  const results = eslint.verify(new sourceCode(code, ast), {
    env: {es6: true},
    parserOptions: {
      ecmaVersion: 8,
      sourceType: 'module',
      ecmaFeatures: {experimentalObjectRestSpread: true},
    },
    rules: {
      astExplorerRule: 2,
    },
  });
  return formatResults(results);
}
github fkling / astexplorer / website / src / parsers / js / utils / eslint4Utils.js View on Github external
parse(code) {
      return parseNoPatch(code, { sourceType: 'module' });
    },
  });