-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(codemods): Do not fail on empty configMod config #25148
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -131,9 +131,9 @@ const configMod: CodeMod = { | |
run: (file: SourceFile) => { | ||
if (!__configs) { | ||
__configs = getCodeModsFromJson(); | ||
if (__configs === undefined || __configs.length === 0) { | ||
if (__configs === undefined) { | ||
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?', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}); | ||
} | ||
} | ||
|
@@ -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'] }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed from |
||
return Ok({ logs: ['No runnable mods were found in the config'] }); | ||
} | ||
|
||
return results.reduce(combineResults); | ||
|
There was a problem hiding this comment.
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.