pasika 0.10.71 → 0.10.72
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 -0
- package/package.json +1 -1
|
@@ -379,6 +379,19 @@ function parseModule(file) {
|
|
|
379
379
|
if (!ts.isStringLiteral(specifierNode)) return;
|
|
380
380
|
imports.push({ specifier: specifierNode.text, names, line: lineOf(sourceFile, node) });
|
|
381
381
|
};
|
|
382
|
+
const namespaceMemberNames = (namespace) => {
|
|
383
|
+
const names = /* @__PURE__ */ new Set();
|
|
384
|
+
const visit = (node) => {
|
|
385
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === namespace) {
|
|
386
|
+
names.add(node.name.text);
|
|
387
|
+
} else if (ts.isElementAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === namespace && ts.isStringLiteral(node.argumentExpression)) {
|
|
388
|
+
names.add(node.argumentExpression.text);
|
|
389
|
+
}
|
|
390
|
+
ts.forEachChild(node, visit);
|
|
391
|
+
};
|
|
392
|
+
visit(sourceFile);
|
|
393
|
+
return [...names];
|
|
394
|
+
};
|
|
382
395
|
for (const statement of sourceFile.statements) {
|
|
383
396
|
if (ts.isImportDeclaration(statement)) {
|
|
384
397
|
const names = [];
|
|
@@ -386,6 +399,8 @@ function parseModule(file) {
|
|
|
386
399
|
if (statement.importClause?.name) names.push(statement.importClause.name.text);
|
|
387
400
|
if (bindings && ts.isNamedImports(bindings)) {
|
|
388
401
|
for (const element of bindings.elements) names.push(element.propertyName?.text ?? element.name.text);
|
|
402
|
+
} else if (bindings && ts.isNamespaceImport(bindings)) {
|
|
403
|
+
names.push(...namespaceMemberNames(bindings.name.text));
|
|
389
404
|
}
|
|
390
405
|
addImport(statement.moduleSpecifier, names, statement);
|
|
391
406
|
continue;
|