@forge/lint 2.0.1-next.5 → 3.0.0-next.10

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 CHANGED
@@ -1,5 +1,46 @@
1
1
  # @forge/lint
2
2
 
3
+ ## 3.0.0-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - f5d4a636: Fix unhandled error when invalid method used for Product REST API endpoint.
8
+ - Updated dependencies [67d2e17c]
9
+ - @forge/manifest@3.1.0-next.8
10
+ - @forge/cli-shared@2.2.1-next.8
11
+
12
+ ## 3.0.0-next.9
13
+
14
+ ### Minor Changes
15
+
16
+ - 037c31a: Upgrade webpack from 4 to 5 and other relavent packages to fix the issue for node17+ (openssl change)
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [037c31a]
21
+ - @forge/manifest@3.1.0-next.7
22
+ - @forge/cli-shared@2.2.1-next.7
23
+
24
+ ## 3.0.0-next.8
25
+
26
+ ### Minor Changes
27
+
28
+ - 83ca609e: Adding environment variables to override production swagger with local files.
29
+
30
+ ## 3.0.0-next.7
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [7b2d17a]
35
+ - @forge/manifest@3.1.0-next.6
36
+ - @forge/cli-shared@2.2.1-next.6
37
+
38
+ ## 3.0.0-next.6
39
+
40
+ ### Major Changes
41
+
42
+ - 4922d09: Only errors set the process exitCode to 1, warnings do not anymore.
43
+
3
44
  ## 2.0.1-next.5
4
45
 
5
46
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/lint/lint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU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C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,WAAY,UAAU,eAAe,UAAU,EAAE,4BAAuB,IA+CrG,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,UAAU,EAAE,KAAG,YAQxD,CAAC;AAEF,eAAO,MAAM,eAAe,aAChB,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAOnB,CAAC;AAEF,eAAO,MAAM,IAAI,gBACF,MAAM,EAAE,YACX,QAAQ,eACL,MAAM,UACX,UAAU,6BAhBR,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAAC,YAeV,eAAe,EAAE,KAOzB,OAAO,CAAC,UAAU,EAAE,CAmCtB,CAAC;AAEF,eAAO,MAAM,QAAQ,WACX,UAAU,WACV,eAAe,KACtB,OAAO,CAAC,UAAU,EAAE,CAGtB,CAAC"}
package/out/lint/lint.js CHANGED
@@ -55,7 +55,9 @@ exports.reportLintResults = (logger, lintResults, showSummary = true) => {
55
55
  logger.info(cli_shared_1.Text.lint.noFixableProblems);
56
56
  }
57
57
  }
58
- process.exitCode = 1;
58
+ if (numErrors) {
59
+ process.exitCode = 1;
60
+ }
59
61
  }
60
62
  };
61
63
  exports.problemCount = (lintResults) => {
@@ -32,6 +32,7 @@ export declare class PermissionLinter extends BaseLinter<ApiCall, PermissionLint
32
32
  protected getFixer(): ((errors: LintResultRule[], warnings: LintResultRule[], state: LintFixState) => Promise<LintFixState>) | undefined;
33
33
  protected addLintCriteriaMatch(apiCall: ApiCall, filepath: string): void;
34
34
  getProductPaths(cacheKey: string, url: string): Promise<SwaggerFormat>;
35
+ getProductPathsFile(url: string): Promise<SwaggerFormat>;
35
36
  private processPaths;
36
37
  }
37
38
  export {};
@@ -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,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,WAAW,EAGZ,MAAM,aAAa,CAAC;AASrB,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,mBACT,mBAAmB,GAAG,gCAAgC,GAAG,+BAA+B,uCAExG,GAAG,CAAC,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,OAAO,CAAC,YAAY,CAsEtB,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;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAA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c,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;IAsB3D,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"}
@@ -8,6 +8,7 @@ const base_linter_1 = tslib_1.__importDefault(require("../../base-linter"));
8
8
  const api_call_interface_1 = require("./api-call-interface");
9
9
  const verifiers_1 = require("./verifiers");
10
10
  const visitors_1 = require("./visitors");
11
+ const fs_1 = tslib_1.__importDefault(require("fs"));
11
12
  exports.NON_FWD_SLASH_REGEX = '[^\\/\\s]*';
12
13
  const CACHE_KEY = 'PERMISSIONS_LINTER';
13
14
  const ONE_HOUR_MS = 1000 * 60 * 60;
@@ -81,10 +82,20 @@ class PermissionLinter extends base_linter_1.default {
81
82
  }
82
83
  async bootstrap() {
83
84
  this.cache = cli_shared_1.CachedConf.getCache(CACHE_KEY);
84
- const [jira, confluence] = await Promise.all([
85
- this.getProductPaths(PermissionLinter.JIRA_CACHE_KEY, 'https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json'),
86
- this.getProductPaths(PermissionLinter.CONFLUENCE_CACHE_KEY, 'https://developer.atlassian.com/cloud/confluence/swagger.v3.json')
87
- ]);
85
+ const LOCAL_CONF_SWAGGER = process.env.LOCAL_CONF_SWAGGER;
86
+ const LOCAL_JIRA_SWAGGER = process.env.LOCAL_JIRA_SWAGGER;
87
+ const USE_LOCAL_SWAGGER = process.env.USE_LOCAL_SWAGGER;
88
+ let swaggerFiles;
89
+ if (USE_LOCAL_SWAGGER && LOCAL_CONF_SWAGGER && LOCAL_JIRA_SWAGGER) {
90
+ swaggerFiles = [this.getProductPathsFile(LOCAL_JIRA_SWAGGER), this.getProductPathsFile(LOCAL_CONF_SWAGGER)];
91
+ }
92
+ else {
93
+ swaggerFiles = [
94
+ this.getProductPaths(PermissionLinter.JIRA_CACHE_KEY, 'https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json'),
95
+ this.getProductPaths(PermissionLinter.CONFLUENCE_CACHE_KEY, 'https://developer.atlassian.com/cloud/confluence/swagger.v3.json')
96
+ ];
97
+ }
98
+ const [jira, confluence] = await Promise.all(swaggerFiles);
88
99
  this.jira = this.processPaths(jira.paths);
89
100
  this.confluence = this.processPaths(confluence.paths);
90
101
  this.nodeVisitors = [
@@ -150,6 +161,10 @@ class PermissionLinter extends base_linter_1.default {
150
161
  }
151
162
  return cached;
152
163
  }
164
+ async getProductPathsFile(url) {
165
+ const response = fs_1.default.readFileSync(url);
166
+ return JSON.parse(response.toString());
167
+ }
153
168
  processPaths(paths) {
154
169
  const pathMap = new Map();
155
170
  Object.keys(paths).forEach((path) => {
@@ -73,23 +73,23 @@ class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
73
73
  return missingCurrentScopes;
74
74
  }
75
75
  getRequiredScopes({ regex, method }) {
76
- var _a, _b, _c;
76
+ var _a, _b, _c, _d;
77
77
  if (!regex)
78
78
  return [];
79
- const oAuth2Scopes = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]['x-atlassian-oauth2-scopes'];
79
+ const oAuth2Scopes = (_b = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]) === null || _b === void 0 ? void 0 : _b['x-atlassian-oauth2-scopes'];
80
80
  if (oAuth2Scopes) {
81
81
  return array_prototype_flatmap_1.default(oAuth2Scopes.filter((scope) => scope.state === 'Current').map((scope) => scope.scopes), (x) => x);
82
82
  }
83
- const swaggerEntries = (_c = (_b = this.pathMap.get(regex)) === null || _b === void 0 ? void 0 : _b.methods[method]) === null || _c === void 0 ? void 0 : _c.security;
83
+ const swaggerEntries = (_d = (_c = this.pathMap.get(regex)) === null || _c === void 0 ? void 0 : _c.methods[method]) === null || _d === void 0 ? void 0 : _d.security;
84
84
  if (!swaggerEntries)
85
85
  return [];
86
86
  return swaggerEntries === null || swaggerEntries === void 0 ? void 0 : swaggerEntries.reduce((prev, curr) => [...prev, ...(curr['OAuth2'] || []), ...(curr['oAuthDefinitions'] || [])], []);
87
87
  }
88
88
  getRequiredDeprecatedScopes({ regex, method }) {
89
- var _a;
89
+ var _a, _b;
90
90
  if (!regex)
91
91
  return [];
92
- const oAuth2Scopes = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]['x-atlassian-oauth2-scopes'];
92
+ const oAuth2Scopes = (_b = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]) === null || _b === void 0 ? void 0 : _b['x-atlassian-oauth2-scopes'];
93
93
  if (!oAuth2Scopes)
94
94
  return [];
95
95
  return array_prototype_flatmap_1.default(oAuth2Scopes.filter((scope) => scope.state === 'Deprecated').map((scope) => scope.scopes), (x) => x);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/lint",
3
- "version": "2.0.1-next.5",
3
+ "version": "3.0.0-next.10",
4
4
  "description": "Linting for forge apps",
5
5
  "main": "out/index.js",
6
6
  "license": "UNLICENSED",
@@ -11,16 +11,16 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/cross-spawn": "^6.0.1",
14
- "@types/eslint": "^6.8.0",
14
+ "@types/eslint": "8.2.2",
15
15
  "@types/node-fetch": "^2.5.7"
16
16
  },
17
17
  "dependencies": {
18
- "@forge/cli-shared": "2.2.1-next.5",
18
+ "@forge/cli-shared": "2.2.1-next.8",
19
19
  "@forge/csp": "1.9.0",
20
- "@forge/manifest": "3.1.0-next.5",
20
+ "@forge/manifest": "3.1.0-next.8",
21
21
  "@typescript-eslint/typescript-estree": "^3.5.0",
22
22
  "cross-spawn": "^7.0.1",
23
- "node-fetch": "^2.6.1",
23
+ "node-fetch": "2.6.1",
24
24
  "atlassian-openapi": "^1.0.13"
25
25
  }
26
26
  }