Improve type safety by using more specific function types
This commit is contained in:
parent
2e69043274
commit
d8f549d6d8
9 changed files with 21 additions and 14 deletions
|
|
@ -51,7 +51,6 @@
|
|||
// "temporarily downgraded during transition to eslint
|
||||
"files": "**",
|
||||
"rules": {
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"analyze-action-post-helper.js","sourceRoot":"","sources":["../src/analyze-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAA2C;AAC3C,uCAA6C;AAEtC,KAAK,UAAU,GAAG,CAAC,wBAAkC;IAC1D,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CACP,oFAAoF,CACrF,CAAC;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAlBD,kBAkBC"}
|
||||
{"version":3,"file":"analyze-action-post-helper.js","sourceRoot":"","sources":["../src/analyze-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAAmD;AACnD,uCAA6C;AAEtC,KAAK,UAAU,GAAG,CACvB,wBAGkB;IAElB,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CACP,oFAAoF,CACrF,CAAC;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAvBD,kBAuBC"}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,10 +1,15 @@
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { getConfig } from "./config-utils";
|
||||
import { Config, getConfig } from "./config-utils";
|
||||
import { getActionsLogger } from "./logging";
|
||||
|
||||
export async function run(uploadSarifDebugArtifact: Function) {
|
||||
export async function run(
|
||||
uploadSarifDebugArtifact: (
|
||||
config: Config,
|
||||
outputDir: string,
|
||||
) => Promise<void>,
|
||||
) {
|
||||
const logger = getActionsLogger();
|
||||
|
||||
const config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
|
||||
|
|
|
|||
|
|
@ -233,14 +233,14 @@ export interface BetterResolveLanguagesOutput {
|
|||
export interface ResolveQueriesOutput {
|
||||
byLanguage: {
|
||||
[language: string]: {
|
||||
[queryPath: string]: {};
|
||||
[queryPath: string]: object;
|
||||
};
|
||||
};
|
||||
noDeclaredLanguage: {
|
||||
[queryPath: string]: {};
|
||||
[queryPath: string]: object;
|
||||
};
|
||||
multipleDeclaredLanguages: {
|
||||
[queryPath: string]: {};
|
||||
[queryPath: string]: object;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ function createConfigFile(inputFileContents: string, tmpDir: string): string {
|
|||
return configFilePath;
|
||||
}
|
||||
|
||||
type GetContentsResponse = { content?: string } | Array<{}>;
|
||||
type GetContentsResponse = { content?: string } | object[];
|
||||
|
||||
function mockGetContents(
|
||||
content: GetContentsResponse,
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,7 @@ function createRegistriesBlock(registries: RegistryConfigWithCredentials[]): {
|
|||
*/
|
||||
export async function wrapEnvironment(
|
||||
env: Record<string, string | undefined>,
|
||||
operation: Function,
|
||||
operation: () => Promise<void>,
|
||||
) {
|
||||
// Remember the original env
|
||||
const oldEnv = { ...process.env };
|
||||
|
|
|
|||
|
|
@ -163,9 +163,12 @@ export async function tryUploadSarifIfRunFailed(
|
|||
}
|
||||
|
||||
export async function run(
|
||||
uploadDatabaseBundleDebugArtifact: Function,
|
||||
uploadLogsDebugArtifact: Function,
|
||||
printDebugLogs: Function,
|
||||
uploadDatabaseBundleDebugArtifact: (
|
||||
config: Config,
|
||||
logger: Logger,
|
||||
) => Promise<void>,
|
||||
uploadLogsDebugArtifact: (config: Config) => Promise<void>,
|
||||
printDebugLogs: (config: Config) => Promise<void>,
|
||||
config: Config,
|
||||
repositoryNwo: RepositoryNwo,
|
||||
features: FeatureEnablement,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue