pasika 0.10.94 → 0.10.95
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 +15 -3
- package/package.json +1 -1
|
@@ -3970,7 +3970,7 @@ var importBoundariesRule = {
|
|
|
3970
3970
|
const isAppLocalStyleImport = importerLayer === "app" && importedLayer === "app" && styleExtensions.has(extension);
|
|
3971
3971
|
const importedIsRootSupport = rootSupportFolders.has(importedLayer);
|
|
3972
3972
|
const importedIsSameConfig = importerLayer === "config" && importedLayer === "config" && importer[1] === imported[1];
|
|
3973
|
-
const isAllowed = !isCodeModule && importerLayer === "app" && isAppLocalStyleImport || isCodeModule && importerLayer === "app" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "compositions" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "features" && (importedLayer === "features" && importerFeature === importedFeature || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "shared" && (importedLayer === "shared" || importedIsRootSupport) || isCodeModule && rootSupportFolders.has(importerLayer) && importedIsRootSupport && (importerLayer !== "config" || importedLayer !== "config" || importedIsSameConfig);
|
|
3973
|
+
const isAllowed = !isCodeModule && importerLayer === "app" && isAppLocalStyleImport || isCodeModule && importerLayer === "app" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "compositions" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "features" && (importedLayer === "features" && importerFeature === importedFeature || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "shared" && (importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importer.length === 1 && importedIsRootSupport || isCodeModule && rootSupportFolders.has(importerLayer) && importedIsRootSupport && (importerLayer !== "config" || importedLayer !== "config" || importedIsSameConfig);
|
|
3974
3974
|
if (!isAllowed) {
|
|
3975
3975
|
context.report({
|
|
3976
3976
|
node: source,
|
|
@@ -4069,12 +4069,13 @@ var importThroughIndexRule = {
|
|
|
4069
4069
|
schema: [],
|
|
4070
4070
|
type: "problem",
|
|
4071
4071
|
docs: {
|
|
4072
|
-
description: "
|
|
4072
|
+
description: "Enforce public support barrels and direct sibling constants imports."
|
|
4073
4073
|
}
|
|
4074
4074
|
},
|
|
4075
4075
|
create(context) {
|
|
4076
4076
|
const filename = path32.resolve(context.filename);
|
|
4077
4077
|
const sourceRoot = sourceRootOf2(context, filename);
|
|
4078
|
+
const importerSegments = segmentsOf(filename, sourceRoot);
|
|
4078
4079
|
return {
|
|
4079
4080
|
Program(node) {
|
|
4080
4081
|
for (const specifier of importSpecifiers(context.sourceCode.text)) {
|
|
@@ -4085,8 +4086,19 @@ var importThroughIndexRule = {
|
|
|
4085
4086
|
(segment) => ["constants", "types", "schemas"].includes(segment)
|
|
4086
4087
|
);
|
|
4087
4088
|
const supportFolder = supportFolderIndex >= 0 ? targetSegments[supportFolderIndex] : void 0;
|
|
4088
|
-
if (!supportFolder
|
|
4089
|
+
if (!supportFolder) continue;
|
|
4089
4090
|
const folderIndex = targetSegments.slice(0, supportFolderIndex + 1);
|
|
4091
|
+
const withinSameSupportFolder = importerSegments.length > supportFolderIndex + 1 && folderIndex.every((segment, index) => importerSegments[index] === segment);
|
|
4092
|
+
if (path32.basename(target).startsWith("index.")) {
|
|
4093
|
+
if (supportFolder === "constants" && withinSameSupportFolder) {
|
|
4094
|
+
context.report({
|
|
4095
|
+
node,
|
|
4096
|
+
message: `Import sibling constants directly instead of through "${specifier}" to avoid circular barrel imports. See the next-codebase-guide constants rule.`
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
4099
|
+
continue;
|
|
4100
|
+
}
|
|
4101
|
+
if (withinSameSupportFolder) continue;
|
|
4090
4102
|
const expected = `@/${folderIndex.join("/")}`;
|
|
4091
4103
|
context.report({
|
|
4092
4104
|
node,
|