@platformos/platformos-check-node 0.0.12 → 0.0.16
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/configs/all.yml
CHANGED
|
@@ -42,10 +42,19 @@ MetadataParamsCheck:
|
|
|
42
42
|
MissingAsset:
|
|
43
43
|
enabled: true
|
|
44
44
|
severity: 0
|
|
45
|
+
MissingPage:
|
|
46
|
+
enabled: true
|
|
47
|
+
severity: 1
|
|
45
48
|
MissingPartial:
|
|
46
49
|
enabled: true
|
|
47
50
|
severity: 0
|
|
48
51
|
ignoreMissing: []
|
|
52
|
+
MissingRenderPartialArguments:
|
|
53
|
+
enabled: true
|
|
54
|
+
severity: 0
|
|
55
|
+
NestedGraphQLQuery:
|
|
56
|
+
enabled: true
|
|
57
|
+
severity: 1
|
|
49
58
|
OrphanedPartial:
|
|
50
59
|
enabled: true
|
|
51
60
|
severity: 1
|
package/configs/recommended.yml
CHANGED
|
@@ -42,10 +42,19 @@ MetadataParamsCheck:
|
|
|
42
42
|
MissingAsset:
|
|
43
43
|
enabled: true
|
|
44
44
|
severity: 0
|
|
45
|
+
MissingPage:
|
|
46
|
+
enabled: true
|
|
47
|
+
severity: 1
|
|
45
48
|
MissingPartial:
|
|
46
49
|
enabled: true
|
|
47
50
|
severity: 0
|
|
48
51
|
ignoreMissing: []
|
|
52
|
+
MissingRenderPartialArguments:
|
|
53
|
+
enabled: true
|
|
54
|
+
severity: 0
|
|
55
|
+
NestedGraphQLQuery:
|
|
56
|
+
enabled: true
|
|
57
|
+
severity: 1
|
|
49
58
|
OrphanedPartial:
|
|
50
59
|
enabled: true
|
|
51
60
|
severity: 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InferredParamType } from '@platformos/platformos-check-common';
|
|
2
2
|
/**
|
|
3
3
|
* Generate a single @param line for a doc tag.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { BasicParamTypes } from '@platformos/platformos-check-common';
|
|
|
7
7
|
* @param isOptional - Whether to mark as optional with brackets
|
|
8
8
|
* @returns A formatted @param line like "@param {string} [name]" or "@param {string} name"
|
|
9
9
|
*/
|
|
10
|
-
export declare function generateParamLine(name: string, type:
|
|
10
|
+
export declare function generateParamLine(name: string, type: InferredParamType, isOptional?: boolean): string;
|
|
11
11
|
/**
|
|
12
12
|
* Generate a complete doc tag with param lines.
|
|
13
13
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InferredParamType } from '@platformos/platformos-check-common';
|
|
2
2
|
export type TagType = 'function' | 'render' | 'include';
|
|
3
3
|
export interface ArgumentInfo {
|
|
4
4
|
name: string;
|
|
5
|
-
inferredType:
|
|
5
|
+
inferredType: InferredParamType;
|
|
6
6
|
usageCount: number;
|
|
7
7
|
}
|
|
8
8
|
export interface PartialUsage {
|
package/dist/cli.js
CHANGED
|
@@ -4,24 +4,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const index_1 = require("./index");
|
|
7
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
7
8
|
const backfill_docs_1 = require("./backfill-docs");
|
|
8
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const validCheckNames = new Set(platformos_check_common_1.allChecks.map((c) => c.meta.code));
|
|
11
|
+
function parseCheckArgs(args) {
|
|
12
|
+
const checks = [];
|
|
13
|
+
const positional = [];
|
|
14
|
+
for (let i = 0; i < args.length; i++) {
|
|
15
|
+
if (args[i] === '--check' || args[i] === '-c') {
|
|
16
|
+
i++;
|
|
17
|
+
if (i < args.length)
|
|
18
|
+
checks.push(args[i]);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
positional.push(args[i]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
root: node_path_1.default.resolve(positional[0] || '.'),
|
|
26
|
+
configPath: positional[1] ? node_path_1.default.resolve(positional[1]) : undefined,
|
|
27
|
+
checks: checks.length > 0 ? checks : undefined,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
9
30
|
async function runCheck(args) {
|
|
10
|
-
const root =
|
|
11
|
-
|
|
31
|
+
const { root, configPath, checks } = parseCheckArgs(args);
|
|
32
|
+
if (checks) {
|
|
33
|
+
const unknown = checks.filter((name) => !validCheckNames.has(name));
|
|
34
|
+
if (unknown.length > 0) {
|
|
35
|
+
const available = Array.from(validCheckNames).sort().join(', ');
|
|
36
|
+
console.error(`Unknown check${unknown.length > 1 ? 's' : ''}: ${unknown.join(', ')}`);
|
|
37
|
+
console.error(`Available checks: ${available}`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
12
41
|
const { app, config, offenses } = await (0, index_1.appCheckRun)(root, configPath, console.error.bind(console));
|
|
13
|
-
|
|
14
|
-
console.log(JSON.stringify(
|
|
15
|
-
|
|
42
|
+
const filtered = checks ? offenses.filter((o) => checks.includes(o.check)) : offenses;
|
|
43
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
44
|
+
if (!checks) {
|
|
45
|
+
console.log(JSON.stringify(config, null, 2));
|
|
46
|
+
console.log(JSON.stringify(app.map((x) => x.uri), null, 2));
|
|
47
|
+
}
|
|
16
48
|
}
|
|
17
49
|
function printUsage() {
|
|
18
50
|
console.log(`
|
|
19
|
-
Usage: platformos-check [command] [options]
|
|
51
|
+
Usage: platformos-check [command] [options] [path] [configPath]
|
|
20
52
|
|
|
21
53
|
Commands:
|
|
22
|
-
<path> Run platformos checks on the specified path (default)
|
|
54
|
+
<path> Run platformos checks on the specified path (default: .)
|
|
23
55
|
backfill-docs Backfill doc tags in partial files based on usage
|
|
24
56
|
|
|
57
|
+
Options:
|
|
58
|
+
--check, -c <name> Only show offenses from the named check (repeatable)
|
|
59
|
+
--help, -h Show this help message
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
platformos-check .
|
|
63
|
+
platformos-check . --check MissingPage
|
|
64
|
+
platformos-check . -c MissingPage -c UnknownFilter
|
|
65
|
+
|
|
25
66
|
Run 'platformos-check <command> --help' for more information on a command.
|
|
26
67
|
`);
|
|
27
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformos/platformos-check-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "platformOS",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"type-check": "tsc --noEmit"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@platformos/platformos-check-common": "0.0.
|
|
37
|
-
"@platformos/platformos-check-docs-updater": "0.0.
|
|
36
|
+
"@platformos/platformos-check-common": "0.0.16",
|
|
37
|
+
"@platformos/platformos-check-docs-updater": "0.0.16",
|
|
38
38
|
"glob": "^13.0.0",
|
|
39
39
|
"normalize-path": "^3.0.0",
|
|
40
40
|
"vscode-uri": "^3.1.0",
|