diff --git a/package.json b/package.json index 7870ba402..52fe496ae 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "knip": "^5.62.0", "lint-staged": "^16.0.0", "mocha": "^11.5.0", - "prettier": "^3.4.1", + "prettier": "^3.7.0", "rollup": "^4.52.3", "typescript": "^5.8.3", "typescript-eslint": "^8.0.0", diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 95604e70d..1fd839cf7 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -447,11 +447,16 @@ export type RuleFixer = ( fixer: RuleTextEditor, ) => RuleTextEdit | Iterable | null; +export type MessagePlaceholderData = Record< + string, + string | number | boolean | bigint | null | undefined +>; + export interface ViolationReportBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: MessagePlaceholderData | undefined; /** * The fix to be applied for the violation. @@ -485,7 +490,7 @@ export interface SuggestedEditBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: MessagePlaceholderData | undefined; /** * The fix to be applied for the suggestion. @@ -1030,8 +1035,9 @@ export interface BaseConfig< /** * The overwrites that apply more differing configuration to specific files or directories. */ -export interface ConfigOverride - extends BaseConfig { +export interface ConfigOverride< + Rules extends RulesConfig = RulesConfig, +> extends BaseConfig { /** * The glob patterns for excluded files. */ diff --git a/packages/core/tests/types/types.test.ts b/packages/core/tests/types/types.test.ts index 14935c2fe..2861115c1 100644 --- a/packages/core/tests/types/types.test.ts +++ b/packages/core/tests/types/types.test.ts @@ -96,15 +96,12 @@ interface TestLanguageOptions extends LanguageOptions { howMuch?: "yes" | "no" | boolean; } -class TestSourceCode - implements - TextSourceCode<{ - LangOptions: TestLanguageOptions; - RootNode: TestRootNode; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; - }> -{ +class TestSourceCode implements TextSourceCode<{ + LangOptions: TestLanguageOptions; + RootNode: TestRootNode; + SyntaxElementWithLoc: unknown; + ConfigNode: unknown; +}> { text: string; ast: TestRootNode; notMuch: "no" | false; @@ -323,6 +320,28 @@ const testRule: RuleDefinition<{ foo: "foo", bar: 1, baz: true, + qux: false, + a: 1n, + b: null, + c: undefined, + d: void 0, + // @ts-expect-error -- Symbols are not allowed in `data`. + e: Symbol("b"), + // @ts-expect-error -- Objects are not allowed in `data`. + f: { + hi: "hi", + }, + // @ts-expect-error -- Arrays are not allowed in `data`. + g: [1, 2, 3], + // @ts-expect-error -- Sets are not allowed in `data`. + h: new Set([1, 2, 3]), + // @ts-expect-error -- Maps are not allowed in `data`. + i: new Map([ + ["a", 1], + ["b", 2], + ]), + // @ts-expect-error -- Functions are not allowed in `data`. + j: () => {}, }, // @ts-expect-error -- 'fix' is required in suggestion objects fix: null, @@ -339,6 +358,28 @@ const testRule: RuleDefinition<{ foo: "foo", bar: 1, baz: true, + qux: false, + a: 1n, + b: null, + c: undefined, + d: void 0, + // @ts-expect-error -- Symbols are not allowed in `data`. + e: Symbol("b"), + // @ts-expect-error -- Objects are not allowed in `data`. + f: { + hi: "hi", + }, + // @ts-expect-error -- Arrays are not allowed in `data`. + g: [1, 2, 3], + // @ts-expect-error -- Sets are not allowed in `data`. + h: new Set([1, 2, 3]), + // @ts-expect-error -- Maps are not allowed in `data`. + i: new Map([ + ["a", 1], + ["b", 2], + ]), + // @ts-expect-error -- Functions are not allowed in `data`. + j: () => {}, }, fix: null, suggest: null, @@ -394,8 +435,8 @@ const testRuleWithInvalidDefaultOptions: RuleDefinition<{ testRuleWithInvalidDefaultOptions.meta satisfies RulesMeta | undefined; type TestRuleDefinition< - Options extends - Partial = CustomRuleTypeDefinitions, + Options extends Partial = + CustomRuleTypeDefinitions, > = CustomRuleDefinitionType< { LangOptions: TestLanguageOptions; diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 7227000f6..4a7f90736 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -36,7 +36,7 @@ "node": "^20.19.0 || ^22.13.0 || >=24" }, "dependencies": { - "@modelcontextprotocol/sdk": "^1.22.0", + "@modelcontextprotocol/sdk": "1.22.0", "eslint": "^9.39.1", "zod": "^3.24.4" },