Skip to content

Commit c41f68b

Browse files
committed
More infra cleanup
The infra updates also revealed lint errors that I corrected.
1 parent 626e1f6 commit c41f68b

File tree

82 files changed

+350
-295
lines changed

Some content is hidden

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

82 files changed

+350
-295
lines changed

demos/react-jsnation-workshop/src/components/steps/Step5.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ function Profile({ user }: { user: LocalUser | undefined }): JSX.Element {
158158
}
159159

160160
class LocalUser {
161-
#id: number;
161+
readonly id: number;
162162
#resource: InvalidatableAsync<ApiUser>;
163163
#invalidate: Marker;
164164

165165
constructor(id: number, data: InvalidatableAsync<ApiUser>, marker: Marker) {
166-
this.#id = id;
166+
this.id = id;
167167
this.#resource = data;
168168
this.#invalidate = marker;
169169
}

demos/react-jsnation-workshop/src/components/steps/Step6.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ function Profile({ user }: { user: LocalUser | undefined }): JSX.Element {
173173
}
174174

175175
class LocalUser {
176-
#id: number;
176+
readonly id: number;
177177
#resource: InvalidatableAsync<ApiUser>;
178178
#invalidate: Marker;
179179

180180
constructor(id: number, data: InvalidatableAsync<ApiUser>, marker: Marker) {
181-
this.#id = id;
181+
this.id = id;
182182
this.#resource = data;
183183
this.#invalidate = marker;
184184
}

demos/react-jsnation/.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"root": true,
3+
"ignorePatterns": ["node_modules", "dist", "html", "tests"],
34
"plugins": ["@starbeam"],
45
"overrides": [
56
{

demos/react-jsnation/tests/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"overrides": [
66
{
77
"extends": ["plugin:@starbeam/loose"],
8-
"files": ["**/*.ts"],
8+
"files": ["**/*.{tsx,ts}"],
99
"parserOptions": {
1010
"project": "tsconfig.json"
1111
}

demos/react-jsnation/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"starbeam": {
77
"jsx": "react",
8-
"source": "ts",
8+
"source": "tsx",
99
"type": "tests"
1010
},
1111
"scripts": {

demos/react-stock-ticker/src/components/Header.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function Header(): JSX.Element {
2121
event.preventDefault();
2222

2323
const { search } = Object.fromEntries(
24-
new FormData(event.currentTarget)
24+
new FormData(event.currentTarget),
2525
) as {
2626
search: string;
2727
};
@@ -86,6 +86,6 @@ export default function Header(): JSX.Element {
8686
</div>
8787
</header>
8888
),
89-
[]
89+
[],
9090
);
9191
}

packages/preact/preact-testing-utils/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"main": "dist/index.cjs",
1515
"types": "dist/index.d.ts"
1616
},
17-
"starbeam:type": "library:test-support",
17+
"starbeam": {
18+
"type": "library:test-support"
19+
},
1820
"scripts": {
1921
"test:lint": "eslint . --max-warnings 0",
2022
"test:specs": "vitest --run",

packages/preact/preact-testing-utils/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/preact/preact-utils/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:public",
21+
"starbeam": {
22+
"type": "library:public"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:specs": "vitest --run",

packages/preact/preact-utils/src/plugin.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,10 @@ class AugmentHandler<F extends AnyFn> implements Handler {
266266
}
267267
}
268268

269-
#name: string;
270269
#handled = false;
271270
#original: F;
272271

273-
private constructor(name: string, original: F) {
274-
this.#name = name;
272+
private constructor(_name: string, original: F) {
275273
this.#original = original;
276274
}
277275

packages/preact/preact-utils/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/preact/preact/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/react/react/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/react/test-utils/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:test-support",
21+
"starbeam": {
22+
"type": "library:test-support"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:types": "tsc -b"

packages/react/test-utils/src/modes.ts

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export class SetupTestRoot<Props, T> {
202202

203203
if (lastChecked === undefined || current === undefined) {
204204
if (lastChecked !== current) {
205+
// eslint-disable-next-line no-console
205206
console.error("Expected current value to equal last checked value", {
206207
lastChecked,
207208
current,

packages/react/use-strict-lifecycle/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"main": "dist/index.cjs",
2020
"types": "dist/index.d.ts"
2121
},
22-
"starbeam:type": "library:public",
22+
"starbeam": {
23+
"type": "library:public"
24+
},
2325
"scripts": {
2426
"doc": "node ./scripts/doc.js",
2527
"doc:all": "node ./scripts/docs.js",

packages/react/use-strict-lifecycle/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/universal/collections/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"main": "dist/index.cjs",
2020
"types": "dist/index.d.ts"
2121
},
22-
"starbeam:type": "library:public",
22+
"starbeam": {
23+
"type": "library:public"
24+
},
2325
"scripts": {
2426
"test:lint": "eslint . --max-warnings 0",
2527
"test:specs": "vitest --run",

packages/universal/collections/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/universal/core-utils/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:public",
21+
"starbeam": {
22+
"type": "library:public"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:specs": "vitest --run",

packages/universal/core-utils/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/universal/core/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
// eslint-disable-next-line no-console
12
console.warn(
2-
"WARNING: @starbeam/core has been renamed to @starbeam/universal. Please update your imports to refer to @starbeam/universal."
3+
"WARNING: @starbeam/core has been renamed to @starbeam/universal. Please update your imports to refer to @starbeam/universal.",
34
);
45
export * from "@starbeam/universal";
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* This API might gain additional features. For now, its primary purpose is to provide a
3+
* sanctioned way to log to the console that is overtly different from explicit
4+
* calls to `console.log` (which make it more difficult to identify errant console.logs).
5+
*/
6+
export class Logger {
7+
static console(): Logger {
8+
return new Logger(console);
9+
}
10+
11+
static of(logger: typeof console): Logger {
12+
return new Logger(logger);
13+
}
14+
15+
#logger: typeof console;
16+
17+
private constructor(logger: typeof console) {
18+
this.#logger = logger;
19+
}
20+
21+
group(...args: unknown[]): void {
22+
this.#logger.group(...args);
23+
}
24+
25+
groupEnd(): void {
26+
this.#logger.groupEnd();
27+
}
28+
29+
info(...args: unknown[]): void {
30+
this.#logger.info(...args);
31+
}
32+
}
33+
34+
export const LOGGER = Logger.console();

packages/universal/debug/src/tag.ts

+17-14
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ import type { Description, HasTag } from "@starbeam/interfaces";
33
import { DEBUG, UNKNOWN_REACTIVE_VALUE } from "@starbeam/reactive";
44
import { getDependencies, getTag, lastUpdated } from "@starbeam/tags";
55

6+
import { LOGGER } from "./logger.js";
67
import { Tree } from "./tree.js";
78

89
export const debugReactive = (
910
tag: HasTag,
1011
{
1112
implementation = false,
12-
}: { implementation?: boolean; source?: boolean; id?: boolean } = {}
13+
}: { implementation?: boolean; source?: boolean; id?: boolean } = {},
1314
): string => {
1415
const dependencies = getDependencies(tag);
1516
const descriptions = new Set(
1617
dependencies.map((dependency) =>
17-
getDesc(dependency.description, implementation)
18-
)
18+
getDesc(dependency.description, implementation),
19+
),
1920
);
2021

2122
const nodes = [...descriptions]
@@ -35,29 +36,31 @@ export const logReactive = (
3536
implementation?: boolean;
3637
source?: boolean;
3738
id?: boolean;
38-
} = {}
39+
} = {},
3940
): void => {
4041
const debug = debugReactive(tag, options);
4142

4243
if (options.label) {
43-
console.group(options.label);
44+
LOGGER.group(options.label);
4445
}
4546

46-
console.group(
47-
describe(getTag(tag).description, { id: options.id }),
48-
`(updated at ${lastUpdated(tag).at})`
49-
);
50-
console.info(debug);
51-
console.groupEnd();
47+
{
48+
LOGGER.group(
49+
describe(getTag(tag).description, { id: options.id }),
50+
`(updated at ${lastUpdated(tag).at})`,
51+
);
52+
LOGGER.info(debug);
53+
LOGGER.groupEnd();
54+
}
5255

5356
if (options.label) {
54-
console.groupEnd();
57+
LOGGER.groupEnd();
5558
}
5659
};
5760

5861
function describe(
5962
description: Description | undefined,
60-
options?: { id: boolean | undefined }
63+
options?: { id: boolean | undefined },
6164
): string {
6265
return description && DEBUG
6366
? DEBUG.describe(description, options)
@@ -66,7 +69,7 @@ function describe(
6669

6770
function getDesc(
6871
description: Description | undefined,
69-
showImplementation: boolean
72+
showImplementation: boolean,
7073
): Description | undefined {
7174
return showImplementation ? description : DEBUG?.getUserFacing(description);
7275
}

packages/universal/debug/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/universal/modifier/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:public",
21+
"starbeam": {
22+
"type": "library:public"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:types": "tsc -b"

packages/universal/reactive/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:public",
21+
"starbeam": {
22+
"type": "library:public"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:specs": "vitest --run",

packages/universal/reactive/tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"type": "module",
66
"starbeam": {
7-
"source": "ts",
7+
"source": "tsx",
88
"type": "tests"
99
},
1010
"scripts": {

packages/universal/renderer/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"main": "dist/index.cjs",
1919
"types": "dist/index.d.ts"
2020
},
21-
"starbeam:type": "library:public",
21+
"starbeam": {
22+
"type": "library:public"
23+
},
2224
"scripts": {
2325
"test:lint": "eslint . --max-warnings 0",
2426
"test:specs": "vitest --run",

0 commit comments

Comments
 (0)