From c65096020e4abc85bdc1b245cd904a4eb0cf794c Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Tue, 12 Mar 2024 15:04:49 +0100 Subject: [PATCH] refactor: Enable prefer-global rules --- eslint/general.js | 6 ++++-- src/init/ServerInitializer.ts | 1 - src/logging/Logger.ts | 1 - src/util/identifiers/BaseIdentifierStrategy.ts | 1 - test/unit/logging/Logger.test.ts | 1 - 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/eslint/general.js b/eslint/general.js index bf05ce45c..2930769b9 100644 --- a/eslint/general.js +++ b/eslint/general.js @@ -50,8 +50,10 @@ module.exports = { 'jsdoc/no-multi-asterisks': [ 'error', { allowWhitespace: true }], - 'node/prefer-global/buffer': 'off', - 'node/prefer-global/process': 'off', + 'node/prefer-global/buffer': [ 'error', 'always' ], + 'node/prefer-global/console': [ 'error', 'always' ], + 'node/prefer-global/process': [ 'error', 'always' ], + 'node/prefer-global/url': [ 'error', 'always' ], 'style/array-bracket-spacing': [ 'error', 'always', { singleValue: true, diff --git a/src/init/ServerInitializer.ts b/src/init/ServerInitializer.ts index b379f1d6d..27afa4002 100644 --- a/src/init/ServerInitializer.ts +++ b/src/init/ServerInitializer.ts @@ -1,5 +1,4 @@ import type { Server } from 'node:http'; -import { URL } from 'node:url'; import { promisify } from 'node:util'; import { getLoggerFor } from '../logging/LogUtil'; import { isHttpsServer } from '../server/HttpServerFactory'; diff --git a/src/logging/Logger.ts b/src/logging/Logger.ts index e97b1ba72..5bcbb81e8 100644 --- a/src/logging/Logger.ts +++ b/src/logging/Logger.ts @@ -1,5 +1,4 @@ import cluster from 'node:cluster'; -import process from 'node:process'; import type { LogLevel } from './LogLevel'; export interface LogMetadata { diff --git a/src/util/identifiers/BaseIdentifierStrategy.ts b/src/util/identifiers/BaseIdentifierStrategy.ts index 48260028f..b466198a8 100644 --- a/src/util/identifiers/BaseIdentifierStrategy.ts +++ b/src/util/identifiers/BaseIdentifierStrategy.ts @@ -1,4 +1,3 @@ -import { URL } from 'node:url'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import { errorTermsToMetadata } from '../errors/HttpErrorUtil'; import { InternalServerError } from '../errors/InternalServerError'; diff --git a/test/unit/logging/Logger.test.ts b/test/unit/logging/Logger.test.ts index 88aeda11b..212f6717d 100644 --- a/test/unit/logging/Logger.test.ts +++ b/test/unit/logging/Logger.test.ts @@ -1,4 +1,3 @@ -import process from 'node:process'; import { BaseLogger, WrappingLogger } from '../../../src/logging/Logger'; import type { LogMetadata, SimpleLogger } from '../../../src/logging/Logger';