npm package diff
Package: @forge/lint
Versions: 5.12.0-next.22 - 5.12.0-next.23
File: package/out/lint/linters/llm-module-linter/llm-node-visitor.js
Index: package/out/lint/linters/llm-module-linter/llm-node-visitor.js
===================================================================
--- package/out/lint/linters/llm-module-linter/llm-node-visitor.js
+++ package/out/lint/linters/llm-module-linter/llm-node-visitor.js
@@ -4,22 +4,19 @@
const llm_linter_interface_1 = require("./llm-linter-interface");
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
class LlmNodeVisitor {
visit(node, _parent, onMatchCallback) {
- if (this.isNodeSDKPackageImport(node) && 'specifiers' in node) {
- node.specifiers.forEach((specifier) => {
- if (this.isImportSpecifier(specifier)) {
- if (specifier.loc) {
- onMatchCallback({
- type: 'llm',
- ...specifier.loc.start
- });
- }
- }
- });
+ if (this.isLLMSDKPackageImport(node) && 'specifiers' in node) {
+ const specifier = node.specifiers.find((spec) => this.isImportSpecifier(spec));
+ if (specifier?.loc) {
+ onMatchCallback({
+ type: 'llm',
+ ...specifier.loc.start
+ });
+ }
}
}
- isNodeSDKPackageImport(node) {
+ isLLMSDKPackageImport(node) {
return node.type === typescript_estree_1.AST_NODE_TYPES.ImportDeclaration && node.source.value === llm_linter_interface_1.LLM_SDK_PACKAGE;
}
isImportSpecifier(specifier) {
return ((specifier.type === typescript_estree_1.AST_NODE_TYPES.ImportSpecifier || specifier.type === typescript_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier) &&