@forge/lint 5.2.4-next.0 → 5.3.0-next.1
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 +6 -0
- package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts +2 -0
- package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts.map +1 -1
- package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.js +18 -10
- package/out/lint/text/messages.d.ts +4 -0
- package/out/lint/text/messages.d.ts.map +1 -1
- package/out/lint/text/messages.js +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,8 @@ export declare class InvokeRemoteVerifier extends BaseLintIssueVerifier implemen
|
|
|
5
5
|
protected getLintClass(): LintClass;
|
|
6
6
|
process(input: InvokeRemoteVerifierInput): Promise<LintResultRule[]>;
|
|
7
7
|
private isValidCall;
|
|
8
|
+
private getRemoteForCall;
|
|
8
9
|
private isRemoteKeyValid;
|
|
10
|
+
private hasComputeOperation;
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=invoke-remote-verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-remote-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/remote-linter/verifiers/invoke-remote-verifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invoke-remote-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/remote-linter/verifiers/invoke-remote-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAIL,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,oBACX,SAAQ,qBACR,YAAW,iBAAiB,CAAC,yBAAyB,CAAC;IAEvD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuBjF,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -11,15 +11,19 @@ class InvokeRemoteVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
|
11
11
|
return linter_interface_1.LintClass.Error;
|
|
12
12
|
}
|
|
13
13
|
async process(input) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const validCalls = input.invokeRemoteCalls.filter((call) => this.isValidCall(call, input.imports));
|
|
15
|
+
const missingRemotes = validCalls
|
|
16
16
|
.filter((call) => !this.isRemoteKeyValid(call))
|
|
17
|
-
.map((call) => ({
|
|
17
|
+
.map((call) => ({ call, message: text_1.messages.verifiers.invokeRemoteKey }));
|
|
18
|
+
const missingComputeOperation = validCalls
|
|
19
|
+
.filter((call) => this.isRemoteKeyValid(call) && !this.hasComputeOperation(call))
|
|
20
|
+
.map((call) => ({ call, message: text_1.messages.verifiers.invokeRemoteCompute }));
|
|
21
|
+
return [...missingRemotes, ...missingComputeOperation].map(({ call, message }) => ({
|
|
18
22
|
class: this.getLintClass(),
|
|
19
23
|
column: call.column,
|
|
20
24
|
line: call.line,
|
|
21
|
-
message:
|
|
22
|
-
reference:
|
|
25
|
+
message: message.message(call.remoteKey),
|
|
26
|
+
reference: message.reference
|
|
23
27
|
}));
|
|
24
28
|
}
|
|
25
29
|
isValidCall(call, imports) {
|
|
@@ -29,12 +33,16 @@ class InvokeRemoteVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
|
29
33
|
return imports.some((imp) => (imp.type === typescript_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier || imp.type === typescript_estree_1.AST_NODE_TYPES.ImportNamespaceSpecifier) &&
|
|
30
34
|
call.objectName === imp.alias);
|
|
31
35
|
}
|
|
36
|
+
getRemoteForCall(call) {
|
|
37
|
+
return this.manifest.remotes?.find((remote) => remote.key === call.remoteKey);
|
|
38
|
+
}
|
|
32
39
|
isRemoteKeyValid(call) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
const remote = this.getRemoteForCall(call);
|
|
41
|
+
return typeof remote !== 'undefined';
|
|
42
|
+
}
|
|
43
|
+
hasComputeOperation(call) {
|
|
44
|
+
const remote = this.getRemoteForCall(call);
|
|
45
|
+
return remote?.operations?.includes('compute') ?? false;
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
exports.InvokeRemoteVerifier = InvokeRemoteVerifier;
|
|
@@ -21,6 +21,10 @@ export declare const messages: {
|
|
|
21
21
|
message: (remoteKey: string) => string;
|
|
22
22
|
reference: string;
|
|
23
23
|
};
|
|
24
|
+
invokeRemoteCompute: {
|
|
25
|
+
message: (remoteKey: string) => string;
|
|
26
|
+
reference: string;
|
|
27
|
+
};
|
|
24
28
|
handler: {
|
|
25
29
|
message: (method: string, key: string) => string;
|
|
26
30
|
reference: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/lint/text/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;+BAGI,MAAM,UAAU,MAAM,SAAS,MAAM,KAAG,MAAM;;;;2BAKlD,MAAM;;;;2BAKN,MAAM;2BAER,MAAM;;;;2BAKJ,MAAM;;;;iCAKA,MAAM;;;;8BAKT,MAAM,OAAO,MAAM;;;;+BAKlB,MAAM,UAAU,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,MAAM;;;;6BAKjE,MAAM;;;;+BAIJ,MAAM,QAAQ,MAAM,SAAS,MAAM;;;;CAK3D,CAAC"}
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/lint/text/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;+BAGI,MAAM,UAAU,MAAM,SAAS,MAAM,KAAG,MAAM;;;;2BAKlD,MAAM;;;;2BAKN,MAAM;2BAER,MAAM;;;;2BAKJ,MAAM;;;;iCAKA,MAAM;;;;iCAKN,MAAM;;;;8BAKT,MAAM,OAAO,MAAM;;;;+BAKlB,MAAM,UAAU,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,MAAM;;;;6BAKjE,MAAM;;;;+BAIJ,MAAM,QAAQ,MAAM,SAAS,MAAM;;;;CAK3D,CAAC"}
|
|
@@ -24,6 +24,10 @@ exports.messages = {
|
|
|
24
24
|
message: (remoteKey) => `The remote key "${remoteKey}" does not exist in the "remotes" section of your app's manifest.yml file`,
|
|
25
25
|
reference: 'missing-remote-key'
|
|
26
26
|
},
|
|
27
|
+
invokeRemoteCompute: {
|
|
28
|
+
message: (remoteKey) => `The remote key "${remoteKey}" does not have a compute operation defined in the "remotes" section of your app's manifest.yml file`,
|
|
29
|
+
reference: 'missing-remote-compute'
|
|
30
|
+
},
|
|
27
31
|
handler: {
|
|
28
32
|
message: (method, key) => `Cannot find exported function "${method}", which is required by module "${key}" handler defined in your app's manifest.yml file`,
|
|
29
33
|
reference: 'valid-module-required'
|