Skip to content

Commit 023c443

Browse files
enabled unicorn/import-style lint rule (#3287)
1 parent 78b4591 commit 023c443

170 files changed

Lines changed: 424 additions & 453 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

oxlint.config.mts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import type { OxlintConfig } from "oxlint";
22
import { defineConfig } from "oxlint";
33

44
const disabledRules = [
5-
// Temporarily disabled
6-
"eslint/prefer-named-capture-group",
7-
"unicorn/import-style",
8-
95
"eslint/arrow-body-style",
106
"eslint/capitalized-comments",
117
"eslint/class-methods-use-this",
@@ -33,6 +29,7 @@ const disabledRules = [
3329
"eslint/no-use-before-define",
3430
"eslint/no-void",
3531
"eslint/prefer-destructuring",
32+
"eslint/prefer-named-capture-group",
3633
"eslint/sort-imports",
3734
"eslint/sort-keys",
3835
"eslint/sort-vars",

packages/app-talonjs/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as talon from "talon";
1+
import talon from "talon";
22
import type { RunMode } from "@cursorless/lib-common";
33
import { activate as activateCore } from "@cursorless/lib-talonjs-core";
44

packages/app-vscode/src/InstallationDependencies.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as fs from "node:fs";
2-
import * as os from "node:os";
3-
import * as path from "node:path";
1+
import fs from "node:fs";
2+
import os from "node:os";
3+
import path from "node:path";
44
import glob from "fast-glob";
5-
import * as vscode from "vscode";
5+
import vscode from "vscode";
66
import { isWindows } from "@cursorless/lib-node-common";
77
import { COMMAND_SERVER_EXTENSION_ID } from "@cursorless/lib-vscode-common";
88

packages/app-vscode/src/ReleaseNotes.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as sinon from "sinon";
1+
import { fake, restore, assert, match } from "sinon";
22
import type { ExtensionContext, Uri } from "vscode";
33
import type { MessageType, Messages } from "@cursorless/lib-common";
44
import { asyncSafety } from "@cursorless/lib-common";
@@ -154,7 +154,7 @@ const testCases: TestCase[] = [
154154

155155
suite("release notes", () => {
156156
teardown(() => {
157-
sinon.restore();
157+
restore();
158158
});
159159

160160
for (const { input, expectedOutput } of testCases) {
@@ -192,36 +192,36 @@ async function runTest(input: Input, expectedOutput: Output) {
192192
await new ReleaseNotes(vscodeApi, extensionContext, messages).maybeShow();
193193

194194
if (expectedOutput.storedVersion === false) {
195-
sinon.assert.notCalled(update);
195+
assert.notCalled(update);
196196
} else {
197-
sinon.assert.calledOnceWithExactly(
197+
assert.calledOnceWithExactly(
198198
update,
199199
VERSION_KEY,
200200
expectedOutput.storedVersion,
201201
);
202202
}
203203

204204
if (expectedOutput.showedMessage) {
205-
sinon.assert.calledOnceWithExactly(
205+
assert.calledOnceWithExactly(
206206
showMessage,
207-
sinon.match.any,
207+
match.any,
208208
"releaseNotes",
209-
sinon.match.any,
210-
sinon.match.any,
209+
match.any,
210+
match.any,
211211
);
212212

213213
if (expectedOutput.openedUrl) {
214-
sinon.assert.calledOnce(openExternal);
214+
assert.calledOnce(openExternal);
215215
} else {
216-
sinon.assert.notCalled(openExternal);
216+
assert.notCalled(openExternal);
217217
}
218218
} else {
219-
sinon.assert.notCalled(showMessage);
219+
assert.notCalled(showMessage);
220220
}
221221
}
222222

223223
function getFakes(input: Input) {
224-
const openExternal = sinon.fake.resolves<[Uri], Promise<boolean>>(true);
224+
const openExternal = fake.resolves<[Uri], Promise<boolean>>(true);
225225
const vscodeApi = {
226226
window: {
227227
state: {
@@ -233,7 +233,7 @@ function getFakes(input: Input) {
233233
},
234234
} as unknown as VscodeApi;
235235

236-
const update = sinon.fake<[string, string], Promise<void>>();
236+
const update = fake<[string, string], Promise<void>>();
237237
const extensionContext = {
238238
globalState: {
239239
get() {
@@ -248,7 +248,7 @@ function getFakes(input: Input) {
248248
},
249249
} as unknown as ExtensionContext;
250250

251-
const showMessage = sinon.fake.resolves<
251+
const showMessage = fake.resolves<
252252
[MessageType, string, string, ...string[]],
253253
Promise<string | undefined>
254254
>(input.pressedButton ? WHATS_NEW : undefined);

packages/app-vscode/src/ReleaseNotes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as semver from "semver";
1+
import semver from "semver";
22
import type { ExtensionContext } from "vscode";
33
import { URI } from "vscode-uri";
44
import type { Messages } from "@cursorless/lib-common";

packages/app-vscode/src/StatusBarItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as vscode from "vscode";
1+
import vscode from "vscode";
22

33
const DEFAULT_TEXT = "$(cursorless-icon) Cursorless";
44

packages/app-vscode/src/VscodeSnippets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { open } from "node:fs/promises";
2-
import { join } from "node:path";
2+
import path from "node:path";
33
import type { IDE, TextEditor } from "@cursorless/lib-common";
44
import type { Snippets } from "@cursorless/lib-engine";
55
import { isEexistError } from "@cursorless/lib-node-common";
@@ -11,7 +11,7 @@ export class VscodeSnippets implements Snippets {
1111
snippetName: string,
1212
directory: string,
1313
): Promise<TextEditor> {
14-
const snippetPath = join(directory, `${snippetName}.snippet`);
14+
const snippetPath = path.join(directory, `${snippetName}.snippet`);
1515
await createNewFile(snippetPath);
1616
return this.ide.openTextDocument(snippetPath);
1717
}

packages/app-vscode/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as vscode from "vscode";
1+
import vscode from "vscode";
22
import { CURSORLESS_ORG_URL, DOCS_URL } from "@cursorless/lib-common";
33

44
export const showDocumentation = () => {

packages/app-vscode/src/createVscodeIde.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as crypto from "node:crypto";
2-
import * as os from "node:os";
3-
import * as path from "node:path";
1+
import crypto from "node:crypto";
2+
import os from "node:os";
3+
import path from "node:path";
44
import type { ExtensionContext } from "vscode";
55
import { FakeFontMeasurements } from "./ide/vscode/hats/FakeFontMeasurements";
66
import { FontMeasurementsImpl } from "./ide/vscode/hats/FontMeasurementsImpl";

packages/app-vscode/src/ide/vscode/VscodeCapabilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as semver from "semver";
2-
import * as vscode from "vscode";
1+
import semver from "semver";
2+
import vscode from "vscode";
33
import type {
44
Capabilities,
55
CommandCapabilityMap,

0 commit comments

Comments
 (0)