Skip to content
Merged
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
Expand Up @@ -718,7 +718,7 @@ function migrateImportDeclaration(node: ts.ImportDeclaration, sourceFile: ts.Sou
const importPath = moduleSpecifier.text;

// Only process igniteui-angular imports (not already using entry points)
if (importPath !== 'igniteui-angular') {
if (importPath !== 'igniteui-angular' && importPath !== '@infragistics/igniteui-angular') {
return null;
}

Expand Down Expand Up @@ -768,7 +768,7 @@ function migrateImportDeclaration(node: ts.ImportDeclaration, sourceFile: ts.Sou
const newImports: string[] = [];
for (const [entryPoint, imports] of entryPointGroups) {
const sortedImports = imports.sort();
newImports.push(`import { ${sortedImports.join(', ')} } from 'igniteui-angular/${entryPoint}';`);
newImports.push(`import { ${sortedImports.join(', ')} } from '${importPath}/${entryPoint}';`);
}

return {
Expand Down Expand Up @@ -799,7 +799,7 @@ function migrateFile(filePath: string, content: string): string {

// Track old type names that were imported
const moduleSpecifier = node.moduleSpecifier;
if (ts.isStringLiteral(moduleSpecifier) && moduleSpecifier.text === 'igniteui-angular') {
if (ts.isStringLiteral(moduleSpecifier) && (moduleSpecifier.text === 'igniteui-angular' || moduleSpecifier.text === '@infragistics/igniteui-angular')) {
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The package name check is duplicated across multiple locations (lines 721, 802, and 880-881). Consider extracting this into a helper function like isIgniteUIPackage(packageName: string): boolean to improve maintainability and reduce duplication.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot Yes, that'd be an improvement and even better there's already an namedImportFilter in projects\igniteui-angular\migrations\common\tsUtils.ts that does a similar check for other migrations that should've been used to begin with.
Since this one is merged, create a new PR against master to update this migration to use the tsUtil and while at it adjust the namedImportFilter function to also handle subpaths because the current endWith check handles @infragistics/igniteui-angular as well, but limits the subpaths for entry points after the main package name.

const importClause = node.importClause;
if (importClause?.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
for (const element of importClause.namedBindings.elements) {
Expand Down Expand Up @@ -877,7 +877,8 @@ export default function migrate(): Rule {
const originalContent = content.toString();

// Check if file has igniteui-angular imports
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"')) {
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"') &&
!originalContent.includes("from '@infragistics/igniteui-angular'") && !originalContent.includes('from "@infragistics/igniteui-angular"')) {
Comment on lines +880 to +881
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

This condition is checking four string variations for two package names. Consider using a regular expression pattern like /from ['"](@infragistics\/)?igniteui-angular['"]/ to simplify the check and improve readability.

Suggested change
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"') &&
!originalContent.includes("from '@infragistics/igniteui-angular'") && !originalContent.includes('from "@infragistics/igniteui-angular"')) {
if (!/from\s+['"](@infragistics\/)?igniteui-angular['"]/.test(originalContent)) {

Copilot uses AI. Check for mistakes.
return;
}

Expand Down
Loading