Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
"eslint/no-restricted-imports": [
"warn",
{
"paths": [
{
"name": "node:assert",
"message": "Use node:assert/strict instead"
Comment thread
AndreasArvidsson marked this conversation as resolved.
}
],
"patterns": [
{
"group": ["../*/src", "../*/src/*", "../../*/src", "../../*/src/*"],
Expand Down Expand Up @@ -77,6 +83,7 @@
"typescript/restrict-template-expressions": "off",
"typescript/unbound-method": "off",
"unicorn/prefer-module": "warn",
"unicorn/prefer-node-protocol": "warn",
Comment thread
AndreasArvidsson marked this conversation as resolved.
"unicorn/throw-new-error": "warn"
},
"overrides": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "assert";
import * as assert from "node:assert/strict";
import { getReusableEditor } from "@cursorless/lib-vscode-common";
import VscodeTextLine from "./VscodeTextLine";

Expand Down
6 changes: 3 additions & 3 deletions packages/app-vscode/src/keyboard/buildSuffixTrie.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from "node:assert";
import * as assert from "node:assert/strict";
import type { KeyValuePair } from "./buildSuffixTrie";
import { buildSuffixTrie } from "./buildSuffixTrie";
import { isEqual, sortBy, uniq, uniqWith } from "lodash-es";
Expand Down Expand Up @@ -130,8 +130,8 @@ suite("buildSuffixTrie", () => {
sortEntries(chars.flatMap((char) => trie.search(char))),
isEqual,
).map(({ key, value }) => ({ key, value }));
assert.deepStrictEqual(actual, sortEntries(expected));
assert.deepStrictEqual(
assert.deepEqual(actual, sortEntries(expected));
assert.deepEqual(
sortBy(conflicts.map(sortEntries), (conflict) =>
JSON.stringify(conflict),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from "assert";
import * as assert from "node:assert/strict";
import nearley from "nearley";
import type { KeyDescriptor } from "../TokenTypeHelpers";
import grammar from "./generated/grammar";
Expand Down Expand Up @@ -153,7 +153,7 @@ suite("keyboard.getAcceptableTokenTypes", () => {
arg: value.partialArg,
},
};
assert(
assert.ok(
candidates.some((result) => isEqual(result, fullValue)),
"Relevant candidates (note that symbols will be missing):\n" +
JSON.stringify(candidates, null, 2),
Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/keyboard/grammar/grammar.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nearley from "nearley";
import grammar from "./generated/grammar";
import assert from "assert";
import * as assert from "node:assert/strict";
import type { KeyDescriptor } from "../TokenTypeHelpers";
import type { KeyboardCommandHandler } from "../KeyboardCommandHandler";
import type { KeyboardCommand } from "../KeyboardCommandTypeHelpers";
Expand Down Expand Up @@ -189,7 +189,7 @@ suite("keyboard grammar", () => {
parser.feed(tokens);

assert.equal(parser.results.length, 1);
assert.deepStrictEqual(parser.results[0], expected);
assert.deepEqual(parser.results[0], expected);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BorderStyle, Range } from "@cursorless/lib-common";
import * as assert from "node:assert";
import * as assert from "node:assert/strict";
import { flattenHighlights } from "./flattenHighlights";
import type { Highlight, Scope } from "./types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "node:assert";
import * as assert from "node:assert/strict";
import { URI } from "vscode-uri";
import { Position } from "../../../types/Position";
import { Range } from "../../../types/Range";
Expand Down Expand Up @@ -73,7 +73,7 @@ suite("InMemoryTextDocument", () => {
test("positionAt", () => {
const document = createTestDocument("hello \n world\r\n");

assert.equal(document.positionAt(-1), "0:0");
assert.equal(document.positionAt(-1).toString(), "0:0");
assert.equal(document.positionAt(0).toString(), "0:0");
assert.equal(document.positionAt(6).toString(), "0:6");
assert.equal(document.positionAt(7).toString(), "0:7");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "node:assert";
import * as assert from "node:assert/strict";
import { Range } from "../../../types/Range";
import { createTestDocument } from "./createTestDocument";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { range } from "lodash-es";
import * as assert from "node:assert";
import * as assert from "node:assert/strict";
import { createTestDocument } from "./createTestDocument";

interface TestCaseFixture {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from "assert";
import * as assert from "node:assert/strict";
import { map } from "itertools";
import { Range } from "../../types/Range";
import { BorderStyle } from "../decorationStyle.types";
Expand Down Expand Up @@ -136,7 +136,7 @@ suite("handleMultipleLines", () => {
],
);

assert.deepStrictEqual(actual, testCase.expected);
assert.deepEqual(actual, testCase.expected);
});
}
});
22 changes: 11 additions & 11 deletions packages/lib-common/src/types/generalizedRangeContains.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from "assert";
import * as assert from "node:assert/strict";
import { generalizedRangeContains } from "./GeneralizedRange";
import { Position } from "./Position";

suite("generalizedRangeContains", () => {
test("character", () => {
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "character",
Expand All @@ -19,7 +19,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "character",
Expand All @@ -34,7 +34,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "character",
Expand All @@ -52,7 +52,7 @@ suite("generalizedRangeContains", () => {
});

test("line", () => {
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "line",
Expand All @@ -67,7 +67,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "line",
Expand All @@ -82,7 +82,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "line",
Expand All @@ -100,7 +100,7 @@ suite("generalizedRangeContains", () => {
});

test("mixed", () => {
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "line",
Expand All @@ -115,7 +115,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "line",
Expand All @@ -130,7 +130,7 @@ suite("generalizedRangeContains", () => {
),
false,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "character",
Expand All @@ -145,7 +145,7 @@ suite("generalizedRangeContains", () => {
),
true,
);
assert.strictEqual(
assert.equal(
generalizedRangeContains(
{
type: "character",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from "assert";
import * as assert from "node:assert/strict";
import type { GeneralizedRange } from "./GeneralizedRange";
import { generalizedRangeTouches } from "./GeneralizedRange";
import { Position } from "./Position";
Expand Down Expand Up @@ -136,6 +136,6 @@ function testRangePair(
b: GeneralizedRange,
expected: boolean,
) {
assert.strictEqual(generalizedRangeTouches(a, b), expected);
assert.strictEqual(generalizedRangeTouches(b, a), expected);
assert.equal(generalizedRangeTouches(a, b), expected);
assert.equal(generalizedRangeTouches(b, a), expected);
}
20 changes: 10 additions & 10 deletions packages/lib-common/src/types/isGeneralizedRangeEqual.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from "assert";
import * as assert from "node:assert/strict";
import { isGeneralizedRangeEqual } from "./GeneralizedRange";
import { Position } from "./Position";

suite("isGeneralizedRangeEqual", () => {
test("character", () => {
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{
type: "character",
Expand All @@ -19,7 +19,7 @@ suite("isGeneralizedRangeEqual", () => {
),
true,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{
type: "character",
Expand All @@ -34,7 +34,7 @@ suite("isGeneralizedRangeEqual", () => {
),
false,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{
type: "character",
Expand All @@ -49,7 +49,7 @@ suite("isGeneralizedRangeEqual", () => {
),
false,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{
type: "character",
Expand All @@ -67,21 +67,21 @@ suite("isGeneralizedRangeEqual", () => {
});

test("line", () => {
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{ type: "line", start: 0, end: 0 },
{ type: "line", start: 0, end: 0 },
),
true,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{ type: "line", start: 0, end: 0 },
{ type: "line", start: 0, end: 1 },
),
false,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{ type: "line", start: 0, end: 0 },
{ type: "line", start: 1, end: 0 },
Expand All @@ -91,7 +91,7 @@ suite("isGeneralizedRangeEqual", () => {
});

test("mixed", () => {
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{
type: "character",
Expand All @@ -102,7 +102,7 @@ suite("isGeneralizedRangeEqual", () => {
),
false,
);
assert.strictEqual(
assert.equal(
isGeneralizedRangeEqual(
{ type: "line", start: 0, end: 0 },
{
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-common/src/types/position.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "assert";
import * as assert from "node:assert/strict";
import { Position } from "./Position";

suite("Position", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-common/src/types/range.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "assert";
import * as assert from "node:assert/strict";
import { Position } from "./Position";
import { Range } from "./Range";
import { Selection } from "./Selection";
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-common/src/types/selection.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "assert";
import * as assert from "node:assert/strict";
import { Position } from "./Position";
import { Selection } from "./Selection";

Expand Down
4 changes: 2 additions & 2 deletions packages/lib-common/src/util/uniqWithHash.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from "assert";
import * as assert from "node:assert/strict";
import * as fc from "fast-check";
import { uniqWith } from "lodash-es";
import { uniqWithHash } from "./uniqWithHash";
Expand Down Expand Up @@ -52,7 +52,7 @@ suite("uniqWithHash", () => {
(a, b) => a === b,
hash,
);
assert.deepStrictEqual(actual, expected);
assert.deepEqual(actual, expected);
};

testCases.forEach(check);
Expand Down
2 changes: 0 additions & 2 deletions packages/lib-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
"zod": "^4.3.6"
},
"devDependencies": {
"@types/chai": "^5.2.3",
"@types/js-yaml": "^4.0.9",
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10.0.10",
"@types/moo": "^0.5.10",
"@types/nearley": "^2.11.5",
"chai": "^6.2.2",
"js-yaml": "^4.1.1",
"web-tree-sitter": "^0.26.7"
}
Expand Down
Loading
Loading