Skip to content

Commit cf252b2

Browse files
Disallow type import exceptions in .eslintrc (#1280)
This PR cleans up our cross-package dependency graph even more by removing our exceptiosn for type imports, as well as restricting which packages can import each other via `@cursorless/foo` imports ## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1b18e38 commit cf252b2

File tree

133 files changed

+667
-540
lines changed

Some content is hidden

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

133 files changed

+667
-540
lines changed

packages/common/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../*"],
8+
"group": ["@cursorless/*", "../*"],
99
"message": "Common shouldn't have any dependencies"
1010
}
1111
],
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { CommandServerApi } from "./types/CommandServerApi";
2+
3+
export function getFakeCommandServerApi(): CommandServerApi {
4+
return {
5+
signals: {
6+
prePhrase: {
7+
getVersion: async () => null,
8+
},
9+
},
10+
};
11+
}

packages/common/ide/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../*"],
8+
"group": ["@cursorless/*", "../../*"],
99
"message": "Common shouldn't have any dependencies"
1010
}
1111
],

packages/common/ide/fake/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../../*"],
8+
"group": ["@cursorless/*", "../../../*"],
99
"message": "Common shouldn't depend on Cursorless extension"
1010
}
1111
],

packages/common/ide/normalized/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../../*"],
8+
"group": ["@cursorless/*", "../../../*"],
99
"message": "Common shouldn't depend on Cursorless extension"
1010
}
1111
],

packages/common/ide/spy/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../../*"],
8+
"group": ["@cursorless/*", "../../../*"],
99
"message": "Common shouldn't depend on Cursorless extension"
1010
}
1111
],

packages/common/ide/types/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../../*"],
8+
"group": ["@cursorless/*", "../../../*"],
99
"message": "Common shouldn't have any dependencies"
1010
}
1111
],

packages/common/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export * from "./commandIds";
2-
export {
3-
extractTargetedMarks,
4-
extractTargetKeys,
5-
} from "./testUtil/extractTargetedMarks";
2+
export * from "./testUtil/extractTargetedMarks";
63
export { default as FakeIDE } from "./ide/fake/FakeIDE";
74
export {
85
runTestSubset,
@@ -45,15 +42,21 @@ export * from "./types/TextEditorDecorationType";
4542
export * from "./types/TextEditorEdit";
4643
export * from "./types/TextEditorOptions";
4744
export * from "./types/TextLine";
45+
export * from "./types/Token";
46+
export * from "./types/HatTokenMap";
47+
export * from "./util/textFormatters";
48+
export * from "./types/snippet.types";
4849
export * from "./testUtil/fromPlainObject";
4950
export * from "./testUtil/toPlainObject";
5051
export { default as DefaultMap } from "./util/DefaultMap";
5152
export * from "./types/GeneralizedRange";
53+
export * from "./types/RangeOffsets";
5254
export * from "./util/omitByDeep";
5355
export * from "./testUtil/isTesting";
5456
export * from "./testUtil/testConstants";
5557
export * from "./testUtil/getFixturePaths";
5658
export * from "./testUtil/serialize";
59+
export * from "./testUtil/TestCaseSnapshot";
5760
export * from "./util/typeUtils";
5861
export * from "./ide/types/hatStyles.types";
5962
export * from "./errors";
@@ -71,3 +74,5 @@ export * from "./types/command/legacy/PartialTargetDescriptorV3.types";
7174
export * from "./types/CommandServerApi";
7275
export * from "./util/itertools";
7376
export * from "./extensionDependencies";
77+
export * from "./getFakeCommandServerApi";
78+
export * from "./types/TestCaseFixture";

packages/common/testUtil/.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
{
66
"patterns": [
77
{
8-
"group": ["../../*"],
9-
"message": "Common shouldn't have any dependencies",
10-
"allowTypeImports": true
8+
"group": ["@cursorless/*", "../../*"],
9+
"message": "Common shouldn't have any dependencies"
1110
}
1211
],
1312
"paths": [
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {
2+
RangePlainObject,
3+
SelectionPlainObject,
4+
SerializedMarks,
5+
TargetPlainObject,
6+
} from "./toPlainObject";
7+
8+
export type TestCaseSnapshot = {
9+
documentContents: string;
10+
selections: SelectionPlainObject[];
11+
clipboard?: string;
12+
// TODO Visible ranges are not asserted during testing, see:
13+
// https://github.com/cursorless-dev/cursorless/issues/160
14+
visibleRanges?: RangePlainObject[];
15+
marks?: SerializedMarks;
16+
thatMark?: TargetPlainObject[];
17+
sourceMark?: TargetPlainObject[];
18+
timeOffsetSeconds?: number;
19+
20+
/**
21+
* Extra information about the snapshot. Must be json serializable
22+
*/
23+
metadata?: unknown;
24+
};
25+
26+
export type ExtraSnapshotField = keyof TestCaseSnapshot;
27+
export type ExcludableSnapshotField = keyof TestCaseSnapshot;
28+
29+
export interface ExtraContext {
30+
startTimestamp?: bigint;
31+
}

0 commit comments

Comments
 (0)