pasika 0.10.36 → 0.10.37
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 +13 -3
- package/package.json +1 -1
|
@@ -1882,11 +1882,21 @@ function resolveComponentPlacement(componentFile, index) {
|
|
|
1882
1882
|
return { countedConsumers: counted, expectedFolder: shared, reason: "ccf" };
|
|
1883
1883
|
}
|
|
1884
1884
|
var formatFolder = (folder) => `src/${folder.join("/")}/`;
|
|
1885
|
+
function hasExactEntry(directory, entryName) {
|
|
1886
|
+
try {
|
|
1887
|
+
return fs2.readdirSync(directory).includes(entryName);
|
|
1888
|
+
} catch {
|
|
1889
|
+
return false;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
function hasComponentOwner(folderPath, folderName) {
|
|
1893
|
+
return hasExactEntry(folderPath, `${folderName}.tsx`);
|
|
1894
|
+
}
|
|
1885
1895
|
function isValidComponentFolder(folder, sourceRoot) {
|
|
1886
1896
|
const name = folder[folder.length - 1];
|
|
1887
1897
|
if (!name || SUPPORT_FOLDERS2.has(name)) return false;
|
|
1888
1898
|
const folderPath = path10.join(sourceRoot, ...folder);
|
|
1889
|
-
return
|
|
1899
|
+
return hasComponentOwner(folderPath, name) && hasExactEntry(folderPath, "index.ts");
|
|
1890
1900
|
}
|
|
1891
1901
|
function owningFolderOf(consumer, sourceRoot) {
|
|
1892
1902
|
const result = outOfSupportFolders(folderSegmentsOf(consumer, sourceRoot));
|
|
@@ -2156,7 +2166,7 @@ function componentFolderStart(segments) {
|
|
|
2156
2166
|
return -1;
|
|
2157
2167
|
}
|
|
2158
2168
|
function hasComponentBarrel(folderPath) {
|
|
2159
|
-
return
|
|
2169
|
+
return hasExactEntry(folderPath, "index.ts");
|
|
2160
2170
|
}
|
|
2161
2171
|
function componentFolderViolation(segments, sourceRoot) {
|
|
2162
2172
|
const start = componentFolderStart(segments);
|
|
@@ -2166,7 +2176,7 @@ function componentFolderViolation(segments, sourceRoot) {
|
|
|
2166
2176
|
if (!folder || SUPPORT_FOLDERS2.has(folder)) continue;
|
|
2167
2177
|
const folderPath = path13.join(sourceRoot, ...segments.slice(0, depth + 1));
|
|
2168
2178
|
const label = `src/${segments.slice(0, depth + 1).join("/")}/`;
|
|
2169
|
-
if (!
|
|
2179
|
+
if (!hasComponentOwner(folderPath, folder)) {
|
|
2170
2180
|
return `A folder that is not a support folder must be a component folder; add "${folder}.tsx" to ${label} or move its files into a support folder.`;
|
|
2171
2181
|
}
|
|
2172
2182
|
if (!hasComponentBarrel(folderPath)) {
|