@forge/lint 6.0.3-next.12 → 6.0.3-next.13
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,14 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 6.0.3-next.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4b90a07: Lint target directory when using the manual packaging
|
|
8
|
+
- Updated dependencies [4b90a07]
|
|
9
|
+
- @forge/manifest@13.3.0-next.8
|
|
10
|
+
- @forge/cli-shared@9.3.0-next.12
|
|
11
|
+
|
|
3
12
|
## 6.0.3-next.12
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -10,7 +10,8 @@ export declare class HandlerLinter extends BaseLinter<ExportedMethod, HandlerLin
|
|
|
10
10
|
private manifest;
|
|
11
11
|
constructor(environment: string, manifest: Manifest, logger: LintLogger);
|
|
12
12
|
bootstrap(): Promise<void>;
|
|
13
|
-
private
|
|
13
|
+
private escapeRegExp;
|
|
14
|
+
private isHandlerFile;
|
|
14
15
|
private getFunctionHandlers;
|
|
15
16
|
protected setupMatchesMap(filepath: string): void;
|
|
16
17
|
protected filterLintInput(inputs: LintInput[]): LintInput[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/handler-linter/handler-linter.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"handler-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/handler-linter/handler-linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAW,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,0BAA0B;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,gBAAgB,EAAE,aAAa,CAAC;CACjC;AAED,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,0BAA0B,EAAE,aAAa,CAAC;IAGpG,OAAO,CAAC,QAAQ;gBADhB,WAAW,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,UAAU;IAKP,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IASvC,OAAO,CAAC,YAAY,CAA2E;IAE/F,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,mBAAmB;IAc3B,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAYjD,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAK3D,SAAS,CAAC,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAKvF"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HandlerLinter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
+
const manifest_1 = require("@forge/manifest");
|
|
6
7
|
const base_linter_1 = tslib_1.__importDefault(require("../../base-linter"));
|
|
7
8
|
const handlers_verifier_1 = require("./verifiers/handlers-verifier");
|
|
8
9
|
const visitors_1 = require("./visitors");
|
|
@@ -19,7 +20,12 @@ class HandlerLinter extends base_linter_1.default {
|
|
|
19
20
|
functionHandlers: new handlers_verifier_1.HandlersVerifier(humanReadableEnvironment, this.manifest)
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
24
|
+
isHandlerFile(handler, filepath) {
|
|
25
|
+
const handlersDirectory = (0, manifest_1.getHandlersDirectory)(this.manifest);
|
|
26
|
+
const handlerFileRegex = new RegExp(`^${this.escapeRegExp(handlersDirectory)}(\/|\\\\)${this.escapeRegExp(handler.file)}\.[tj](s|sx)$`);
|
|
27
|
+
return handlerFileRegex.test(filepath);
|
|
28
|
+
}
|
|
23
29
|
getFunctionHandlers(manifest) {
|
|
24
30
|
return manifest.modules?.function
|
|
25
31
|
?.filter((funcs) => funcs.handler && funcs.handler.split('.').length === 2)
|
|
@@ -35,7 +41,7 @@ class HandlerLinter extends base_linter_1.default {
|
|
|
35
41
|
}
|
|
36
42
|
setupMatchesMap(filepath) {
|
|
37
43
|
const handlers = this.getFunctionHandlers(this.manifest);
|
|
38
|
-
const filteredHandlers = handlers?.filter((handler) => this.
|
|
44
|
+
const filteredHandlers = handlers?.filter((handler) => this.isHandlerFile(handler, filepath));
|
|
39
45
|
this.matches.set(filepath, {
|
|
40
46
|
functionHandlers: {
|
|
41
47
|
expectedMethods: filteredHandlers || [],
|
|
@@ -45,7 +51,7 @@ class HandlerLinter extends base_linter_1.default {
|
|
|
45
51
|
}
|
|
46
52
|
filterLintInput(inputs) {
|
|
47
53
|
const handlers = this.getFunctionHandlers(this.manifest);
|
|
48
|
-
return inputs.filter((input) => handlers?.find((handler) => this.
|
|
54
|
+
return inputs.filter((input) => handlers?.find((handler) => this.isHandlerFile(handler, input.filepath)));
|
|
49
55
|
}
|
|
50
56
|
addLintCriteriaMatch(exportedMethod, filepath) {
|
|
51
57
|
const criteriaMatches = this.matches.get(filepath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "6.0.3-next.
|
|
3
|
+
"version": "6.0.3-next.13",
|
|
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": "9.3.0-next.
|
|
22
|
+
"@forge/cli-shared": "9.3.0-next.12",
|
|
23
23
|
"@forge/csp": "6.2.0",
|
|
24
24
|
"@forge/egress": "3.0.0",
|
|
25
|
-
"@forge/manifest": "13.3.0-next.
|
|
25
|
+
"@forge/manifest": "13.3.0-next.8",
|
|
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",
|