eslint-plugin-use-agnostic 1.8.0 → 1.8.1
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.
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
environments_allowedChainImportEnvironments,
|
|
30
30
|
commentedDirectives_reactDirectives,
|
|
31
31
|
reactDirectives_asTexts,
|
|
32
|
+
USE_AGNOSTIC_CONDITIONS,
|
|
32
33
|
} from "../constants/bases.js";
|
|
33
34
|
|
|
34
35
|
import { highlightFirstLineOfCode } from "../../../_commons/utilities/helpers.js";
|
|
@@ -620,12 +621,42 @@ export const allExportsFlow = (
|
|
|
620
621
|
currentFileCommentedDirective
|
|
621
622
|
);
|
|
622
623
|
|
|
623
|
-
// returns early if an address has been made
|
|
624
|
-
if (!addressedDirective) return;
|
|
624
|
+
// // returns early if an address has been made
|
|
625
|
+
// if (!addressedDirective) return;
|
|
625
626
|
// moves on to the re-export check otherwise
|
|
626
|
-
else
|
|
627
|
+
// else
|
|
628
|
+
currentFileCommentedDirective = addressedDirective; // to still keep compatibility with strategies
|
|
627
629
|
|
|
628
|
-
|
|
630
|
+
// Lints imports of Agnostic Strategies Modules beyond strategy resolution, such as to warn imports of Special Agnostic Modules. Does the same with Agnostic Conditions Modules, since they are the only other modules which cannot import themselves.
|
|
631
|
+
if (
|
|
632
|
+
currentFileCommentedDirective === USE_AGNOSTIC_STRATEGIES ||
|
|
633
|
+
currentFileCommentedDirective === USE_AGNOSTIC_CONDITIONS
|
|
634
|
+
) {
|
|
635
|
+
// Basically, all modules need to do reexports that correspond to their own modules, but not Agnostic Strategies Modules and Agnostic Conditions Modules, the latter which are in fact NOT allowed to do re-exports.
|
|
636
|
+
if (
|
|
637
|
+
isImportBlocked(
|
|
638
|
+
currentFileCommentedDirective,
|
|
639
|
+
importedFileCommentedDirective
|
|
640
|
+
)
|
|
641
|
+
) {
|
|
642
|
+
context.report({
|
|
643
|
+
node,
|
|
644
|
+
messageId: importBreaksCommentedImportRulesMessageId,
|
|
645
|
+
data: {
|
|
646
|
+
[commentedDirectiveMessage]:
|
|
647
|
+
makeMessageFromCurrentFileCommentedDirective(
|
|
648
|
+
currentFileCommentedDirective
|
|
649
|
+
),
|
|
650
|
+
[specificViolationMessage]: findSpecificViolationMessage(
|
|
651
|
+
currentFileCommentedDirective,
|
|
652
|
+
importedFileCommentedDirective
|
|
653
|
+
),
|
|
654
|
+
},
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
} else if (
|
|
658
|
+
currentFileCommentedDirective !== importedFileCommentedDirective
|
|
659
|
+
) {
|
|
629
660
|
context.report({
|
|
630
661
|
node,
|
|
631
662
|
messageId: reExportNotSameMessageId,
|
|
@@ -338,7 +338,7 @@ export const addressDirectiveIfAgnosticStrategies = (
|
|
|
338
338
|
// });
|
|
339
339
|
// }
|
|
340
340
|
|
|
341
|
-
return exportStrategizedDirective; // null indicates failure
|
|
341
|
+
return exportStrategizedDirective ?? currentFileCommentedDirective; // null indicates failure, but now that Agnostic Strategies Modules are regularly linted like any other modules, they need to surface
|
|
342
342
|
};
|
|
343
343
|
|
|
344
344
|
/* isImportBlocked */
|