@forge/lint 3.6.8-next.8 → 3.7.0-next.19
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 +86 -0
- package/out/lint/linters/permission-linter/api-call-interface.d.ts +2 -1
- package/out/lint/linters/permission-linter/api-call-interface.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/permission-linter.d.ts +2 -0
- package/out/lint/linters/permission-linter/permission-linter.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/permission-linter.js +17 -5
- package/out/lint/linters/permission-linter/visitors/product-node-visitor.d.ts +1 -0
- package/out/lint/linters/permission-linter/visitors/product-node-visitor.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/visitors/product-node-visitor.js +17 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 3.7.0-next.19
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f39f9012: Validate requestBitbucket requests against Bitbucket swagger
|
|
8
|
+
|
|
9
|
+
## 3.6.8-next.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [de5d2023]
|
|
14
|
+
- @forge/cli-shared@3.20.0-next.17
|
|
15
|
+
- @forge/manifest@4.20.2-next.5
|
|
16
|
+
|
|
17
|
+
## 3.6.8-next.17
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [f11f7384]
|
|
22
|
+
- @forge/cli-shared@3.20.0-next.16
|
|
23
|
+
|
|
24
|
+
## 3.6.8-next.16
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [28fcd26b]
|
|
29
|
+
- @forge/cli-shared@3.20.0-next.15
|
|
30
|
+
|
|
31
|
+
## 3.6.8-next.15
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [77496359]
|
|
36
|
+
- @forge/cli-shared@3.20.0-next.14
|
|
37
|
+
|
|
38
|
+
## 3.6.8-next.14
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [370a5262]
|
|
43
|
+
- @forge/cli-shared@3.19.1-next.13
|
|
44
|
+
|
|
45
|
+
## 3.6.8-next.13
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [43121bc3]
|
|
50
|
+
- Updated dependencies [ed9ecfda]
|
|
51
|
+
- @forge/egress@1.2.6-next.2
|
|
52
|
+
- @forge/manifest@4.20.2-next.4
|
|
53
|
+
- @forge/cli-shared@3.19.1-next.12
|
|
54
|
+
|
|
55
|
+
## 3.6.8-next.12
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [b70e132d]
|
|
60
|
+
- @forge/manifest@4.20.2-next.3
|
|
61
|
+
- @forge/cli-shared@3.19.1-next.11
|
|
62
|
+
|
|
63
|
+
## 3.6.8-next.11
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [ab7c204]
|
|
68
|
+
- @forge/cli-shared@3.19.1-next.10
|
|
69
|
+
- @forge/manifest@4.20.2-next.2
|
|
70
|
+
|
|
71
|
+
## 3.6.8-next.10
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- aec22e5: Bumping dependencies via Renovate:
|
|
76
|
+
|
|
77
|
+
- @atlassian/xen-test-util
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [aec22e5]
|
|
80
|
+
- @forge/cli-shared@3.19.1-next.9
|
|
81
|
+
|
|
82
|
+
## 3.6.8-next.9
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [fc1756d]
|
|
87
|
+
- @forge/cli-shared@3.19.1-next.8
|
|
88
|
+
|
|
3
89
|
## 3.6.8-next.8
|
|
4
90
|
|
|
5
91
|
### Patch Changes
|
|
@@ -7,9 +7,10 @@ export declare enum ApiCallTypes {
|
|
|
7
7
|
'CONTENT_PROPERTY' = 4,
|
|
8
8
|
'IMAGE' = 5
|
|
9
9
|
}
|
|
10
|
+
export type ProductName = 'jira' | 'confluence' | 'bitbucket';
|
|
10
11
|
export interface ProductApiCall extends LintCriteriaMatch {
|
|
11
12
|
type: ApiCallTypes.PRODUCT;
|
|
12
|
-
product:
|
|
13
|
+
product: ProductName;
|
|
13
14
|
path: string;
|
|
14
15
|
method: string;
|
|
15
16
|
regex?: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-call-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/api-call-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,YAAY;IACtB,SAAS,IAAA;IACT,MAAM,IAAA;IACN,SAAS,IAAA;IACT,UAAU,IAAA;IACV,kBAAkB,IAAA;IAClB,OAAO,IAAA;CACR;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;IAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"api-call-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/api-call-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,YAAY;IACtB,SAAS,IAAA;IACT,MAAM,IAAA;IACN,SAAS,IAAA;IACT,UAAU,IAAA;IACV,kBAAkB,IAAA;IAClB,OAAO,IAAA;CACR;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,QAAS,SAAQ,iBAAiB;IACjD,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,YAAY,CAAC,gBAAgB,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,OAAO,GACf,cAAc,GACd,aAAa,GACb,cAAc,GACd,eAAe,GACf,QAAQ,GACR,sBAAsB,CAAC"}
|
|
@@ -26,8 +26,10 @@ export declare class PermissionLinter extends BaseLinter<ApiCall, PermissionLint
|
|
|
26
26
|
static JSM_CACHE_KEY: string;
|
|
27
27
|
static JSW_CACHE_KEY: string;
|
|
28
28
|
static CONFLUENCE_CACHE_KEY: string;
|
|
29
|
+
static BITBUCKET_CACHE_KEY: string;
|
|
29
30
|
private jira?;
|
|
30
31
|
private confluence?;
|
|
32
|
+
private bitbucket?;
|
|
31
33
|
private cache?;
|
|
32
34
|
constructor(environment: string, manifest: Manifest, logger: LintLogger);
|
|
33
35
|
bootstrap(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,QAAQ,EACR,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAOL,WAAW,EAGZ,MAAM,aAAa,CAAC;AAWrB,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAKhD,eAAO,MAAM,sBAAsB,WACzB,cAAc,EAAE,YACd,cAAc,EAAE,mBAEtB,mBAAmB,GACnB,gCAAgC,GAChC,+BAA+B,GAC/B,iCAAiC,UAC7B,YAAY,KACnB,IAAI,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,QAAQ,YAAY,CAgEtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,QAAQ,EACR,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAOL,WAAW,EAGZ,MAAM,aAAa,CAAC;AAWrB,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAKhD,eAAO,MAAM,sBAAsB,WACzB,cAAc,EAAE,YACd,cAAc,EAAE,mBAEtB,mBAAmB,GACnB,gCAAgC,GAChC,+BAA+B,GAC/B,iCAAiC,UAC7B,YAAY,KACnB,IAAI,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,QAAQ,YAAY,CAgEtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,CAAC;IAc/F,OAAO,CAAC,QAAQ;IAblB,MAAM,CAAC,cAAc,SAAgC;IACrD,MAAM,CAAC,aAAa,SAA+B;IACnD,MAAM,CAAC,aAAa,SAA+B;IACnD,MAAM,CAAC,oBAAoB,SAAsC;IACjE,MAAM,CAAC,mBAAmB,SAAqC;IAE/D,OAAO,CAAC,IAAI,CAAC,CAA0B;IACvC,OAAO,CAAC,UAAU,CAAC,CAA0B;IAC7C,OAAO,CAAC,SAAS,CAAC,CAA0B;IAC5C,OAAO,CAAC,KAAK,CAAC,CAAa;gBAGzB,WAAW,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,UAAU;IAKP,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAkFvC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD,SAAS,CAAC,QAAQ,IACd,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GACtG,SAAS;IAIb,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAyB3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWtE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAKrE,OAAO,CAAC,YAAY;CAarB"}
|
|
@@ -83,14 +83,21 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
83
83
|
const LOCAL_JIRA_SWAGGER = process.env.LOCAL_JIRA_SWAGGER;
|
|
84
84
|
const LOCAL_JSM_SWAGGER = process.env.LOCAL_JSM_SWAGGER;
|
|
85
85
|
const LOCAL_JSW_SWAGGER = process.env.LOCAL_JSW_SWAGGER;
|
|
86
|
+
const LOCAL_BB_SWAGGER = process.env.LOCAL_BB_SWAGGER;
|
|
86
87
|
const USE_LOCAL_SWAGGER = process.env.USE_LOCAL_SWAGGER;
|
|
87
88
|
let swaggerFiles;
|
|
88
|
-
if (USE_LOCAL_SWAGGER &&
|
|
89
|
+
if (USE_LOCAL_SWAGGER &&
|
|
90
|
+
LOCAL_CONF_SWAGGER &&
|
|
91
|
+
LOCAL_JIRA_SWAGGER &&
|
|
92
|
+
LOCAL_JSM_SWAGGER &&
|
|
93
|
+
LOCAL_JSW_SWAGGER &&
|
|
94
|
+
LOCAL_BB_SWAGGER) {
|
|
89
95
|
swaggerFiles = [
|
|
90
96
|
this.getProductPathsFile(LOCAL_JIRA_SWAGGER),
|
|
91
97
|
this.getProductPathsFile(LOCAL_JSM_SWAGGER),
|
|
92
98
|
this.getProductPathsFile(LOCAL_JSW_SWAGGER),
|
|
93
|
-
this.getProductPathsFile(LOCAL_CONF_SWAGGER)
|
|
99
|
+
this.getProductPathsFile(LOCAL_CONF_SWAGGER),
|
|
100
|
+
this.getProductPathsFile(LOCAL_BB_SWAGGER)
|
|
94
101
|
];
|
|
95
102
|
}
|
|
96
103
|
else {
|
|
@@ -98,12 +105,14 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
98
105
|
this.getProductPaths(PermissionLinter.JIRA_CACHE_KEY, 'https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json'),
|
|
99
106
|
this.getProductPaths(PermissionLinter.JSM_CACHE_KEY, 'https://developer.atlassian.com/cloud/jira/service-desk/swagger.v3.json'),
|
|
100
107
|
this.getProductPaths(PermissionLinter.JSW_CACHE_KEY, 'https://developer.atlassian.com/cloud/jira/software/swagger.v3.json'),
|
|
101
|
-
this.getProductPaths(PermissionLinter.CONFLUENCE_CACHE_KEY, 'https://developer.atlassian.com/cloud/confluence/swagger.v3.json')
|
|
108
|
+
this.getProductPaths(PermissionLinter.CONFLUENCE_CACHE_KEY, 'https://developer.atlassian.com/cloud/confluence/swagger.v3.json'),
|
|
109
|
+
this.getProductPaths(PermissionLinter.BITBUCKET_CACHE_KEY, 'https://developer.atlassian.com/cloud/bitbucket/swagger.json')
|
|
102
110
|
];
|
|
103
111
|
}
|
|
104
|
-
const [jiraSwagger, jsmSwagger, jswSwagger, confluenceSwagger] = await Promise.all(swaggerFiles);
|
|
112
|
+
const [jiraSwagger, jsmSwagger, jswSwagger, confluenceSwagger, bitbucketSwagger] = await Promise.all(swaggerFiles);
|
|
105
113
|
this.jira = this.processPaths(Object.assign(Object.assign(Object.assign({}, jiraSwagger.paths), jsmSwagger.paths), jswSwagger.paths));
|
|
106
114
|
this.confluence = this.processPaths(confluenceSwagger.paths);
|
|
115
|
+
this.bitbucket = this.processPaths(bitbucketSwagger.paths);
|
|
107
116
|
this.nodeVisitors = [
|
|
108
117
|
new visitors_1.ProductNodeVisitor(),
|
|
109
118
|
new visitors_1.UIHookNodeVisitor(),
|
|
@@ -114,6 +123,7 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
114
123
|
];
|
|
115
124
|
const humanReadableEnvironment = (0, cli_shared_1.environmentToOption)(this.environment);
|
|
116
125
|
this.verifiers = {
|
|
126
|
+
bitbucket: new verifiers_1.ProductVerifier(humanReadableEnvironment, this.manifest, this.bitbucket, 'bitbucket'),
|
|
117
127
|
confluence: new verifiers_1.ProductVerifier(humanReadableEnvironment, this.manifest, this.confluence, 'confluence'),
|
|
118
128
|
jira: new verifiers_1.ProductVerifier(humanReadableEnvironment, this.manifest, this.jira, 'jira'),
|
|
119
129
|
storage: new verifiers_1.StorageAPIVerifier(humanReadableEnvironment, this.manifest),
|
|
@@ -124,9 +134,10 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
124
134
|
};
|
|
125
135
|
}
|
|
126
136
|
setupMatchesMap(filepath) {
|
|
127
|
-
if (!this.jira || !this.confluence)
|
|
137
|
+
if (!this.jira || !this.confluence || !this.bitbucket)
|
|
128
138
|
throw new Error('Bootstrap failed');
|
|
129
139
|
this.matches.set(filepath, {
|
|
140
|
+
bitbucket: [],
|
|
130
141
|
confluence: [],
|
|
131
142
|
jira: [],
|
|
132
143
|
uiHook: [],
|
|
@@ -191,3 +202,4 @@ PermissionLinter.JIRA_CACHE_KEY = 'permissions-jira-cache-key';
|
|
|
191
202
|
PermissionLinter.JSM_CACHE_KEY = 'permissions-jsm-cache-key';
|
|
192
203
|
PermissionLinter.JSW_CACHE_KEY = 'permissions-jsw-cache-key';
|
|
193
204
|
PermissionLinter.CONFLUENCE_CACHE_KEY = 'permissions-confluence-cache-key';
|
|
205
|
+
PermissionLinter.BITBUCKET_CACHE_KEY = 'permissions-bitbucket-cache-key';
|
|
@@ -4,6 +4,7 @@ import { ApiCall } from '../api-call-interface';
|
|
|
4
4
|
export declare const ANY_TEXT_REGEX = "\\S*";
|
|
5
5
|
export declare class ProductNodeVisitor implements NodeVisitor<ApiCall> {
|
|
6
6
|
visit(node: TSESTree.Node, parent: TSESTree.Node | undefined, callback: (apiCall: ApiCall) => void): void;
|
|
7
|
+
private getProductFromMethodName;
|
|
7
8
|
private checkProductApiCallArgs;
|
|
8
9
|
private transformArgstoApiCall;
|
|
9
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-node-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/product-node-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"product-node-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/product-node-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA6C,MAAM,uBAAuB,CAAC;AAG3F,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,qBAAa,kBAAmB,YAAW,WAAW,CAAC,OAAO,CAAC;IACtD,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAqChH,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,sBAAsB;CAsE/B"}
|
|
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProductNodeVisitor = exports.ANY_TEXT_REGEX = void 0;
|
|
4
4
|
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
5
5
|
const api_call_interface_1 = require("../api-call-interface");
|
|
6
|
+
const REQUEST_PRODUCT_REGEX = /request(Jira|Confluence|Bitbucket)/;
|
|
6
7
|
exports.ANY_TEXT_REGEX = '\\S*';
|
|
7
8
|
class ProductNodeVisitor {
|
|
8
9
|
visit(node, parent, callback) {
|
|
9
10
|
switch (node.type) {
|
|
10
11
|
case typescript_estree_1.AST_NODE_TYPES.CallExpression:
|
|
11
|
-
if (node.callee.type === typescript_estree_1.AST_NODE_TYPES.Identifier && node.callee.name.match(
|
|
12
|
+
if (node.callee.type === typescript_estree_1.AST_NODE_TYPES.Identifier && node.callee.name.match(REQUEST_PRODUCT_REGEX)) {
|
|
12
13
|
const apiCallProblem = this.checkProductApiCallArgs(node.callee.name, node.arguments);
|
|
13
14
|
apiCallProblem && callback(apiCallProblem);
|
|
14
15
|
}
|
|
15
16
|
break;
|
|
16
17
|
case typescript_estree_1.AST_NODE_TYPES.MemberExpression:
|
|
17
18
|
if (node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&
|
|
18
|
-
node.property.name.match(
|
|
19
|
+
node.property.name.match(REQUEST_PRODUCT_REGEX) &&
|
|
19
20
|
(parent === null || parent === void 0 ? void 0 : parent.type) === typescript_estree_1.AST_NODE_TYPES.CallExpression) {
|
|
20
21
|
const apiCallProblem = this.checkProductApiCallArgs(node.property.name, parent.arguments);
|
|
21
22
|
apiCallProblem && callback(apiCallProblem);
|
|
@@ -23,9 +24,22 @@ class ProductNodeVisitor {
|
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
getProductFromMethodName(methodName) {
|
|
28
|
+
switch (methodName) {
|
|
29
|
+
case 'requestBitbucket':
|
|
30
|
+
return 'bitbucket';
|
|
31
|
+
case 'requestConfluence':
|
|
32
|
+
return 'confluence';
|
|
33
|
+
case 'requestJira':
|
|
34
|
+
return 'jira';
|
|
35
|
+
default:
|
|
36
|
+
throw new Error('Unknown product');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
26
39
|
checkProductApiCallArgs(methodName, args) {
|
|
27
40
|
const [endpointNode, optionsNode] = args;
|
|
28
|
-
|
|
41
|
+
const product = this.getProductFromMethodName(methodName);
|
|
42
|
+
return this.transformArgstoApiCall(product, endpointNode, optionsNode);
|
|
29
43
|
}
|
|
30
44
|
transformArgstoApiCall(product, endpointNode, optionsNode) {
|
|
31
45
|
if ((optionsNode && optionsNode.type !== typescript_estree_1.AST_NODE_TYPES.ObjectExpression) ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-next.19",
|
|
4
4
|
"description": "Linting for forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
"clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@atlassian/xen-test-util": "^3.1.
|
|
13
|
+
"@atlassian/xen-test-util": "^3.1.1",
|
|
14
14
|
"@types/array.prototype.flatmap": "^1.2.3",
|
|
15
15
|
"@types/cross-spawn": "^6.0.3",
|
|
16
16
|
"@types/eslint": "8.44.3",
|
|
17
17
|
"@types/node-fetch": "^2.6.6"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@forge/cli-shared": "3.
|
|
21
|
-
"@forge/egress": "1.2.6-next.
|
|
22
|
-
"@forge/manifest": "4.20.2-next.
|
|
20
|
+
"@forge/cli-shared": "3.20.0-next.17",
|
|
21
|
+
"@forge/egress": "1.2.6-next.2",
|
|
22
|
+
"@forge/manifest": "4.20.2-next.5",
|
|
23
23
|
"@typescript-eslint/typescript-estree": "^5.62.0",
|
|
24
24
|
"array.prototype.flatmap": "^1.3.2",
|
|
25
25
|
"atlassian-openapi": "^1.0.17",
|