JAVASCRIPT   99

api.js

Guest on 21st August 2021 09:33:52 AM

  1. /**
  2.  * @fileoverview Expose out ESLint and CLI to require.
  3.  * @author Ian Christian Myers
  4.  */
  5.  
  6. "use strict";
  7.  
  8. const { CLIEngine } = require("./cli-engine");
  9. const { Linter } = require("./linter");
  10. const { RuleTester } = require("./rule-tester");
  11. const { SourceCode } = require("./source-code");
  12.  
  13. module.exports = {
  14.     Linter,
  15.     CLIEngine,
  16.     RuleTester,
  17.     SourceCode
  18. };
  19.  
  20. // DOTO: remove deprecated API.
  21. let deprecatedLinterInstance = null;
  22.  
  23. Object.defineProperty(module.exports, "linter", {
  24.     enumerable: false,
  25.     get() {
  26.         if (!deprecatedLinterInstance) {
  27.             deprecatedLinterInstance = new Linter();
  28.         }
  29.  
  30.         return deprecatedLinterInstance;
  31.     }
  32. });

Raw Paste


Login or Register to edit or fork this paste. It's free.