Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrokirpa committed Jan 7, 2025
1 parent 6c2e6cf commit 36d5675
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const rule = createRule<Options, MessageIds>({
break;
default:
if (isMigration(name)) {
const migration = getMigrationData(MIGRATIONS[name]);
const migration = getMigrationDetails(MIGRATIONS[name]);

context.report({
node,
Expand Down Expand Up @@ -148,6 +148,10 @@ const isMigration = (name: string): name is keyof typeof MIGRATIONS => name in M
/**
* Get the component and package name to use for a migration.
*/
const getMigrationData = (migration: Migration) => {
return typeof migration === 'string' ? { component: migration, package: '@fluentui/react-components' } : migration;
const getMigrationDetails = (migration: Migration) => {
if (typeof migration === 'string') {
return { component: migration, package: '@fluentui/react-components' };
}

return migration;
};

0 comments on commit 36d5675

Please sign in to comment.