npm package diff

Package: @forge/lint

Versions: 5.10.0-next.15 - 5.10.0-next.16

Modified: package/out/lint/linters/permission-linter/visitors/image-url-visitor.js

Index: package/out/lint/linters/permission-linter/visitors/image-url-visitor.js
===================================================================
--- package/out/lint/linters/permission-linter/visitors/image-url-visitor.js
+++ package/out/lint/linters/permission-linter/visitors/image-url-visitor.js
@@ -10,23 +10,26 @@
         if (!imageUrlNode) {
             return undefined;
         }
         if (imageUrlNode?.type === typescript_estree_1.AST_NODE_TYPES.JSXAttribute) {
-            const imageUrlAttribute = imageUrlNode.value;
-            if (imageUrlAttribute &&
-                imageUrlAttribute.type === typescript_estree_1.AST_NODE_TYPES.Literal &&
-                typeof imageUrlAttribute.value === 'string') {
-                if (imageUrlAttribute.value.trim() !== '' &&
-                    !this.isBundledUri(imageUrlAttribute.value) &&
-                    this.isAbsoluteUrl(imageUrlAttribute.value)) {
-                    const imageUrl = {
-                        type: api_call_interface_1.ApiCallTypes.IMAGE,
-                        url: imageUrlAttribute.value,
-                        line: imageUrlAttribute.loc.start.line,
-                        column: imageUrlAttribute.loc.start.column
-                    };
-                    callback(imageUrl);
+            const imageUrlNodeAttribute = imageUrlNode.value;
+            if (!imageUrlNodeAttribute)
+                return;
+            this.addUrlToLintingList(imageUrlNodeAttribute, imageUrlNodeAttribute, callback);
+            if (imageUrlNodeAttribute.type === typescript_estree_1.AST_NODE_TYPES.JSXExpressionContainer) {
+                const imageUlrNodeAttributeExpression = imageUrlNodeAttribute.expression;
+                if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.ConditionalExpression) {
+                    const consequentExpression = imageUlrNodeAttributeExpression.consequent;
+                    this.addUrlToLintingList(consequentExpression, imageUrlNodeAttribute, callback);
+                    const alternateExpression = imageUlrNodeAttributeExpression.alternate;
+                    this.addUrlToLintingList(alternateExpression, imageUrlNodeAttribute, callback);
                 }
+                if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.LogicalExpression) {
+                    const leftExpression = imageUlrNodeAttributeExpression.left;
+                    this.addUrlToLintingList(leftExpression, imageUrlNodeAttribute, callback);
+                    const rightExpression = imageUlrNodeAttributeExpression.right;
+                    this.addUrlToLintingList(rightExpression, imageUrlNodeAttribute, callback);
+                }
             }
         }
     }
     getImageUrlNode(node) {
@@ -52,6 +55,20 @@
     }
     isAbsoluteUrl(url) {
         return ImageUrlVisitor.ABSOLUTE_URL_REGEX.test(url);
     }
+    addUrlToLintingList(expression, imageUrlAttribute, callback) {
+        if (expression && expression.type === typescript_estree_1.AST_NODE_TYPES.Literal && typeof expression.value === 'string') {
+            const url = expression.value;
+            if (url.trim() !== '' && !this.isBundledUri(url) && this.isAbsoluteUrl(url)) {
+                const imageUrl = {
+                    type: api_call_interface_1.ApiCallTypes.IMAGE,
+                    url: url,
+                    line: imageUrlAttribute.loc.start.line,
+                    column: imageUrlAttribute.loc.start.column
+                };
+                callback(imageUrl);
+            }
+        }
+    }
 }
 exports.ImageUrlVisitor = ImageUrlVisitor;

Modified: package/package.json

Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "@forge/lint",
-  "version": "5.10.0-next.15",
+  "version": "5.10.0-next.16",
   "description": "Linting for forge apps",
   "main": "out/index.js",
   "license": "SEE LICENSE IN LICENSE.txt",
   "scripts": {
@@ -18,12 +18,12 @@
     "@types/node-fetch": "^2.6.12",
     "eslint-plugin-import": "^2.29.1"
   },
   "dependencies": {
-    "@forge/cli-shared": "8.2.0-next.15",
+    "@forge/cli-shared": "8.2.0-next.16",
     "@forge/csp": "4.2.0-next.0",
     "@forge/egress": "2.0.1",
-    "@forge/manifest": "10.2.0-next.4",
+    "@forge/manifest": "10.2.0-next.5",
     "@typescript-eslint/typescript-estree": "^5.62.0",
     "array.prototype.flatmap": "^1.3.3",
     "@atlassian/atlassian-openapi": "^1.0.6",
     "cross-spawn": "^7.0.6",

Modified: package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map

Index: package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map
===================================================================
--- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map
+++ package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"image-url-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/image-url-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAC;AAExE,qBAAa,eAAgB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,MAAM,CAAC,kBAAkB,SAAyB;IAE3C,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAgCjH,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;CAGtB"}
\ No newline at end of file
+{"version":3,"file":"image-url-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/image-url-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAC;AAExE,qBAAa,eAAgB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,MAAM,CAAC,kBAAkB,SAAyB;IAE3C,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAmCjH,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAkB5B"}
\ No newline at end of file

Modified: package/CHANGELOG.md

Large diffs are not rendered by default.

Modified: package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts

Index: package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts
===================================================================
--- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts
+++ package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts
@@ -6,6 +6,7 @@
     visit(node: TSESTree.Node, _parent: TSESTree.Node | undefined, callback: (apiCall: ApiCall) => void): void;
     private getImageUrlNode;
     private isBundledUri;
     private isAbsoluteUrl;
+    private addUrlToLintingList;
 }
 //# sourceMappingURL=image-url-visitor.d.ts.map
\ No newline at end of file