@forge/lint 5.10.0-next.14 → 5.10.0-next.16
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/CHANGELOG.md +20 -0
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts +1 -0
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.js +31 -14
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 5.10.0-next.16
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e002ecd: Added checking for image strings in conditionals
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5bfa872]
|
|
12
|
+
- @forge/manifest@10.2.0-next.5
|
|
13
|
+
- @forge/cli-shared@8.2.0-next.16
|
|
14
|
+
|
|
15
|
+
## 5.10.0-next.15
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [5144b15]
|
|
20
|
+
- @forge/manifest@10.2.0-next.4
|
|
21
|
+
- @forge/cli-shared@8.2.0-next.15
|
|
22
|
+
|
|
3
23
|
## 5.10.0-next.14
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -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;
|
|
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;IAmCjH,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAkB5B"}
|
|
@@ -11,20 +11,23 @@ class ImageUrlVisitor {
|
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
if (imageUrlNode?.type === typescript_estree_1.AST_NODE_TYPES.JSXAttribute) {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const imageUrlNodeAttribute = imageUrlNode.value;
|
|
15
|
+
if (!imageUrlNodeAttribute)
|
|
16
|
+
return;
|
|
17
|
+
this.addUrlToLintingList(imageUrlNodeAttribute, imageUrlNodeAttribute, callback);
|
|
18
|
+
if (imageUrlNodeAttribute.type === typescript_estree_1.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
19
|
+
const imageUlrNodeAttributeExpression = imageUrlNodeAttribute.expression;
|
|
20
|
+
if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.ConditionalExpression) {
|
|
21
|
+
const consequentExpression = imageUlrNodeAttributeExpression.consequent;
|
|
22
|
+
this.addUrlToLintingList(consequentExpression, imageUrlNodeAttribute, callback);
|
|
23
|
+
const alternateExpression = imageUlrNodeAttributeExpression.alternate;
|
|
24
|
+
this.addUrlToLintingList(alternateExpression, imageUrlNodeAttribute, callback);
|
|
25
|
+
}
|
|
26
|
+
if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.LogicalExpression) {
|
|
27
|
+
const leftExpression = imageUlrNodeAttributeExpression.left;
|
|
28
|
+
this.addUrlToLintingList(leftExpression, imageUrlNodeAttribute, callback);
|
|
29
|
+
const rightExpression = imageUlrNodeAttributeExpression.right;
|
|
30
|
+
this.addUrlToLintingList(rightExpression, imageUrlNodeAttribute, callback);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -53,5 +56,19 @@ class ImageUrlVisitor {
|
|
|
53
56
|
isAbsoluteUrl(url) {
|
|
54
57
|
return ImageUrlVisitor.ABSOLUTE_URL_REGEX.test(url);
|
|
55
58
|
}
|
|
59
|
+
addUrlToLintingList(expression, imageUrlAttribute, callback) {
|
|
60
|
+
if (expression && expression.type === typescript_estree_1.AST_NODE_TYPES.Literal && typeof expression.value === 'string') {
|
|
61
|
+
const url = expression.value;
|
|
62
|
+
if (url.trim() !== '' && !this.isBundledUri(url) && this.isAbsoluteUrl(url)) {
|
|
63
|
+
const imageUrl = {
|
|
64
|
+
type: api_call_interface_1.ApiCallTypes.IMAGE,
|
|
65
|
+
url: url,
|
|
66
|
+
line: imageUrlAttribute.loc.start.line,
|
|
67
|
+
column: imageUrlAttribute.loc.start.column
|
|
68
|
+
};
|
|
69
|
+
callback(imageUrl);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
56
73
|
}
|
|
57
74
|
exports.ImageUrlVisitor = ImageUrlVisitor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "5.10.0-next.
|
|
3
|
+
"version": "5.10.0-next.16",
|
|
4
4
|
"description": "Linting for forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"eslint-plugin-import": "^2.29.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@forge/cli-shared": "8.2.0-next.
|
|
22
|
+
"@forge/cli-shared": "8.2.0-next.16",
|
|
23
23
|
"@forge/csp": "4.2.0-next.0",
|
|
24
24
|
"@forge/egress": "2.0.1",
|
|
25
|
-
"@forge/manifest": "10.
|
|
25
|
+
"@forge/manifest": "10.2.0-next.5",
|
|
26
26
|
"@typescript-eslint/typescript-estree": "^5.62.0",
|
|
27
27
|
"array.prototype.flatmap": "^1.3.3",
|
|
28
28
|
"@atlassian/atlassian-openapi": "^1.0.6",
|