Skip to content
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
1,168 changes: 315 additions & 853 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/react-dom": "^18.3.5",
"@vitest/coverage-istanbul": "^4.1.4",
"dependency-cruiser": "^17.3.10",
"eslint": "^9.39.4",
"happy-dom": "^20.9.0",
"prettier": "^3.8.3",
"publint": "^0.3.18",
Expand Down
9 changes: 0 additions & 9 deletions packages/liveblocks-chat-sdk-adapter/.eslintrc.cjs

This file was deleted.

15 changes: 15 additions & 0 deletions packages/liveblocks-chat-sdk-adapter/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { makeConfig } from "@liveblocks/eslint-config";
import commonRestrictedSyntax from "@liveblocks/eslint-config/restricted-syntax";

export default [
...makeConfig(),

{
rules: {
// -------------------------------
// Custom syntax we want to forbid
// -------------------------------
"no-restricted-syntax": ["error", ...commonRestrictedSyntax],
},
},
];
47 changes: 0 additions & 47 deletions packages/liveblocks-client/.eslintrc.cjs

This file was deleted.

49 changes: 49 additions & 0 deletions packages/liveblocks-client/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { makeConfig } from "@liveblocks/eslint-config";
import commonRestrictedSyntax from "@liveblocks/eslint-config/restricted-syntax";

export default [
...makeConfig(),

{
rules: {
// -------------------------------
// Custom syntax we want to forbid
// -------------------------------
"no-restricted-syntax": [
"error",
...commonRestrictedSyntax,
{
selector:
"CallExpression[callee.object.name='JSON'][callee.property.name='parse']",
message:
"Using `JSON.parse()` is type-unsafe. Prefer using the `tryParseJson()` utility method (from `src/utils`).",
},
{
selector: "TSNonNullExpression",
message:
"Non-null assertions mask real problems. Please use `nn(...)` (from src/assert.ts) instead.",
},
],

// ----------------------------------------------------------------------
// Overrides from default rule config used in all other projects!
// ----------------------------------------------------------------------
/* None yet 😇 ! */

// ----------------------------------------------------------------------
// Extra rules for this project specifically
// ----------------------------------------------------------------------
/* None yet 😇 ! */
},
},

{
files: ["src/__tests__/**"],

// Special config for test files
rules: {
"no-restricted-syntax": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
},
},
];
65 changes: 0 additions & 65 deletions packages/liveblocks-core/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion packages/liveblocks-core/e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ async function initializeRoomForTest<
baseUrl: BASE_URL,
});

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const { room, leave } = client.enterRoom<P, S, E, TM, CM>(roomId, {
initialPresence,
initialStorage,
Expand Down
81 changes: 81 additions & 0 deletions packages/liveblocks-core/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { makeConfig } from "@liveblocks/eslint-config";
import commonRestrictedSyntax from "@liveblocks/eslint-config/restricted-syntax";

import consoleMustBeFancy from "./rules/console-must-be-fancy.cjs";

export default [
...makeConfig(),

{
plugins: {
local: {
rules: {
"console-must-be-fancy": consoleMustBeFancy,
},
},
},

rules: {
// -------------------------------
// Custom syntax we want to forbid
// -------------------------------
"no-restricted-syntax": [
"error",
...commonRestrictedSyntax,
{
selector:
"CallExpression[callee.object.name='JSON'][callee.property.name='parse']",
message:
"Using `JSON.parse()` is type-unsafe. Prefer using the `tryParseJson()` utility method (from `src/utils`).",
},
{
selector: "TSNonNullExpression",
message:
"Non-null assertions mask real problems. Please use `nn(...)` (from src/assert.ts) instead.",
},
],

// ----------------------------------------------------------------------
// Overrides from default rule config used in all other projects!
// ----------------------------------------------------------------------
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/unbound-method": "off",

// TODO: New rules in typescript-eslint v8's recommendedTypeChecked
// that weren't in v7. Disabled during the v8 migration to keep it
// clean, but we should revisit and enable these later.
"@typescript-eslint/only-throw-error": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/no-duplicate-type-constituents": "off",
"@typescript-eslint/no-unused-expressions": "off",

// ----------------------------------------------------------------------
// Extra rules for this project specifically
// ----------------------------------------------------------------------

// Always use fancy console logging (with the Liveblocks logo in there)
"local/console-must-be-fancy": "error",
},
},

{
files: ["src/**/__tests__/**", "e2e/**"],

// Special config for test files
rules: {
"no-restricted-syntax": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",

// Ideally, we should remove these overrides, since they are still
// useful to catch bugs
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",

// No need for fancy console logging in tests
"local/console-must-be-fancy": "off",
},
},
];
1 change: 0 additions & 1 deletion packages/liveblocks-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@liveblocks/query-parser": "^0.1.1",
"@liveblocks/vitest-config": "*",
"@types/ws": "^8.5.10",
"eslint-plugin-rulesdir": "^0.2.2",
"fast-check": "^4.6.0",
"msw": "^2.10.4",
"ws": "^8.17.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/liveblocks-core/src/devtools/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function sendToPanel(

if (!(options?.force || _bridgeActive)) {
/*
// eslint-disable-next-line rulesdir/console-must-be-fancy
// eslint-disable-next-line local/console-must-be-fancy
console.log(
"%c[client → panel] %c%s",
"color: green",
Expand All @@ -44,7 +44,7 @@ export function sendToPanel(
return;
}
/*
// eslint-disable-next-line rulesdir/console-must-be-fancy
// eslint-disable-next-line local/console-must-be-fancy
console.log(
"%c[client → panel] %c%s",
"color: green",
Expand Down
2 changes: 1 addition & 1 deletion packages/liveblocks-core/src/dupe-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SPACE = " "; // Important space to make sure links in errors are clickable

function error(msg: string): void {
if (process.env.NODE_ENV === "production") {
// eslint-disable-next-line rulesdir/console-must-be-fancy
// eslint-disable-next-line local/console-must-be-fancy
console.error(msg);
} else {
throw new Error(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ test("[prop] will freeze all given values", () => {
const signal = new Signal(init);
expect(signal.get()).toBe(init);

/* eslint-disable @typescript-eslint/no-unsafe-return */
expect(() => {
// @ts-expect-error - deliberately set invalid prop
signal.get().abc = 123;
Expand All @@ -153,7 +152,6 @@ test("[prop] will freeze all given values", () => {

// @ts-expect-error - get prop
expect(signal.get().xyz).toBe(undefined);
/* eslint-enable @typescript-eslint/no-unsafe-return */
}
)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/liveblocks-core/src/lib/fancy-console.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable rulesdir/console-must-be-fancy */
/* eslint-disable local/console-must-be-fancy */

const badge =
"background:#0e0d12;border-radius:9999px;color:#fff;padding:3px 7px;font-family:sans-serif;font-weight:600;";
Expand Down
6 changes: 2 additions & 4 deletions packages/liveblocks-core/src/lib/stringify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-argument */

function replacer(_key: string, value: unknown) {
return value !== null && typeof value === "object" && !Array.isArray(value)
Expand Down Expand Up @@ -30,10 +28,10 @@ export function stringifyOrLog(value: unknown): string {
try {
return JSON.stringify(value);
} catch (err) {
/* eslint-disable rulesdir/console-must-be-fancy */
/* eslint-disable local/console-must-be-fancy */
console.error(`Could not stringify: ${(err as Error).message}`);
console.error(value);
/* eslint-enable rulesdir/console-must-be-fancy */
/* eslint-enable local/console-must-be-fancy */
throw err;
}
}
2 changes: 1 addition & 1 deletion packages/liveblocks-core/src/types/InferFromSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Resolve } from "../lib/Resolve";

export type JSONObjectSchema7 = JSONSchema7 & { type: "object" };

// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type NoFields = {};

type Infer<T> = T extends JSONSchema7 ? InferFromSchema<T> : never;
Expand Down
2 changes: 1 addition & 1 deletion packages/liveblocks-core/src/types/KnownKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* any index signature (e.g. `[key: string]: ...`).
*/
export type KnownKeys<T> = keyof {
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
[K in keyof T as {} extends Record<K, 1> ? never : K]: true;
} &
string;
4 changes: 2 additions & 2 deletions packages/liveblocks-core/src/types/LiveblocksError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type { Patchable } from "./Patchable";

type AiConnectionErrorContext = {
type: "AI_CONNECTION_ERROR";
code: -1 | 4001 | (number & {}); // eslint-disable-line @typescript-eslint/ban-types
code: -1 | 4001 | (number & {});
};

type RoomConnectionErrorContext = {
type: "ROOM_CONNECTION_ERROR";
code: -1 | 4001 | 4005 | 4006 | (number & {}); // eslint-disable-line @typescript-eslint/ban-types
code: -1 | 4001 | 4005 | 4006 | (number & {});
roomId: string;
};

Expand Down
Loading
Loading