createEngine.js 573 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = createEngine;
  6. var _objectHash = _interopRequireDefault(require("object-hash"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. const engines = {};
  9. function createEngine(options) {
  10. const {
  11. CLIEngine
  12. } = require(options.eslintPath);
  13. const hash = (0, _objectHash.default)(options);
  14. if (!engines[hash]) {
  15. engines[hash] = new CLIEngine(options);
  16. }
  17. return {
  18. CLIEngine,
  19. engine: engines[hash]
  20. };
  21. }