Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
9 changes: 7 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,16 @@ export type RuleFixer = (
fixer: RuleTextEditor,
) => RuleTextEdit | Iterable<RuleTextEdit> | null;

export type MessagePlaceholderData = Record<
string,
string | number | boolean | bigint | null | undefined
>;

export interface ViolationReportBase {
/**
* The data to insert into the message.
*/
data?: Record<string, unknown> | undefined;
data?: MessagePlaceholderData | undefined;

/**
* The fix to be applied for the violation.
Expand Down Expand Up @@ -485,7 +490,7 @@ export interface SuggestedEditBase {
/**
* The data to insert into the message.
*/
data?: Record<string, unknown> | undefined;
data?: MessagePlaceholderData | undefined;

/**
* The fix to be applied for the suggestion.
Expand Down
44 changes: 44 additions & 0 deletions packages/core/tests/types/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,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,
Expand All @@ -339,6 +361,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,
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Loading