-
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
fix(codemods): Do not fail on empty configMod config #25148
Conversation
@@ -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 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.
@@ -131,9 +131,9 @@ const configMod: CodeMod = { | |||
run: (file: SourceFile) => { | |||
if (!__configs) { | |||
__configs = getCodeModsFromJson(); | |||
if (__configs === undefined || __configs.length === 0) { | |||
if (__configs === undefined) { |
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.
📊 Bundle size report🤖 This report was generated against b4a703103ebdf240bdce2fd629d8e5783ebb6ad1 |
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: b4a703103ebdf240bdce2fd629d8e5783ebb6ad1 (build) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f325b20:
|
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 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
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.
ty!
* master: fix: Menu trigger should be focused when menu is closed with keyboard (microsoft#25165) fix(codemods): Do not fail on empty configMod config (microsoft#25148) fix: Field should have block layout, not inline (microsoft#25126) chore: Update Griffel to latest version (microsoft#25075)
* fix(codemod): Do not fail on empty configMod config * change file
Current Behavior
When
@fluentui/codemods
is run,configMod
fails because of its config is empty. Changes from other executed codemods are not saved.New Behavior
Empty
configMod
config is considered valid, the mod is skipped.Related Issue(s)
Fixes #19847