MCPcopy
hub / github.com/rollup/rollup / warnUnusedImports

Method warnUnusedImports

src/ExternalModule.ts:96–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94 }
95
96 warnUnusedImports(): void {
97 const unused = [...this.declarations]
98 .filter(
99 ([name, declaration]) =>
100 name !== '*' && !declaration.included && !this.reexported && !declaration.referenced
101 )
102 .map(([name]) => name);
103
104 if (unused.length === 0) return;
105
106 const importersSet = new Set<string>();
107 for (const name of unused) {
108 const importersOfName = this.importersByExportedName.get(name);
109 for (const importer of this.importers) {
110 if (!importersOfName?.has(importer)) continue;
111 importersSet.add(importer);
112 }
113 }
114 const importersArray = [...importersSet];
115 this.options.onLog(LOGLEVEL_WARN, logUnusedExternalImports(this.id, unused, importersArray));
116 }
117}

Callers 1

includeStatementsMethod · 0.80

Calls 4

logUnusedExternalImportsFunction · 0.90
getMethod · 0.80
addMethod · 0.80
hasMethod · 0.65

Tested by

no test coverage detected