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
7 changes: 7 additions & 0 deletions .changeset/eslint-effect-eslint-10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@codeforbreakfast/eslint-effect': patch
---

The rules now run under ESLint 10. Before this, ESLint 10 stopped with "context.getSourceCode is not a function" as soon as it loaded one of them.

The `eslint` peer dependency is now `>=8.40.0` instead of `>=8.0.0`. ESLint 8.40 is the first release with `context.sourceCode`, which the rules now use. One rule already needed it, so the plugin did not fully work on older ESLint 8 releases anyway. If you are on ESLint 8.40 or later, there is nothing to change on your side.
5 changes: 5 additions & 0 deletions .changeset/websocket-readonly-auth-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codeforbreakfast/eventsourcing-transport-websocket': patch
---

Internal typing fix so the WebSocket server passes the stricter immutability checks in `eslint-plugin-functional` 10. There is nothing to change on your side: runtime behaviour and the public API are the same.
965 changes: 211 additions & 754 deletions bun.lock

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,15 @@
"@effect/rpc": "0.76.2",
"@effect/workflow": "0.19.1",
"@types/bun": "1.4.2",
"@typescript-eslint/eslint-plugin": "8.70.1",
"@typescript-eslint/parser": "8.70.1",
"@typescript-eslint/eslint-plugin": "8.71.0",
"@typescript-eslint/parser": "8.71.0",
"dependency-cruiser": "17.4.3",
"effect": "3.22.2",
"eslint": "9.39.5",
"eslint": "10.11.0",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-compat": "6.2.1",
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
"eslint-plugin-expect-type": "0.7.0",
"eslint-plugin-functional": "9.0.5",
"eslint-plugin-functional": "10.0.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-package-json": "0.91.2",
"eslint-plugin-unused-imports": "4.4.1",
"fast-check": "4.10.2",
"husky": "9.1.7",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-effect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
"check:publishable": "npm view $npm_package_name@$npm_package_version version >/dev/null 2>&1 && exit 1 || exit 0"
},
"peerDependencies": {
"eslint": ">=8.0.0"
"eslint": ">=8.40.0"
},
"devDependencies": {
"eslint": "9.39.5",
"@typescript-eslint/eslint-plugin": "8.70.1",
"eslint": "10.11.0",
"@typescript-eslint/eslint-plugin": "8.71.0",
"typescript": "5.9.3",
"effect": "3.22.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isEffectIfCall = (node) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {

create(context) {
const maxReferences = context.options[0]?.maxReferences ?? 2;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const getOriginalName = (node) => {
if (node.type === 'Identifier') {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-andThen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isFlatMapCall = (node) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-as.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isMapCall = (node) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-flatten.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isFlatMapCall = (node) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-from-nullable.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isOptionSomeCall = (node) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-get-or-else.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isOptionIsSomeCall = (node, expectedArg) => {
if (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-ignore-logged.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isMatchCauseEffectCall = (node) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

return {
CallExpression(node) {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-match-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
tagValue,
},
fix(fixer) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const tagString = sourceCode.getText(prop.value);
const restArgs = node.arguments.slice(1);
const restArgsText = restArgs.map((arg) => sourceCode.getText(arg)).join(', ');
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-zip-left.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isZipLeftPattern = (arrowFunc, effectType) => {
if (!arrowFunc || arrowFunc.type !== 'ArrowFunctionExpression') {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-effect/src/rules/prefer-zip-right.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
},

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

const isZipRightPattern = (arrowFunc) => {
if (!arrowFunc || arrowFunc.type !== 'ArrowFunctionExpression') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default {
const functionName = getFunctionName(callExpr.callee);
if (!functionName) return null;

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode;

const lastParamArgIndex = Math.max(...argsFromParams.map((item) => item.index));
const lastNonParamIndex = Math.max(...argsNotFromParams.map((item) => item.index));
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-aggregates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@codeforbreakfast/eventsourcing-store-inmemory": "workspace:*",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-projections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-filesystem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@effect/platform-bun": "0.91.2",
"@types/node": "24.19.0",
"effect": "3.22.2",
"eslint": "9.39.5",
"eslint": "10.11.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-inmemory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-postgres/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@effect/platform-bun": "0.91.2",
"@types/node": "24.19.0",
"effect": "3.22.2",
"eslint": "9.39.5",
"eslint": "10.11.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-testing-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport-inmemory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"@types/node": "24.19.0",
"effect": "3.22.2",
"eslint": "9.39.5",
"eslint": "10.11.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@types/node": "24.19.0",
"bun-types": "1.4.2",
"effect": "3.22.2",
"eslint": "9.39.5",
"eslint": "10.11.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const buildClientState =
clientId: Server.ClientId,
connectedAt: ReadonlyDeep<Date>,
ws: ReadonlyDeep<ServerWebSocket<WebSocketData>>,
authMetadata: Record<string, unknown>
authMetadata: Readonly<Record<string, unknown>>
) =>
(resources: {
readonly connectionStateQueue: Queue.Queue<ConnectionState>;
Expand All @@ -262,7 +262,7 @@ const createClientStateResources = (
clientId: Server.ClientId,
connectedAt: ReadonlyDeep<Date>,
ws: ReadonlyDeep<ServerWebSocket<WebSocketData>>,
authMetadata: Record<string, unknown>
authMetadata: Readonly<Record<string, unknown>>
): Effect.Effect<ClientState, never, never> =>
pipe(
createClientResources(),
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/node": "24.19.0",
"effect": "3.22.2",
"typescript": "5.9.3",
"eslint": "9.39.5"
"eslint": "10.11.0"
},
"publishConfig": {
"access": "public"
Expand Down
21 changes: 14 additions & 7 deletions scripts/validate-changesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ const getChangesets = pipe(

// Wrapper provides type safety for JSON.parse (returns any)
// eslint-disable-next-line effect/no-eta-expansion -- JSON.parse is external and cannot be inlined
const parsePackageDependencyOutput = (output: string): Record<string, readonly string[]> =>
JSON.parse(output);
const parsePackageDependencyOutput = (
output: string
): Readonly<Record<string, readonly string[]>> => JSON.parse(output);

const handleDependencyCheckFailure = (terminal: Terminal.Terminal) => () =>
pipe(
Expand All @@ -293,7 +294,7 @@ const getPackageDependencyMap = pipe(Terminal.Terminal, Effect.flatMap(runDepend

const getBaseBranch = (): string => {
const envVar = 'GITHUB_BASE_REF';
const proc: Record<string, unknown> = globalThis as never;
const proc: Readonly<Record<string, unknown>> = globalThis as never;
const env = (proc['process'] as Record<string, Record<string, string>> | undefined)?.['env'];
return (env?.[envVar] as string | undefined) ?? 'origin/main';
};
Expand Down Expand Up @@ -349,7 +350,7 @@ const parseJsonSafely = (content: string): unknown => {
}
};

const extractDependencies = (pkg: unknown, key: string): Record<string, string> => {
const extractDependencies = (pkg: unknown, key: string): Readonly<Record<string, string>> => {
const record = pkg as Record<string, unknown> | null;
const deps = record?.[key];
return (deps as Record<string, string> | undefined) || {};
Expand Down Expand Up @@ -749,7 +750,10 @@ const showDependencyValidationFailure = (
);

const buildDependencyError =
(changedPackages: ReadonlySet<string>, packageDependencyMap: Record<string, readonly string[]>) =>
(
changedPackages: ReadonlySet<string>,
packageDependencyMap: Readonly<Record<string, readonly string[]>>
) =>
(
errors: readonly MissingDependentError[],
changedPackage: string
Expand All @@ -769,7 +773,10 @@ const buildDependencyError =
};

const checkDependencyErrors =
(changedPackages: ReadonlySet<string>, packageDependencyMap: Record<string, readonly string[]>) =>
(
changedPackages: ReadonlySet<string>,
packageDependencyMap: Readonly<Record<string, readonly string[]>>
) =>
(terminal: Terminal.Terminal) => {
const dependencyErrors = Array.from(changedPackages).reduce<readonly MissingDependentError[]>(
buildDependencyError(changedPackages, packageDependencyMap),
Expand Down Expand Up @@ -799,7 +806,7 @@ const displaySuccess = (changesets: readonly ChangesetInfoInternal[]) =>

const validateDependencies =
(changedPackages: ReadonlySet<string>) =>
(packageDependencyMap: Record<string, readonly string[]>) =>
(packageDependencyMap: Readonly<Record<string, readonly string[]>>) =>
pipe(
Terminal.Terminal,
Effect.flatMap(checkDependencyErrors(changedPackages, packageDependencyMap))
Expand Down
Loading