From 10d3cca18d7bc1a396c94952e78a2bfd9650c273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerci=C5=84ski?= Date: Fri, 16 Jan 2026 11:38:40 +0100 Subject: [PATCH] chore: update eslint-config-axkit to 1.1.0 --- package.json | 2 +- pnpm-lock.yaml | 10 +++---- src/config/config.test.ts | 27 ++++++++++--------- src/core/execution.test.ts | 12 ++++----- src/core/sync-global.test.ts | 2 +- src/utils/errors.ts | 10 +++---- src/utils/paths.resolveInside.test.ts | 6 ++--- .../integration/rules-fs.integration.test.ts | 2 +- 8 files changed, 36 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index bef76df..077a32e 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@types/node": "^25.0.8", "@vitest/coverage-v8": "^4.0.17", "eslint": "^9.39.2", - "eslint-config-axkit": "^1.0.0", + "eslint-config-axkit": "^1.1.0", "fta-check": "^1.5.1", "fta-cli": "^3.0.0", "knip": "^5.81.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3a1333f..7d6b8b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,8 +40,8 @@ importers: specifier: ^9.39.2 version: 9.39.2(jiti@2.6.1) eslint-config-axkit: - specifier: ^1.0.0 - version: 1.0.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.17(@types/node@25.0.8)(jiti@2.6.1)) + specifier: ^1.1.0 + version: 1.1.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.17(@types/node@25.0.8)(jiti@2.6.1)) fta-check: specifier: ^1.5.1 version: 1.5.1(fta-cli@3.0.0) @@ -1167,8 +1167,8 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} - eslint-config-axkit@1.0.0: - resolution: {integrity: sha512-/yN0yDd4QzLGCwYi4RVvJRPvQSN+MJWGXYi7FWwaVchCJJMtNNwQpCBO0VvaCHeVScTh0Sdi+iutmV93xtNk8A==} + eslint-config-axkit@1.1.0: + resolution: {integrity: sha512-EfkMubydZuYAHuOg53F4ptNuuSOUfWZLDvgjHGPFp7vbMXqvexJWkTI/r9p8vGCjMjNP/9VEucKqYrs/G2+Fsw==} engines: {node: '>=22.14.0'} peerDependencies: eslint: '>=9' @@ -3582,7 +3582,7 @@ snapshots: escape-string-regexp@5.0.0: {} - eslint-config-axkit@1.0.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.17(@types/node@25.0.8)(jiti@2.6.1)): + eslint-config-axkit@1.1.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.17(@types/node@25.0.8)(jiti@2.6.1)): dependencies: '@eslint/compat': 2.0.1(eslint@9.39.2(jiti@2.6.1)) '@eslint/js': 9.39.2 diff --git a/src/config/config.test.ts b/src/config/config.test.ts index 1fafe6e..38045f5 100644 --- a/src/config/config.test.ts +++ b/src/config/config.test.ts @@ -13,8 +13,7 @@ import type { Config } from "./config.js"; vi.mock("node:fs/promises"); vi.mock("./constants.js", async () => { - const actual = - await vi.importActual("./constants.js"); + const actual = await vi.importActual("./constants.js"); return { ...actual, createConfigStore: vi.fn(), @@ -88,7 +87,7 @@ describe("config", () => { projects: [{ path: "~/Developer/project", rules: ["test.md"] }], }); const config = parseConfig(json); - expect(typeof config.rulesSource).toBe("string"); + expectTypeOf(config.rulesSource).toBeString(); expect(config.rulesSource).toMatch(/sync-rules[/\\]rules$/u); expect(config.projects).toHaveLength(1); expect(config.projects[0]?.path).toMatch(/\//u); @@ -102,7 +101,7 @@ describe("config", () => { projects: [{ path: "./test", rules: ["!test/**", "!**/*.md"] }], }); - expect(() => parseConfig(json)).toThrow(z.ZodError); + expect(() => parseConfig(json)).toThrowError(z.ZodError); let zodError: z.ZodError | undefined; try { @@ -118,7 +117,7 @@ describe("config", () => { ).toBe(true); }); it("throws SyntaxError for invalid JSON syntax", () => { - expect(() => parseConfig("{invalid}")).toThrow(SyntaxError); + expect(() => parseConfig("{invalid}")).toThrowError(SyntaxError); }); // Missing projects and non-array projects are covered by table-driven tests below @@ -143,7 +142,9 @@ describe("config", () => { }, }, ])("should reject invalid project shapes: $name", ({ payload }) => { - expect(() => parseConfig(JSON.stringify(payload))).toThrow(z.ZodError); + expect(() => parseConfig(JSON.stringify(payload))).toThrowError( + z.ZodError, + ); }); // Nested errors are covered by the table-driven test and multi-error tests below @@ -157,7 +158,7 @@ describe("config", () => { ], }); - expect(() => parseConfig(json)).toThrow(z.ZodError); + expect(() => parseConfig(json)).toThrowError(z.ZodError); let zodError: z.ZodError | undefined; try { @@ -328,7 +329,7 @@ describe("config", () => { const promise = loadConfig(DEFAULT_CONFIG_PATH); - await expect(promise).rejects.toThrow(ConfigNotFoundError); + await expect(promise).rejects.toThrowError(ConfigNotFoundError); await expect(promise).rejects.toMatchObject({ path: DEFAULT_CONFIG_PATH, isDefault: true, @@ -344,7 +345,7 @@ describe("config", () => { store: {}, } as never); - await expect(loadConfig("/custom/config.json")).rejects.toThrow( + await expect(loadConfig("/custom/config.json")).rejects.toThrowError( ConfigNotFoundError, ); expect(fs.stat).toHaveBeenCalledTimes(1); @@ -360,7 +361,7 @@ describe("config", () => { } as never); const promise = loadConfig("/path/to/config.json"); - await expect(promise).rejects.toThrow(ConfigParseError); + await expect(promise).rejects.toThrowError(ConfigParseError); await expect(promise).rejects.toMatchObject({ path: "/path/to/config.json", }); @@ -375,7 +376,7 @@ describe("config", () => { store: {}, } as never); - await expect(loadConfig("/path/to/config.json")).rejects.toThrow( + await expect(loadConfig("/path/to/config.json")).rejects.toThrowError( ConfigAccessError, ); @@ -394,7 +395,7 @@ describe("config", () => { } as never); const promise = loadConfig("/path/to/config.json"); - await expect(promise).rejects.toThrow(ConfigAccessError); + await expect(promise).rejects.toThrowError(ConfigAccessError); await expect(promise).rejects.toMatchObject({ path: "/path/to/config.json", }); @@ -414,7 +415,7 @@ describe("config", () => { isFile: () => true, } as never); - await expect(loadConfig("/path/to/config.json")).rejects.toThrow( + await expect(loadConfig("/path/to/config.json")).rejects.toThrowError( ConfigParseError, ); }); diff --git a/src/core/execution.test.ts b/src/core/execution.test.ts index cf362ff..6666eba 100644 --- a/src/core/execution.test.ts +++ b/src/core/execution.test.ts @@ -50,9 +50,9 @@ describe("executeActions - algorithm tests", () => { { path: "/test/file.txt", content: "Hello" }, ]; - await expect(executeActions(actions, { dryRun: false })).rejects.toThrow( - Error, - ); + await expect( + executeActions(actions, { dryRun: false }), + ).rejects.toThrowError(Error); }); it("stops on first write error", async () => { @@ -65,9 +65,9 @@ describe("executeActions - algorithm tests", () => { { path: "/success/file.txt", content: "World" }, ]; - await expect(executeActions(actions, { dryRun: false })).rejects.toThrow( - Error, - ); + await expect( + executeActions(actions, { dryRun: false }), + ).rejects.toThrowError(Error); expect(fsPromises.writeFile).toHaveBeenCalledTimes(1); }); diff --git a/src/core/sync-global.test.ts b/src/core/sync-global.test.ts index a2c0906..b177057 100644 --- a/src/core/sync-global.test.ts +++ b/src/core/sync-global.test.ts @@ -81,6 +81,6 @@ describe("sync-global", () => { const paths = actionsArgument.map((action) => action.path); expect(paths.some((p) => p.endsWith("/.claude/CLAUDE.md"))).toBe(true); expect(paths.some((p) => p.endsWith("/.codex/AGENTS.md"))).toBe(true); - expect(result.written.length).toBe(2); + expect(result.written).toHaveLength(2); }); }); diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 89ba4df..724bd54 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -15,7 +15,7 @@ export class SyncError extends Error { constructor(message: string, details: SyncErrorDetails = {}, cause?: Error) { super(message, { cause }); - this.name = this.constructor.name; + this.name = "SyncError"; this.details = details; } } @@ -35,7 +35,7 @@ export class ConfigNotFoundError extends Error { super( `${location} not found at ${path}.\n${hint}\nTry 'sync-rules --help' for details.`, ); - this.name = this.constructor.name; + this.name = "ConfigNotFoundError"; this.path = path; this.isDefault = isDefault; } @@ -55,7 +55,7 @@ export class ConfigAccessError extends Error { const hint = "Check the file path and permissions."; const baseWithPeriod = /[.!?]$/u.test(base) ? base : `${base}.`; super(`${baseWithPeriod}\n${hint}`, { cause: originalError }); - this.name = this.constructor.name; + this.name = "ConfigAccessError"; this.path = path; this.originalError = originalError; } @@ -76,7 +76,7 @@ export class ConfigParseError extends Error { "Fix the JSON and glob patterns, then retry.\nTry 'sync-rules --help' for schema and examples."; const baseWithPeriod = /[.!?]$/u.test(base) ? base : `${base}.`; super(`${baseWithPeriod}\n${hint}`, { cause: originalError }); - this.name = this.constructor.name; + this.name = "ConfigParseError"; this.path = path; this.originalError = originalError; } @@ -100,7 +100,7 @@ export class SpawnError extends Error { ) { const message = SpawnError.buildMessage(command, code, exitCode, signal); super(message, { cause }); - this.name = this.constructor.name; + this.name = "SpawnError"; this.command = command; this.code = code; this.exitCode = exitCode; diff --git a/src/utils/paths.resolveInside.test.ts b/src/utils/paths.resolveInside.test.ts index c124fb8..53d1552 100644 --- a/src/utils/paths.resolveInside.test.ts +++ b/src/utils/paths.resolveInside.test.ts @@ -11,13 +11,13 @@ describe("resolveInside", () => { }); it("rejects path traversal attempts with ../ segments", () => { - expect(() => resolveInside(baseDirectory, "../../etc/passwd")).toThrow( + expect(() => resolveInside(baseDirectory, "../../etc/passwd")).toThrowError( /Refusing to write outside/u, ); }); it("rejects absolute paths outside base directory", () => { - expect(() => resolveInside(baseDirectory, "/etc/passwd")).toThrow( + expect(() => resolveInside(baseDirectory, "/etc/passwd")).toThrowError( /Refusing to write outside/u, ); }); @@ -30,6 +30,6 @@ describe("resolveInside", () => { it("rejects complex traversal attempts", () => { expect(() => resolveInside(baseDirectory, "valid/../../../etc/passwd"), - ).toThrow(/Refusing to write outside/u); + ).toThrowError(/Refusing to write outside/u); }); }); diff --git a/tests/integration/rules-fs.integration.test.ts b/tests/integration/rules-fs.integration.test.ts index 048da2b..df9e9ac 100644 --- a/tests/integration/rules-fs.integration.test.ts +++ b/tests/integration/rules-fs.integration.test.ts @@ -194,7 +194,7 @@ describe("filesystem operations", () => { await expect( readRuleContents(rulesDirectory, relativePaths), - ).rejects.toThrow(/Failed to read rule file.*nonexistent\.md/u); + ).rejects.toThrowError(/Failed to read rule file.*nonexistent\.md/u); }); }); });