@effect/language-service 0.23.4 → 0.23.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +21 -4
- package/transform.js.map +1 -1
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -2600,6 +2600,8 @@ var importFromBarrel = createDiagnostic({
|
|
|
2600
2600
|
if (!moduleSymbol.exports) return;
|
|
2601
2601
|
const sourceFile2 = importDeclaration.getSourceFile();
|
|
2602
2602
|
const nodeForSymbol = element.propertyName || element.name;
|
|
2603
|
+
const aliasSymbol = element.name || element.propertyName;
|
|
2604
|
+
const aliasedName = aliasSymbol.text;
|
|
2603
2605
|
if (!ts.isIdentifier(nodeForSymbol)) return;
|
|
2604
2606
|
const importedName = nodeForSymbol.text;
|
|
2605
2607
|
const reexportedSymbol = moduleSymbol.exports.get(ts.escapeLeadingUnderscores(importedName));
|
|
@@ -2622,7 +2624,15 @@ var importFromBarrel = createDiagnostic({
|
|
|
2622
2624
|
program
|
|
2623
2625
|
);
|
|
2624
2626
|
if (unbarrelledFileName.toLowerCase().indexOf(barrelModuleName.toLowerCase() + "/") === -1) return;
|
|
2625
|
-
return {
|
|
2627
|
+
return {
|
|
2628
|
+
unbarrelledFileName,
|
|
2629
|
+
importedName,
|
|
2630
|
+
barrelModuleName,
|
|
2631
|
+
importClause,
|
|
2632
|
+
namedBindings,
|
|
2633
|
+
importDeclaration,
|
|
2634
|
+
aliasedName
|
|
2635
|
+
};
|
|
2626
2636
|
};
|
|
2627
2637
|
const nodeToVisit = [];
|
|
2628
2638
|
const appendNodeToVisit = (node) => {
|
|
@@ -2639,14 +2649,21 @@ var importFromBarrel = createDiagnostic({
|
|
|
2639
2649
|
}
|
|
2640
2650
|
const result = isImportedFromBarrelExport(node);
|
|
2641
2651
|
if (!result) continue;
|
|
2642
|
-
const {
|
|
2652
|
+
const {
|
|
2653
|
+
aliasedName,
|
|
2654
|
+
barrelModuleName,
|
|
2655
|
+
importClause,
|
|
2656
|
+
importDeclaration,
|
|
2657
|
+
namedBindings,
|
|
2658
|
+
unbarrelledFileName
|
|
2659
|
+
} = result;
|
|
2643
2660
|
report({
|
|
2644
2661
|
node,
|
|
2645
2662
|
messageText: `Importing from barrel module ${barrelModuleName} is not allowed.`,
|
|
2646
2663
|
fixes: [
|
|
2647
2664
|
{
|
|
2648
2665
|
fixName: "replaceWithUnbarrelledImport",
|
|
2649
|
-
description: `Import * as ${
|
|
2666
|
+
description: `Import * as ${aliasedName} from ${unbarrelledFileName}`,
|
|
2650
2667
|
apply: gen(function* () {
|
|
2651
2668
|
const changeTracker = yield* service(ChangeTracker);
|
|
2652
2669
|
const newImport = ts.factory.createImportDeclaration(
|
|
@@ -2654,7 +2671,7 @@ var importFromBarrel = createDiagnostic({
|
|
|
2654
2671
|
ts.factory.createImportClause(
|
|
2655
2672
|
importClause.isTypeOnly || node.isTypeOnly,
|
|
2656
2673
|
void 0,
|
|
2657
|
-
ts.factory.createNamespaceImport(ts.factory.createIdentifier(
|
|
2674
|
+
ts.factory.createNamespaceImport(ts.factory.createIdentifier(aliasedName))
|
|
2658
2675
|
),
|
|
2659
2676
|
ts.factory.createStringLiteral(unbarrelledFileName)
|
|
2660
2677
|
);
|