diff --git a/packages/code-analyzer-core/package.json b/packages/code-analyzer-core/package.json index eb0cf4d8..845f10af 100644 --- a/packages/code-analyzer-core/package.json +++ b/packages/code-analyzer-core/package.json @@ -10,7 +10,10 @@ "url": "git+https://github.com/forcedotcom/code-analyzer-core.git", "directory": "packages/code-analyzer-core" }, - "main": "dist/index.js", + "exports": { + ".": "./dist/index.js", + "./output-formats": "./dist/output-formats/index.js" + }, "types": "dist/index.d.ts", "dependencies": { "@salesforce/code-analyzer-engine-api": "0.28.0-SNAPSHOT", diff --git a/packages/code-analyzer-core/src/output-formats/index.ts b/packages/code-analyzer-core/src/output-formats/index.ts new file mode 100644 index 00000000..4f33564a --- /dev/null +++ b/packages/code-analyzer-core/src/output-formats/index.ts @@ -0,0 +1,3 @@ +export type { + ViolationCounts +} from "./results/json-run-results-format" diff --git a/packages/code-analyzer-core/src/output-formats/results/json-run-results-format.ts b/packages/code-analyzer-core/src/output-formats/results/json-run-results-format.ts index f0193656..8e27ac5d 100644 --- a/packages/code-analyzer-core/src/output-formats/results/json-run-results-format.ts +++ b/packages/code-analyzer-core/src/output-formats/results/json-run-results-format.ts @@ -11,31 +11,35 @@ export type JsonResultsOutput = { runDir: string // Object containing the aggregate counts of the violations - violationCounts: { - // The total amount of violations - total: number + violationCounts: ViolationCounts - // The amount of Critical severity level violations - sev1: number + // Object containing the versions of core and engine modules that ran + versions: JsonVersionOutput - // The amount of High severity level violations - sev2: number + // Array of objects containing information about the violations detected + violations: JsonViolationOutput[] +} +/** + * Type representing violation counts by severity level; this is specifically exported externally. + */ +export type ViolationCounts = { + // The total amount of violations + total: number - // The amount of Moderate severity level violations - sev3: number + // The amount of Critical severity level violations + sev1: number - // The amount of Low severity level violations - sev4: number + // The amount of High severity level violations + sev2: number - // The amount of Info severity level violations - sev5: number - } + // The amount of Moderate severity level violations + sev3: number - // Object containing the versions of core and engine modules that ran - versions: JsonVersionOutput + // The amount of Low severity level violations + sev4: number - // Array of objects containing information about the violations detected - violations: JsonViolationOutput[] + // The amount of Info severity level violations + sev5: number } export type JsonVersionOutput = { [coreOrEngineName: string]: string