pasika 0.10.80 → 0.10.82
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 +20 -3
- package/package.json +1 -1
|
@@ -386,6 +386,17 @@ function parseModule(file) {
|
|
|
386
386
|
names.add(node.name.text);
|
|
387
387
|
} else if (ts.isElementAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === namespace && ts.isStringLiteral(node.argumentExpression)) {
|
|
388
388
|
names.add(node.argumentExpression.text);
|
|
389
|
+
} else if (ts.isVariableDeclaration(node) && ts.isObjectBindingPattern(node.name) && node.initializer && ts.isIdentifier(node.initializer) && node.initializer.text === namespace) {
|
|
390
|
+
for (const element of node.name.elements) {
|
|
391
|
+
if (element.dotDotDotToken) continue;
|
|
392
|
+
let importedName;
|
|
393
|
+
if (element.propertyName) {
|
|
394
|
+
importedName = propertyName(element.propertyName);
|
|
395
|
+
} else if (ts.isIdentifier(element.name)) {
|
|
396
|
+
importedName = element.name.text;
|
|
397
|
+
}
|
|
398
|
+
if (importedName) names.add(importedName);
|
|
399
|
+
}
|
|
389
400
|
}
|
|
390
401
|
ts.forEachChild(node, visit);
|
|
391
402
|
};
|
|
@@ -7035,7 +7046,7 @@ var rootSupportPlacementRule = {
|
|
|
7035
7046
|
schema: [],
|
|
7036
7047
|
type: "problem",
|
|
7037
7048
|
docs: {
|
|
7038
|
-
description: "Require
|
|
7049
|
+
description: "Require zero-consumer or app-only support-folder exports to live under a feature folder, not root or elsewhere."
|
|
7039
7050
|
}
|
|
7040
7051
|
},
|
|
7041
7052
|
create(context) {
|
|
@@ -7059,10 +7070,16 @@ var rootSupportPlacementRule = {
|
|
|
7059
7070
|
for (const exp of module.exports) {
|
|
7060
7071
|
if (exp.kind !== expectedKind) continue;
|
|
7061
7072
|
const consumers = [...index.symbolConsumers.get(symbolKey(file, exp.name)) ?? []];
|
|
7062
|
-
|
|
7073
|
+
const where = isRoot ? `root src/${supportFolder}/` : `src/${folderSegments.join("/")}/`;
|
|
7074
|
+
if (consumers.length === 0) {
|
|
7075
|
+
findings.push({
|
|
7076
|
+
line: exp.line,
|
|
7077
|
+
message: `${label} "${exp.name}" has no consumers, so it has not earned ${where}; move it into the feature it represents (src/features/<feature>/${supportFolder}/), or remove it if it is unused. See ${doc}`
|
|
7078
|
+
});
|
|
7079
|
+
continue;
|
|
7080
|
+
}
|
|
7063
7081
|
const outsideApp = consumers.filter((consumer) => isPlacingConsumer(consumer, sourceRoot));
|
|
7064
7082
|
if (outsideApp.length > 0) continue;
|
|
7065
|
-
const where = isRoot ? `root src/${supportFolder}/` : `src/${folderSegments.join("/")}/`;
|
|
7066
7083
|
findings.push({
|
|
7067
7084
|
line: exp.line,
|
|
7068
7085
|
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}`
|