Skip to content

Commit dea161d

Browse files
FloEdelmannaladdin-add
authored andcommitted
fix: ignore function calls in report-message-format
1 parent 63966cb commit dea161d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Diff for: lib/rules/report-message-format.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ module.exports = {
112112

113113
if (suggest && suggest.type === 'ArrayExpression') {
114114
suggest.elements
115-
.flatMap((obj) => obj.properties)
115+
.flatMap((obj) =>
116+
obj.type === 'ObjectExpression' ? obj.properties : []
117+
)
116118
.filter(
117119
(prop) =>
118120
prop.type === 'Property' &&

Diff for: tests/lib/rules/report-message-format.js

+11
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ ruleTester.run('report-message-format', rule, {
107107
`,
108108
options: ['^foo$'],
109109
},
110+
{
111+
// Suggestion function
112+
code: `
113+
module.exports = {
114+
create(context) {
115+
context.report({node, suggest: [getSuggestion(node)]});
116+
}
117+
};
118+
`,
119+
options: ['^foo$'],
120+
},
110121
{
111122
// Suggestion message
112123
code: `

0 commit comments

Comments
 (0)