Cleanup last known self imports (#19067)

* clean up self imports in workspace module

* clean up media type self imports

* fix self imports in property action module

* fix self imports in propety editor module

* Update index.js

* lower threshold
This commit is contained in:
Mads Rasmussen
2025-04-16 21:33:25 +02:00
committed by GitHub
parent c63ed69ee2
commit 59cad092ae
18 changed files with 33 additions and 33 deletions

View File

@@ -3,7 +3,7 @@ import path from 'path';
import { createImportMap } from '../importmap/index.js';
const ILLEGAL_CORE_IMPORTS_THRESHOLD = 6;
const SELF_IMPORTS_THRESHOLD = 4;
const SELF_IMPORTS_THRESHOLD = 0;
const clientProjectRoot = path.resolve(import.meta.dirname, '../../');
const modulePrefix = '@umbraco-cms/backoffice/';
@@ -141,6 +141,8 @@ function reportIllegalImportsFromCore() {
throw new Error(
`Illegal imports found in ${total} core modules. ${total - ILLEGAL_CORE_IMPORTS_THRESHOLD} more than the threshold.`,
);
} else if (total === 0) {
console.log(`✅ Success! No illegal imports found.`);
} else {
console.log(
`✅ Success! Still (${total}) under the threshold of ${ILLEGAL_CORE_IMPORTS_THRESHOLD} illegal imports. `,
@@ -167,15 +169,16 @@ function reportSelfImportsFromModules() {
// If there are self imports, log them
console.error(`🚨 ${alias} is importing itself`);
console.log(`\n`);
total++;
});
console.log(`\n`);
if (total > SELF_IMPORTS_THRESHOLD) {
throw new Error(
`Self imports found in ${total} modules. ${total - SELF_IMPORTS_THRESHOLD} more than the threshold.`,
);
} else if (total === 0) {
console.log(`✅ Success! No self imports found.`);
} else {
console.log(`✅ Success! Still (${total}) under the threshold of ${SELF_IMPORTS_THRESHOLD} self imports.`);
}