File size: 1,517 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';

const eslint = require('eslint');
const semver = require('semver');
const convertConfig = require('./shared/eslint-compat-utils.503aeaae.cjs');
const convertOption = require('./shared/eslint-compat-utils.808b5669.cjs');
require('module');

function _interopNamespaceCompat(e) {
  if (e && typeof e === 'object' && 'default' in e) return e;
  const n = Object.create(null);
  if (e) {
    for (const k in e) {
      n[k] = e[k];
    }
  }
  n.default = e;
  return n;
}

const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);

let cacheLinter;
function getLinter() {
  return cacheLinter != null ? cacheLinter : cacheLinter = getLinterInternal();
  function getLinterInternal() {
    if (semver__namespace.gte(eslint__namespace.Linter.version, "9.0.0-0")) {
      return eslint__namespace.Linter;
    }
    return getLinterClassFromLegacyLinter();
  }
}
function getLinterClassFromLegacyLinter() {
  return class LinterFromLegacyLinter extends eslint__namespace.Linter {
    static get version() {
      return eslint__namespace.Linter.version;
    }
    verify(code, config, option) {
      const { processor, ...otherConfig } = config || {};
      const newConfig = convertConfig.convertConfigToRc(otherConfig, this);
      const newOption = convertOption.convertOptionToLegacy(processor, option, config || {});
      return super.verify(code, newConfig, newOption);
    }
  };
}

exports.getLinter = getLinter;