Files
NapCatQQ/.pnpm-store/v3/files/33/9829aeea0a622b8f610714376f6db809763b2753d69569bb5ada88abf7053c7ad8b9e1b5ef9887155f10b1d7745cc1cac974145d3ca37d1c1f81023a830e0a
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

50 lines
1.3 KiB
Plaintext

"use strict"
const { getTsconfig, parseTsconfig } = require("get-tsconfig")
const { getPhysicalFilename, getFilename } = require("./eslint-compat")
const fsCache = new Map()
/**
* Attempts to get the ExtensionMap from the tsconfig given the path to the tsconfig file.
*
* @param {string} filename - The path to the tsconfig.json file
* @returns {import("get-tsconfig").TsConfigJsonResolved}
*/
function getTSConfig(filename) {
return parseTsconfig(filename, fsCache)
}
/**
* Attempts to get the ExtensionMap from the tsconfig of a given file.
*
* @param {string} filename - The path to the file we need to find the tsconfig.json of
* @returns {import("get-tsconfig").TsConfigResult | null}
*/
function getTSConfigForFile(filename) {
return getTsconfig(filename, "tsconfig.json", fsCache)
}
/**
* Attempts to get the ExtensionMap from the tsconfig of a given file.
*
* @param {import('eslint').Rule.RuleContext} context - The current eslint context
* @returns {import("get-tsconfig").TsConfigResult | null}
*/
function getTSConfigForContext(context) {
const filename = getPhysicalFilename(context) ?? getFilename(context)
return getTSConfigForFile(filename)
}
module.exports = {
getTSConfig,
getTSConfigForFile,
getTSConfigForContext,
}
/**
* @typedef {string} TSConfigPath
*/
module.exports.schema = { type: "string" }