diff --git a/.changeset/fluffy-bobcats-tell.md b/.changeset/fluffy-bobcats-tell.md new file mode 100644 index 0000000000..41ed20a7ae --- /dev/null +++ b/.changeset/fluffy-bobcats-tell.md @@ -0,0 +1,5 @@ +--- +'@backstage/eslint-plugin': patch +--- + +Fix custom rules package scanning performance. diff --git a/packages/eslint-plugin/rules/no-undeclared-imports.js b/packages/eslint-plugin/rules/no-undeclared-imports.js index b770ded365..17331d2fce 100644 --- a/packages/eslint-plugin/rules/no-undeclared-imports.js +++ b/packages/eslint-plugin/rules/no-undeclared-imports.js @@ -319,6 +319,7 @@ module.exports = { if (importsToAdd.length > 0) { addMissingImports(importsToAdd, packages, localPkg); + packages.clearCache(); // This switches all import directives back to the original import. for (const added of importsToAdd) { context.report({ @@ -336,6 +337,7 @@ module.exports = { removeInlineImports(importsToInline, localPkg); addForwardedInlineImports(importsToInline, localPkg); + packages.clearCache(); for (const inlined of importsToInline) { context.report({ node: inlined.node, @@ -350,8 +352,6 @@ module.exports = { } importsToInline.length = 0; } - - packages.clearCache(); }, ...visitImports(context, (node, imp) => { // We leave checking of type imports to the repo-tools check,