Files
NapCatQQ/.pnpm-store/v3/files/b2/7dbf5e03b37566a50cf41fdd0ddb88be7f1830efc1c235c6f6fd9332e39a90cbf0c2b3d005db684e5786ca3578dfeff03553c9cfa1354860fed80876b1f7aa
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

32 lines
1.0 KiB
Plaintext

import * as eslint from 'eslint';
import * as semver from 'semver';
import { c as convertConfigToRc } from './shared/eslint-compat-utils.1a5060cf.mjs';
import { c as convertOptionToLegacy } from './shared/eslint-compat-utils.cb6790c2.mjs';
import 'module';
let cacheLinter;
function getLinter() {
return cacheLinter != null ? cacheLinter : cacheLinter = getLinterInternal();
function getLinterInternal() {
if (semver.gte(eslint.Linter.version, "9.0.0-0")) {
return eslint.Linter;
}
return getLinterClassFromLegacyLinter();
}
}
function getLinterClassFromLegacyLinter() {
return class LinterFromLegacyLinter extends eslint.Linter {
static get version() {
return eslint.Linter.version;
}
verify(code, config, option) {
const { processor, ...otherConfig } = config || {};
const newConfig = convertConfigToRc(otherConfig, this);
const newOption = convertOptionToLegacy(processor, option, config || {});
return super.verify(code, newConfig, newOption);
}
};
}
export { getLinter };