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
6 changes: 3 additions & 3 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ interface ViolationReportBase {
/**
* The data to insert into the message.
*/
data?: Record<string, string> | undefined;
data?: Record<string, unknown> | undefined;

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

/**
* The fix to be applied for the suggestion.
*/
fix?: RuleFixer | null | undefined;
fix: RuleFixer;
}

type SuggestionMessage = { desc: string } | { messageId: string };
Expand Down
12 changes: 12 additions & 0 deletions packages/core/tests/types/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ const testRule: RuleDefinition<{
start: { line: node.start, column: 1 },
end: { line: node.start + 1, column: Infinity },
},
data: undefined,
fix(fixer: RuleTextEditor): RuleTextEdit {
return fixer.replaceText(
node,
Expand All @@ -318,6 +319,12 @@ const testRule: RuleDefinition<{
suggest: [
{
messageId: "Bar",
data: {
foo: "foo",
bar: 1,
baz: true,
},
// @ts-expect-error -- 'fix' is required in suggestion objects
fix: null,
},
],
Expand All @@ -328,6 +335,11 @@ const testRule: RuleDefinition<{
context.report({
message: "This baz is foobar",
loc: { line: node.start, column: 1 },
data: {
foo: "foo",
bar: 1,
baz: true,
},
fix: null,
suggest: null,
});
Expand Down