pasika 0.10.0 → 0.10.2
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/dist/eslint/pasika/index.js +8 -11
- package/package.json +1 -1
|
@@ -1618,6 +1618,10 @@ function folderSegmentsOf(file, sourceRoot) {
|
|
|
1618
1618
|
var isUnderApp = (segments) => segments[0] === "app";
|
|
1619
1619
|
var isConfigModule = (segments) => segments[0] === "config";
|
|
1620
1620
|
var isUnderCompositions = (segments) => segments[0] === "compositions";
|
|
1621
|
+
function isPlacingConsumer(consumer, sourceRoot) {
|
|
1622
|
+
const segments = segmentsOf(consumer, sourceRoot);
|
|
1623
|
+
return segments.length > 0 && !isUnderApp(segments);
|
|
1624
|
+
}
|
|
1621
1625
|
function commonPrefix(folders) {
|
|
1622
1626
|
if (folders.length === 0) return [];
|
|
1623
1627
|
const [first = []] = folders;
|
|
@@ -1662,13 +1666,10 @@ function owningFolderOf(consumer, sourceRoot) {
|
|
|
1662
1666
|
var configModuleOf = (segments) => isConfigModule(segments) && segments.length >= 3 ? segments[1] : void 0;
|
|
1663
1667
|
function resolveSupportPlacement(supportFile, supportFolder, index) {
|
|
1664
1668
|
const consumers = [...index.consumers.get(supportFile) ?? []].filter(
|
|
1665
|
-
(consumer) =>
|
|
1669
|
+
(consumer) => isPlacingConsumer(consumer, index.sourceRoot)
|
|
1666
1670
|
);
|
|
1667
1671
|
if (consumers.length === 0) return void 0;
|
|
1668
1672
|
const consumerSegments = consumers.map((consumer) => segmentsOf(consumer, index.sourceRoot));
|
|
1669
|
-
if (consumerSegments.some((segments) => isUnderApp(segments))) {
|
|
1670
|
-
return { countedConsumers: consumers, expectedFolder: [supportFolder], reason: "app-consumer" };
|
|
1671
|
-
}
|
|
1672
1673
|
const configModules = new Set(consumerSegments.map((segments) => configModuleOf(segments)));
|
|
1673
1674
|
const [onlyConfigModule] = [...configModules];
|
|
1674
1675
|
if (configModules.size === 1 && onlyConfigModule !== void 0) {
|
|
@@ -1759,7 +1760,6 @@ var componentPlacementRule = {
|
|
|
1759
1760
|
import path13 from "path";
|
|
1760
1761
|
var CONFIG_OWNED_FOLDERS = /* @__PURE__ */ new Set(["types", "constants"]);
|
|
1761
1762
|
var REASON_TEXT2 = {
|
|
1762
|
-
"app-consumer": "a file under src/app/ imports it, so it belongs to the app-wide support folder",
|
|
1763
1763
|
"config-module": "every file that imports it belongs to that configuration module",
|
|
1764
1764
|
ccf: "that is the closest folder its consumers share",
|
|
1765
1765
|
"across-features": "its consumers span more than one feature, so no feature can own it",
|
|
@@ -3099,15 +3099,12 @@ var rootSupportPlacementRule = {
|
|
|
3099
3099
|
if (exp.kind !== expectedKind) continue;
|
|
3100
3100
|
const consumers = [...index.symbolConsumers.get(symbolKey(file, exp.name)) ?? []];
|
|
3101
3101
|
if (consumers.length === 0) continue;
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3104
|
-
return !isUnderApp(consumerSegments) && !isConfigModule(consumerSegments);
|
|
3105
|
-
});
|
|
3106
|
-
if (real.length > 0) continue;
|
|
3102
|
+
const outsideApp = consumers.filter((consumer) => isPlacingConsumer(consumer, sourceRoot));
|
|
3103
|
+
if (outsideApp.length > 0) continue;
|
|
3107
3104
|
const where = isRoot ? `root src/${supportFolder}/` : `src/${folderSegments.join("/")}/`;
|
|
3108
3105
|
findings.push({
|
|
3109
3106
|
line: exp.line,
|
|
3110
|
-
message: `${label} "${exp.name}"
|
|
3107
|
+
message: `${label} "${exp.name}" is consumed only from src/app/, so it has not earned ${where}; move it into the feature it represents (src/features/<feature>/${supportFolder}/). If no existing feature applies, introduce a new feature folder. See ${doc}`
|
|
3111
3108
|
});
|
|
3112
3109
|
}
|
|
3113
3110
|
if (findings.length === 0) return {};
|