Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump the eslint group across 1 directory with 3 updates #592

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config = {
],
'n/no-missing-import': [
'error',
{ allowModules: ['vscode'], typescriptExtensionMap: [['.ts', '']] },
{ allowModules: ['vscode'], tryExtensions: ['.js', '.json', '.ts'] },
],
'require-jsdoc': 'error',
'no-warning-comments': ['warn', { terms: ['todo'], location: 'start' }],
Expand Down
1,101 changes: 399 additions & 702 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@
"@types/path-is-inside": "^1.0.3",
"@types/semver": "^7.5.8",
"@types/vscode": "1.82.0",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@typescript/lib-dom": "npm:@types/web@^0.0.47",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"cspell": "^8.14.2",
"esbuild": "^0.23.1",
"eslint": "^8.57.0",
"eslint-config-stylelint": "^21.0.0",
"eslint-config-stylelint": "^22.0.0",
"eslint-plugin-jest": "^28.8.0",
"fast-glob": "^3.2.7",
"jest": "^27.4.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/enforce-unit-tests-per-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const tags = {
async function fileExists(filePath: string): Promise<boolean> {
try {
return (await fs.stat(filePath)).isFile();
} catch (err) {
} catch {
return false;
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/extension/__tests__/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jest.mock('vscode-languageclient/node', () => ({

import { EventEmitter } from 'events';
import vscode, { window } from 'vscode';
// eslint-disable-next-line n/no-missing-import
import { LanguageClient, SettingMonitor, NodeModule } from 'vscode-languageclient/node';
import {
DidRegisterDocumentFormattingEditProviderNotificationParams,
Expand Down Expand Up @@ -325,7 +324,7 @@ describe('Extension entry point', () => {
await new Promise((resolve) => setImmediate(resolve));

onNotification.mockImplementation((): void => {
throw 'String problem!';
throw 'String problem!'; // eslint-disable-line @typescript-eslint/only-throw-error
});

await activate(mockExtensionContext);
Expand Down Expand Up @@ -357,7 +356,7 @@ describe('Extension entry point', () => {
await mockCommands.registerCommand.mock.calls[1][1]();

start.mockImplementation((): void => {
throw 'String problem!';
throw 'String problem!'; // eslint-disable-line @typescript-eslint/only-throw-error
});

await mockCommands.registerCommand.mock.calls[1][1]();
Expand Down Expand Up @@ -403,7 +402,7 @@ describe('Extension entry point', () => {

it('should show unknown error message when deactivate fails to stop the client', async () => {
stop.mockImplementation(() => {
throw undefined;
throw undefined; // eslint-disable-line @typescript-eslint/only-throw-error
});

await activate(mockExtensionContext);
Expand Down
1 change: 0 additions & 1 deletion src/extension/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { EventEmitter } from 'node:events';
import path from 'node:path';

// eslint-disable-next-line n/no-missing-import
import { LanguageClient, SettingMonitor, ExecuteCommandRequest } from 'vscode-languageclient/node';
import { workspace, commands, window, type ExtensionContext } from 'vscode';
import { ApiEvent, PublicApi } from './types';
Expand Down
1 change: 0 additions & 1 deletion src/extension/start-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';
import process from 'process';
// eslint-disable-next-line n/no-missing-import
import { createConnection, ProposedFeatures } from 'vscode-languageserver/node';
import { StylelintLanguageServer, modules, createLogger } from '../server/index';

Expand Down
1 change: 0 additions & 1 deletion src/server/__tests__/create-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jest.mock('winston', () => {
};
});

// eslint-disable-next-line n/no-missing-import
import type transports from 'winston/lib/winston/transports';
import winston from 'winston';
import { createLogger } from '../create-logger';
Expand Down
1 change: 0 additions & 1 deletion src/server/__tests__/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
WorkDoneProgressReporter,
} from 'vscode-languageserver';
import type { TextDocument, TextEdit } from 'vscode-languageserver-textdocument';
// eslint-disable-next-line n/no-missing-import
import { TextDocuments } from 'vscode-languageserver/node';
import * as LSP from 'vscode-languageserver-protocol';
import { displayError, NotificationManager, CommandManager } from '../../utils/lsp/index';
Expand Down
4 changes: 2 additions & 2 deletions src/server/modules/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class FormatterModule implements LanguageServerModule {
this.#logger?.debug('Deregistering formatter for document', { uri });

registration
.then(({ dispose }) => dispose())
.then((d) => d.dispose())
.catch((error: unknown) => {
this.#logger?.error('Error deregistering formatter for document', { uri, error });
});
Expand All @@ -125,7 +125,7 @@ export class FormatterModule implements LanguageServerModule {
this.#logger?.debug('Deregistering formatter for document', { uri });

registration
.then(({ dispose }) => dispose())
.then((d) => d.dispose())
.catch((error: unknown) => {
this.#logger?.error('Error deregistering formatter for document', { uri, error });
});
Expand Down
1 change: 0 additions & 1 deletion src/server/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TextDocument, TextEdit } from 'vscode-languageserver-textdocument';
import type { Connection, TextDocumentChangeEvent } from 'vscode-languageserver';
import type LSP from 'vscode-languageserver-protocol';
// eslint-disable-next-line n/no-missing-import
import { TextDocuments } from 'vscode-languageserver/node';
import {
DidChangeConfigurationNotification,
Expand Down
3 changes: 1 addition & 2 deletions src/server/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Connection, Disposable } from 'vscode-languageserver';
// eslint-disable-next-line n/no-missing-import
import type { TextDocuments } from 'vscode-languageserver/node';
import type { TextDocument, TextEdit } from 'vscode-languageserver-textdocument';
import { CodeActionKind as VSCodeActionKind } from 'vscode-languageserver-types';
Expand Down Expand Up @@ -144,7 +143,7 @@ export interface LanguageServerModule extends Disposable {
* Handler called after the language server has finished responding to the
* onDidChangeConfiguration event.
*/
onDidChangeConfiguration?: () => void;
onDidChangeConfiguration?: () => Promise<void>;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string | symbol]: any;
Expand Down
1 change: 0 additions & 1 deletion src/utils/logging/__tests__/get-log-function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line n/no-missing-import
import type { RemoteConsole } from 'vscode-languageserver/node';
import { getLogFunction } from '../get-log-function';

Expand Down
2 changes: 0 additions & 2 deletions src/utils/logging/get-log-function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line n/no-missing-import
import type { RemoteConsole } from 'vscode-languageserver/node';

type RemoteConsoleLogLevels = 'info' | 'debug' | 'error' | 'warn' | 'log';
Expand All @@ -11,7 +10,6 @@ type RemoteConsoleLogFunctions = RemoteConsole[RemoteConsoleLogLevels];
export const getLogFunction = (
remoteConsole: RemoteConsole,
level: string,
// eslint-disable-next-line @typescript-eslint/ban-types
): RemoteConsoleLogFunctions | undefined => {
const logFunction = remoteConsole[level as RemoteConsoleLogLevels];

Expand Down
1 change: 0 additions & 1 deletion src/utils/logging/language-server-transport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import TransportStream from 'winston-transport';
import { LEVEL, MESSAGE } from 'triple-beam';
import type winston from 'winston';
// eslint-disable-next-line n/no-missing-import
import type { Connection, RemoteConsole } from 'vscode-languageserver/node';
import type { TransportStreamOptions } from 'winston-transport';

Expand Down
9 changes: 4 additions & 5 deletions src/utils/packages/__tests__/stylelint-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import path from 'path';
import fs from 'fs/promises';
import module from 'module';
import type winston from 'winston';
// eslint-disable-next-line n/no-missing-import
import { Connection, Files } from 'vscode-languageserver/node';
import type { TextDocument } from 'vscode-languageserver-textdocument';
import { GlobalPathResolver } from '../global-path-resolver';
Expand Down Expand Up @@ -79,14 +78,14 @@ jest.doMock(path.join(__dirname, 'bad-stylelint.js'), () => ({}), { virtual: tru
jest.doMock(path.join(__dirname, '.pnp.cjs'), () => ({ setup: jest.fn() }), { virtual: true });
jest.doMock(path.join(__dirname, '.pnp.js'), () => ({ setup: jest.fn() }), { virtual: true });

// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const mockedPnP = require(pnpPath) as jest.Mocked<{ setup: () => void }>;
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const mockedJSPnP = require(pnpJSPath) as jest.Mocked<{ setup: () => void }>;

const mockGlobalFileResolution = (packageManager: PackageManager, stylelintPath: string) => {
mockedFiles.__mockResolution('stylelint', (globalPath, cwd, trace) => {
trace && trace('Resolving globally');
if (trace) trace('Resolving globally');

return cwd === mockCWD && globalPath === mockGlobalPaths[packageManager]
? stylelintPath
Expand All @@ -96,7 +95,7 @@ const mockGlobalFileResolution = (packageManager: PackageManager, stylelintPath:

const mockLocalFileResolution = (stylelintPath: string) => {
mockedFiles.__mockResolution('stylelint', (_, cwd, trace) => {
trace && trace('Resolving locally');
if (trace) trace('Resolving locally');

return cwd === mockCWD ? stylelintPath : undefined;
});
Expand Down
7 changes: 3 additions & 4 deletions src/utils/packages/stylelint-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import path from 'path';
import process from 'process';

import type winston from 'winston';
// eslint-disable-next-line n/no-missing-import
import { Connection, Files } from 'vscode-languageserver/node';
import { URI } from 'vscode-uri';
import type { TextDocument } from 'vscode-languageserver-textdocument';
Expand Down Expand Up @@ -110,7 +109,7 @@ export class StylelintResolver {

if (!process.versions.pnp) {
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
(require(pnpPath) as { setup: () => void }).setup();
} catch (error) {
this.#logger?.warn('Could not setup PnP', { path: pnpPath, error });
Expand Down Expand Up @@ -165,7 +164,7 @@ export class StylelintResolver {
const stylelintPath = await Files.resolve('stylelint', globalModulesPath, cwd, trace);

const result = {
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
stylelint: require(stylelintPath) as Stylelint,
resolvedPath: stylelintPath,
};
Expand Down Expand Up @@ -219,7 +218,7 @@ export class StylelintResolver {
try {
const requirePath = await this.#getRequirePath(stylelintPath, getWorkspaceFolderFn);

// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const stylelint = require(requirePath) as Stylelint;

if (stylelint && typeof stylelint.lint === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function runProcessFindLine<T>(
// ignore
}

reject(error);
reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
};

stdoutReader.on('line', (line) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ export type PublicOnly<T> = Pick<T, keyof T>;
* its descendants.
*/
export type PublicOnlyDeep<T> = {
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
[K in keyof T]: T[K] extends Function ? T[K] : T[K] extends object ? PublicOnlyDeep<T[K]> : T[K];
};
6 changes: 3 additions & 3 deletions test/integration/connection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
StreamMessageReader,
StreamMessageWriter,
WatchDog,
} from 'vscode-languageserver/node'; // eslint-disable-line n/no-missing-import
// eslint-disable-next-line n/no-missing-import
} from 'vscode-languageserver/node';
import { createConnection } from 'vscode-languageserver/lib/common/server';

class TestStream extends Duplex {
Expand Down Expand Up @@ -131,7 +130,8 @@ export class ConnectionManager {
if (connection) {
connection.end();
connection.dispose();
timeoutRef && clearTimeout(timeoutRef);

if (timeoutRef) clearTimeout(timeoutRef);
} else {
throw new Error('Stopping server timed out');
}
Expand Down
1 change: 0 additions & 1 deletion test/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type os from 'os';
import type cp from 'child_process';
import type fs from 'fs/promises';
import type path from 'path';
// eslint-disable-next-line n/no-missing-import
import type VSLanguageServerNode from 'vscode-languageserver/node';
import type * as ProcessesActual from '../src/utils/processes';
import type { OptionalExcept } from '../src/utils/types';
Expand Down
Loading