How to use the eslint-module-utils/module-require.default function in eslint-module-utils

To help you get started, we’ve selected a few eslint-module-utils 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 benmosher / eslint-plugin-import / memo-parser / index.js View on Github external
options = Object.assign({}, options, parserOptions)

  if (!options.filePath) {
    throw new Error('no file path provided!')
  }

  const keyHash = crypto.createHash('sha256')
  keyHash.update(content)
  hashObject(options, keyHash)

  const key = keyHash.digest('hex')

  let ast = cache.get(key)
  if (ast != null) return ast

  const realParser = moduleRequire(options.parser)

  ast = realParser.parse(content, options)
  cache.set(key, ast)

  return ast
}