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

More infrastructure cleanup #133

Merged
merged 2 commits into from
Sep 29, 2023
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
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
1 change: 0 additions & 1 deletion demos/react-jsnation-workshop/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"vite.config.ts": "rollup.config.*, .env.*"
},

"prettier.prettierPath": "../../node_modules/prettier",

// rewrap provides a quick keyboard shortcut (alt-q) to reformat comments to
// a specific column width. It also automatically rewraps comments when you
Expand Down
4 changes: 2 additions & 2 deletions demos/react-jsnation-workshop/src/components/steps/Step5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ function Profile({ user }: { user: LocalUser | undefined }): JSX.Element {
}

class LocalUser {
#id: number;
readonly id: number;
#resource: InvalidatableAsync<ApiUser>;
#invalidate: Marker;

constructor(id: number, data: InvalidatableAsync<ApiUser>, marker: Marker) {
this.#id = id;
this.id = id;
this.#resource = data;
this.#invalidate = marker;
}
Expand Down
4 changes: 2 additions & 2 deletions demos/react-jsnation-workshop/src/components/steps/Step6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ function Profile({ user }: { user: LocalUser | undefined }): JSX.Element {
}

class LocalUser {
#id: number;
wycats marked this conversation as resolved.
Show resolved Hide resolved
readonly id: number;
#resource: InvalidatableAsync<ApiUser>;
#invalidate: Marker;

constructor(id: number, data: InvalidatableAsync<ApiUser>, marker: Marker) {
this.#id = id;
this.id = id;
this.#resource = data;
this.#invalidate = marker;
}
Expand Down
1 change: 1 addition & 0 deletions demos/react-jsnation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"root": true,
"ignorePatterns": ["node_modules", "dist", "html", "tests"],
"plugins": ["@starbeam"],
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion demos/react-jsnation/tests/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"overrides": [
{
"extends": ["plugin:@starbeam/loose"],
"files": ["**/*.ts"],
"files": ["**/*.{tsx,ts}"],
"parserOptions": {
"project": "tsconfig.json"
}
Expand Down
2 changes: 1 addition & 1 deletion demos/react-jsnation/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"starbeam": {
"jsx": "react",
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions demos/react-stock-ticker/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Header(): JSX.Element {
event.preventDefault();

const { search } = Object.fromEntries(
new FormData(event.currentTarget)
new FormData(event.currentTarget),
) as {
search: string;
};
Expand Down Expand Up @@ -86,6 +86,6 @@ export default function Header(): JSX.Element {
</div>
</header>
),
[]
[],
);
}
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-proposal-decorators": "^7.22.15",
"@babel/plugin-proposal-decorators": "^7.23.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/preset-env": "^7.22.20",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@babel/runtime": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
"@babel/runtime": "^7.23.1",
"@changesets/changelog-git": "^0.1.14",
"@changesets/cli": "^2.26.2",
"@changesets/config": "^2.3.1",
Expand All @@ -119,10 +119,10 @@
"@starbeam/eslint-plugin": "workspace:^",
"@starbeam-dev/build-support": "workspace:*",
"@starbeam-dev/schemas": "workspace:^",
"@types/eslint": "^8.44.2",
"@types/node": "20.6.3",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@types/eslint": "^8.44.3",
"@types/node": "^20.7.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"@vitest/ui": "^0.34.5",
"eslint": "^8.50.0",
"eslint-config-airbnb": "^19.0.4",
Expand All @@ -136,11 +136,11 @@
"eslint-plugin-unused-imports": "^3.0.0",
"esno": "^0.17.0",
"fast-glob": "^3.3.1",
"happy-dom": "^12.1.6",
"happy-dom": "^12.2.1",
"jsdom": "^22.1.0",
"knip": "^2.29.0",
"prettier": "^3.0.3",
"rollup": "^3.29.2",
"rollup": "^3.29.3",
"tslib": "^2.6.2",
"turbo": "^1.10.14",
"typescript": "^5.2.2",
Expand Down Expand Up @@ -190,8 +190,9 @@
}
}
},
"prettier": {},
"volta": {
"node": "20.6.1",
"node": "18.18.0",
"pnpm": "8.7.6"
}
}
4 changes: 3 additions & 1 deletion packages/preact/preact-testing-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:test-support",
"starbeam": {
"type": "library:test-support"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:specs": "vitest --run",
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact-testing-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion packages/preact/preact-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:public",
"starbeam": {
"type": "library:public"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:specs": "vitest --run",
Expand Down
4 changes: 1 addition & 3 deletions packages/preact/preact-utils/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,10 @@ class AugmentHandler<F extends AnyFn> implements Handler {
}
}

#name: string;
#handled = false;
#original: F;

private constructor(name: string, original: F) {
this.#name = name;
private constructor(_name: string, original: F) {
this.#original = original;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/react/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion packages/react/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:test-support",
"starbeam": {
"type": "library:test-support"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:types": "tsc -b"
Expand Down
1 change: 1 addition & 0 deletions packages/react/test-utils/src/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class SetupTestRoot<Props, T> {

if (lastChecked === undefined || current === undefined) {
if (lastChecked !== current) {
// eslint-disable-next-line no-console
console.error("Expected current value to equal last checked value", {
lastChecked,
current,
Expand Down
4 changes: 3 additions & 1 deletion packages/react/use-strict-lifecycle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:public",
"starbeam": {
"type": "library:public"
},
"scripts": {
"doc": "node ./scripts/doc.js",
"doc:all": "node ./scripts/docs.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/use-strict-lifecycle/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion packages/universal/collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:public",
"starbeam": {
"type": "library:public"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:specs": "vitest --run",
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/collections/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion packages/universal/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:public",
"starbeam": {
"type": "library:public"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:specs": "vitest --run",
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/core-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"starbeam": {
"source": "ts",
"source": "tsx",
"type": "tests"
},
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion packages/universal/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eslint-disable-next-line no-console
console.warn(
"WARNING: @starbeam/core has been renamed to @starbeam/universal. Please update your imports to refer to @starbeam/universal."
"WARNING: @starbeam/core has been renamed to @starbeam/universal. Please update your imports to refer to @starbeam/universal.",
);
export * from "@starbeam/universal";
4 changes: 3 additions & 1 deletion packages/universal/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam:type": "library:public",
"starbeam": {
"type": "library:public"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:types": "tsc -b"
Expand Down
34 changes: 34 additions & 0 deletions packages/universal/debug/src/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* This API might gain additional features. For now, its primary purpose is to provide a
* sanctioned way to log to the console that is overtly different from explicit
* calls to `console.log` (which make it more difficult to identify errant console.logs).
*/
export class Logger {
static console(): Logger {
return new Logger(console);
}

static of(logger: typeof console): Logger {
return new Logger(logger);
}

#logger: typeof console;

private constructor(logger: typeof console) {
this.#logger = logger;
}

group(...args: unknown[]): void {
this.#logger.group(...args);
}

groupEnd(): void {
this.#logger.groupEnd();
}

info(...args: unknown[]): void {
this.#logger.info(...args);
}
}

export const LOGGER = Logger.console();
Loading
Loading