@forge/lint 6.0.3-next.10 → 6.0.3-next.11
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/frame-component-linter/verifiers/frame-component-verifier.d.ts +2 -2
- package/out/lint/linters/frame-component-linter/verifiers/frame-component-verifier.d.ts.map +1 -1
- package/out/lint/linters/frame-component-linter/verifiers/frame-component-verifier.js +13 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,11 @@ import { LintClass, LintResultRule } from '../../../linter-interface';
|
|
|
3
3
|
import { BaseLintIssueVerifier, LintIssueVerifier } from '../../verifier-interface';
|
|
4
4
|
import { type FrameResourceInfo } from '../frame-component-interface';
|
|
5
5
|
export declare class FrameComponentVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<FrameResourceInfo[]> {
|
|
6
|
-
private
|
|
6
|
+
private entryKeysByResourceKey;
|
|
7
7
|
constructor(environment: string, manifest: Manifest);
|
|
8
8
|
protected getLintClass(): LintClass;
|
|
9
9
|
process(frameResources: FrameResourceInfo[]): Promise<LintResultRule[]>;
|
|
10
10
|
private isValidFrameResourceKey;
|
|
11
|
-
private
|
|
11
|
+
private getEntryKeysByResourceKeyFromManifest;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=frame-component-verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-component-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/frame-component-linter/verifiers/frame-component-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,qBAAa,sBAAuB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"frame-component-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/frame-component-linter/verifiers/frame-component-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,qBAAa,sBAAuB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;IAIjH,OAAO,CAAC,sBAAsB,CAA2B;gBAE7C,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAKnD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,cAAc,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAepF,OAAO,CAAC,uBAAuB;IAmB/B,OAAO,CAAC,qCAAqC;CAQ9C"}
|
|
@@ -5,10 +5,10 @@ const linter_interface_1 = require("../../../linter-interface");
|
|
|
5
5
|
const verifier_interface_1 = require("../../verifier-interface");
|
|
6
6
|
const text_1 = require("../../../text");
|
|
7
7
|
class FrameComponentVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
8
|
-
|
|
8
|
+
entryKeysByResourceKey;
|
|
9
9
|
constructor(environment, manifest) {
|
|
10
10
|
super(environment, manifest);
|
|
11
|
-
this.
|
|
11
|
+
this.entryKeysByResourceKey = this.getEntryKeysByResourceKeyFromManifest();
|
|
12
12
|
}
|
|
13
13
|
getLintClass() {
|
|
14
14
|
return linter_interface_1.LintClass.Error;
|
|
@@ -31,11 +31,19 @@ class FrameComponentVerifier extends verifier_interface_1.BaseLintIssueVerifier
|
|
|
31
31
|
if (!resourceKey) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
const separatorIndex = resourceKey.indexOf('/');
|
|
35
|
+
if (separatorIndex === -1) {
|
|
36
|
+
const entryKeys = this.entryKeysByResourceKey.get(resourceKey);
|
|
37
|
+
return !!entryKeys && entryKeys.size === 0;
|
|
38
|
+
}
|
|
39
|
+
const key = resourceKey.slice(0, separatorIndex);
|
|
40
|
+
const entry = resourceKey.slice(separatorIndex + 1);
|
|
41
|
+
const entryKeys = this.entryKeysByResourceKey.get(key);
|
|
42
|
+
return entry.length > 0 && entryKeys !== undefined && entryKeys.has(entry);
|
|
35
43
|
}
|
|
36
|
-
|
|
44
|
+
getEntryKeysByResourceKeyFromManifest() {
|
|
37
45
|
const resources = this.manifest?.resources ?? [];
|
|
38
|
-
return new
|
|
46
|
+
return new Map(resources.map(({ key, entry }) => [key, new Set(entry ? Object.keys(entry) : [])]));
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
exports.FrameComponentVerifier = FrameComponentVerifier;
|