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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: Do not fail on empty configMod config",
"packageName": "@fluentui/codemods",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ const configMod: CodeMod = {
run: (file: SourceFile) => {
if (!__configs) {
__configs = getCodeModsFromJson();
if (__configs === undefined || __configs.length === 0) {
if (__configs === undefined) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty array is now OK here, handled by the next condition.

return Err<ModResult, ModError>({
error: 'failed to get any mods from json. Perhaps the file is missing or malformed?',
error: 'Failed to get any mods from json. Perhaps the file is missing or malformed?',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This had probably been meant not to fail the codemod pipeline. But it changed in #17932 accidentally

});
}
}
Expand All @@ -144,7 +144,7 @@ const configMod: CodeMod = {
results.push(mod.run(file));
}
if (results.length === 0) {
return Err<ModResult, NoOp>({ logs: ['No runabble mods were found in the config'] });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from Err to Ok because the log message is swallowed otherwise.

return Ok({ logs: ['No runnable mods were found in the config'] });
}

return results.reduce(combineResults);
Expand Down