mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Migrate eslint to v9
This commit is contained in:
parent
bad8ea2c2e
commit
034e1bf328
106 changed files with 2130 additions and 1445 deletions
|
@ -4,7 +4,7 @@
|
|||
import { Module } from 'module'
|
||||
import { extname } from 'path'
|
||||
|
||||
function decachePlugin (require: NodeRequire, libraryPath: string) {
|
||||
function decachePlugin (require: NodeJS.Require, libraryPath: string) {
|
||||
const moduleName = find(require, libraryPath)
|
||||
|
||||
if (!moduleName) return
|
||||
|
@ -16,7 +16,7 @@ function decachePlugin (require: NodeRequire, libraryPath: string) {
|
|||
})
|
||||
}
|
||||
|
||||
function decacheModule (require: NodeRequire, name: string) {
|
||||
function decacheModule (require: NodeJS.Require, name: string) {
|
||||
const moduleName = find(require, name)
|
||||
|
||||
if (!moduleName) return
|
||||
|
@ -37,7 +37,7 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function find (require: NodeRequire, moduleName: string) {
|
||||
function find (require: NodeJS.Require, moduleName: string) {
|
||||
try {
|
||||
return require.resolve(moduleName)
|
||||
} catch {
|
||||
|
@ -45,14 +45,14 @@ function find (require: NodeRequire, moduleName: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function searchCache (require: NodeRequire, moduleName: string, callback: (current: NodeModule) => void) {
|
||||
function searchCache (require: NodeJS.Require, moduleName: string, callback: (current: NodeJS.Module) => void) {
|
||||
const resolvedModule = require.resolve(moduleName)
|
||||
let mod: NodeModule
|
||||
let mod: NodeJS.Module
|
||||
const visited = {}
|
||||
|
||||
if (resolvedModule && ((mod = require.cache[resolvedModule]) !== undefined)) {
|
||||
// Recursively go over the results
|
||||
(function run (current) {
|
||||
;(function run (current) {
|
||||
visited[current.id] = true
|
||||
|
||||
current.children.forEach(function (child) {
|
||||
|
@ -66,10 +66,10 @@ function searchCache (require: NodeRequire, moduleName: string, callback: (curre
|
|||
callback(current)
|
||||
})(mod)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function removeCachedPath (pluginPath: string) {
|
||||
const pathCache = (Module as any)._pathCache as { [ id: string ]: string[] }
|
||||
const pathCache = (Module as any)._pathCache as { [id: string]: string[] }
|
||||
|
||||
Object.keys(pathCache).forEach(function (cacheKey) {
|
||||
if (cacheKey.includes(pluginPath)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue