mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 09:10:07 +08:00
Compare commits
25 Commits
codeql-bun
...
v2.21.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddccb87388 | ||
|
|
d8cb5a2a0f | ||
|
|
27cb1e1de5 | ||
|
|
4818fdd8ec | ||
|
|
e548601be3 | ||
|
|
cc6542087a | ||
|
|
c95737bb43 | ||
|
|
41d2ffad87 | ||
|
|
650a85ef6d | ||
|
|
0de36d4594 | ||
|
|
0dfaf4ef65 | ||
|
|
d1a917f445 | ||
|
|
431174f620 | ||
|
|
3078f51bf0 | ||
|
|
d0c18ba23e | ||
|
|
724d64319a | ||
|
|
49aaa9a420 | ||
|
|
c21e1dd0da | ||
|
|
53bed11e0b | ||
|
|
ab8159054c | ||
|
|
765807bee7 | ||
|
|
bf2187592f | ||
|
|
c4c06786f2 | ||
|
|
59aaff8718 | ||
|
|
5897cf73c4 |
@@ -2,9 +2,12 @@
|
||||
|
||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||
|
||||
## [UNRELEASED]
|
||||
## 2.21.9 - 27 Sep 2023
|
||||
|
||||
No user facing changes.
|
||||
- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
|
||||
- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
|
||||
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
|
||||
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)
|
||||
|
||||
## 2.21.8 - 19 Sep 2023
|
||||
|
||||
|
||||
58
lib/autobuild.js
generated
58
lib/autobuild.js
generated
@@ -1,8 +1,37 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const repository_1 = require("./repository");
|
||||
const util_1 = require("./util");
|
||||
async function determineAutobuildLanguages(config, logger) {
|
||||
// Attempt to find a language to autobuild
|
||||
// We want pick the dominant language in the repo from the ones we're able to build
|
||||
@@ -70,9 +99,38 @@ async function determineAutobuildLanguages(config, logger) {
|
||||
return languages;
|
||||
}
|
||||
exports.determineAutobuildLanguages = determineAutobuildLanguages;
|
||||
async function setupCppAutobuild(codeql, logger) {
|
||||
const envVar = feature_flags_1.featureConfig[feature_flags_1.Feature.CppDependencyInstallation].envVar;
|
||||
const featureName = "C++ automatic installation of dependencies";
|
||||
const envDoc = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||
if (await features.getValue(feature_flags_1.Feature.CppDependencyInstallation, codeql)) {
|
||||
// disable autoinstall on self-hosted runners unless explicitly requested
|
||||
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
|
||||
process.env[envVar] !== "true") {
|
||||
logger.info(`Disabling ${featureName} as we are on a self-hosted runner.${(0, actions_util_1.getWorkflowEventName)() !== "dynamic"
|
||||
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
|
||||
: ""}`);
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
else {
|
||||
logger.info(`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`);
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.info(`Disabling ${featureName}.`);
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
}
|
||||
async function runAutobuild(language, config, logger) {
|
||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
if (language === languages_1.Language.cpp) {
|
||||
await setupCppAutobuild(codeQL, logger);
|
||||
}
|
||||
await codeQL.runAutobuild(language);
|
||||
logger.endGroup();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGlD,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,CAAC,EAAE,CACzB,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,yEAAyE;IACzE,UAAU;IACV,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QAChD,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;KAChD;IACD,uEAAuE;IACvE,wCAAwC;IACxC,IAAI,kBAAkB,CAAC,MAAM,KAAK,2BAA2B,CAAC,MAAM,EAAE;QACpE,SAAS,CAAC,IAAI,CAAC,oBAAQ,CAAC,EAAE,CAAC,CAAC;KAC7B;IAED,MAAM,CAAC,KAAK,CAAC,kBAAkB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE3D,2EAA2E;IAC3E,4EAA4E;IAC5E,2CAA2C;IAC3C,uEAAuE;IACvE,2EAA2E;IAC3E,uEAAuE;IACvE,yCAAyC;IACzC,IAAI,2BAA2B,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1C,MAAM,CAAC,OAAO,CACZ,oCAAoC,SAAS,CAAC,IAAI,CAChD,OAAO,CACR,8BAA8B,2BAA2B;aACvD,KAAK,CAAC,CAAC,CAAC;aACR,IAAI,CACH,OAAO,CACR,kFAAkF;YACnF,4BAA4B;YAC5B,0NAA0N,CAC7N,CAAC;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAtFD,kEAsFC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AATD,oCASC"}
|
||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAA6E;AAC7E,6CAAgD;AAChD,qCAA6C;AAE7C,mDAAmE;AACnE,2CAAyD;AAEzD,6CAAkD;AAClD,iCAA6C;AAEtC,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,CAAC,EAAE,CACzB,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,yEAAyE;IACzE,UAAU;IACV,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QAChD,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;KAChD;IACD,uEAAuE;IACvE,wCAAwC;IACxC,IAAI,kBAAkB,CAAC,MAAM,KAAK,2BAA2B,CAAC,MAAM,EAAE;QACpE,SAAS,CAAC,IAAI,CAAC,oBAAQ,CAAC,EAAE,CAAC,CAAC;KAC7B;IAED,MAAM,CAAC,KAAK,CAAC,kBAAkB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE3D,2EAA2E;IAC3E,4EAA4E;IAC5E,2CAA2C;IAC3C,uEAAuE;IACvE,2EAA2E;IAC3E,uEAAuE;IACvE,yCAAyC;IACzC,IAAI,2BAA2B,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1C,MAAM,CAAC,OAAO,CACZ,oCAAoC,SAAS,CAAC,IAAI,CAChD,OAAO,CACR,8BAA8B,2BAA2B;aACvD,KAAK,CAAC,CAAC,CAAC;aACR,IAAI,CACH,OAAO,CACR,kFAAkF;YACnF,4BAA4B;YAC5B,0NAA0N,CAC7N,CAAC;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAtFD,kEAsFC;AAED,KAAK,UAAU,iBAAiB,CAAC,MAAc,EAAE,MAAc;IAC7D,MAAM,MAAM,GAAG,6BAAa,CAAC,uBAAO,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC;IACvE,MAAM,WAAW,GAAG,4CAA4C,CAAC;IACjE,MAAM,MAAM,GACV,wHAAwH,CAAC;IAC3H,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;IAC/C,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,IAAA,oCAAqB,GAAE,EACvB,MAAM,CACP,CAAC;IACF,IAAI,MAAM,QAAQ,CAAC,QAAQ,CAAC,uBAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC,EAAE;QACtE,yEAAyE;QACzE,IACE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,aAAa;YACnD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,MAAM,EAC9B;YACA,MAAM,CAAC,IAAI,CACT,aAAa,WAAW,sCACtB,IAAA,mCAAoB,GAAE,KAAK,SAAS;gBAClC,CAAC,CAAC,8BAA8B,MAAM,yDAAyD,MAAM,IAAI;gBACzG,CAAC,CAAC,EACN,EAAE,CACH,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACtC;aAAM;YACL,MAAM,CAAC,IAAI,CACT,YAAY,WAAW,yCAAyC,MAAM,yCAAyC,MAAM,IAAI,CAC1H,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACrC;KACF;SAAM;QACL,MAAM,CAAC,IAAI,CAAC,aAAa,WAAW,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,oBAAQ,CAAC,GAAG,EAAE;QAC7B,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAZD,oCAYC"}
|
||||
6
lib/codeql.js
generated
6
lib/codeql.js
generated
@@ -297,6 +297,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||
extraArgs.push("--calculate-language-specific-baseline");
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||
extraArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"init",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-v2.14.5",
|
||||
"cliVersion": "2.14.5",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.4",
|
||||
"priorCliVersion": "2.14.4"
|
||||
"bundleVersion": "codeql-bundle-v2.14.6",
|
||||
"cliVersion": "2.14.6",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.5",
|
||||
"priorCliVersion": "2.14.5"
|
||||
}
|
||||
|
||||
23
lib/feature-flags.js
generated
23
lib/feature-flags.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const semver = __importStar(require("semver"));
|
||||
@@ -41,9 +41,14 @@ exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
|
||||
*/
|
||||
exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||
/**
|
||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options.
|
||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options, but we
|
||||
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
|
||||
*/
|
||||
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
||||
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||
*/
|
||||
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
||||
/**
|
||||
* Feature enablement as returned by the GitHub API endpoint.
|
||||
*
|
||||
@@ -54,12 +59,14 @@ var Feature;
|
||||
Feature["AnalysisSummaryV2Enabled"] = "analysis_summary_v2_enabled";
|
||||
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
|
||||
Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled";
|
||||
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
||||
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
|
||||
Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled";
|
||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||
Feature["SublanguageFileCoverageEnabled"] = "sublanguage_file_coverage_enabled";
|
||||
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
||||
})(Feature || (exports.Feature = Feature = {}));
|
||||
exports.featureConfig = {
|
||||
@@ -73,6 +80,11 @@ exports.featureConfig = {
|
||||
minimumVersion: "2.14.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
minimumVersion: "2.15.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
||||
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
|
||||
minimumVersion: undefined,
|
||||
@@ -103,6 +115,11 @@ exports.featureConfig = {
|
||||
minimumVersion: undefined,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.SublanguageFileCoverageEnabled]: {
|
||||
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
|
||||
minimumVersion: exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.UploadFailedSarifEnabled]: {
|
||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||
minimumVersion: "2.11.3",
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/init-action.js
generated
4
lib/init-action.js
generated
@@ -121,8 +121,7 @@ async function run() {
|
||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||
core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)());
|
||||
try {
|
||||
const workflowErrors = await (0, workflow_1.validateWorkflow)(logger);
|
||||
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("init", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger), workflowErrors)))) {
|
||||
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("init", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
|
||||
return;
|
||||
}
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||
@@ -132,6 +131,7 @@ async function run() {
|
||||
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
|
||||
toolsVersion = initCodeQLResult.toolsVersion;
|
||||
toolsSource = initCodeQLResult.toolsSource;
|
||||
await (0, workflow_1.validateWorkflow)(codeql, logger);
|
||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), registriesInput, (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("config"), getTrapCachingEnabled(),
|
||||
// Debug mode is enabled if:
|
||||
// - The `init` Action is passed `debug: true`.
|
||||
|
||||
File diff suppressed because one or more lines are too long
52
lib/workflow.js
generated
52
lib/workflow.js
generated
@@ -78,11 +78,57 @@ exports.WorkflowErrors = toCodedErrors({
|
||||
MissingPushHook: `Please specify an on.push hook to analyze and see code scanning alerts from the default branch on the Security tab.`,
|
||||
CheckoutWrongHead: `git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.`,
|
||||
});
|
||||
function getWorkflowErrors(doc) {
|
||||
/**
|
||||
* Groups the given list of CodeQL languages by their extractor name.
|
||||
*
|
||||
* Resolves to `undefined` if the CodeQL version does not support language aliasing.
|
||||
*/
|
||||
async function groupLanguagesByExtractor(languages, codeql) {
|
||||
const resolveResult = await codeql.betterResolveLanguages();
|
||||
if (!resolveResult.aliases) {
|
||||
return undefined;
|
||||
}
|
||||
const aliases = resolveResult.aliases;
|
||||
const languagesByExtractor = {};
|
||||
for (const language of languages) {
|
||||
const extractorName = aliases[language] || language;
|
||||
if (!languagesByExtractor[extractorName]) {
|
||||
languagesByExtractor[extractorName] = [];
|
||||
}
|
||||
languagesByExtractor[extractorName].push(language);
|
||||
}
|
||||
return languagesByExtractor;
|
||||
}
|
||||
async function getWorkflowErrors(doc, codeql) {
|
||||
const errors = [];
|
||||
const jobName = process.env.GITHUB_JOB;
|
||||
if (jobName) {
|
||||
const job = doc?.jobs?.[jobName];
|
||||
if (job?.strategy?.matrix?.language) {
|
||||
const matrixLanguages = job.strategy.matrix.language;
|
||||
if (Array.isArray(matrixLanguages)) {
|
||||
// Map extractors to entries in the `language` matrix parameter. This will allow us to
|
||||
// detect languages which are analyzed in more than one job.
|
||||
const matrixLanguagesByExtractor = await groupLanguagesByExtractor(matrixLanguages, codeql);
|
||||
// If the CodeQL version does not support language aliasing, then `matrixLanguagesByExtractor`
|
||||
// will be `undefined`. In this case, we cannot detect duplicate languages in the matrix.
|
||||
if (matrixLanguagesByExtractor !== undefined) {
|
||||
// Check for duplicate languages in the matrix
|
||||
for (const [extractor, languages] of Object.entries(matrixLanguagesByExtractor)) {
|
||||
if (languages.length > 1) {
|
||||
errors.push({
|
||||
message: `CodeQL language '${extractor}' is referenced by more than one entry in the ` +
|
||||
`'language' matrix parameter for job '${jobName}'. This may result in duplicate alerts. ` +
|
||||
`Please edit the 'language' matrix parameter to keep only one of the following: ${languages
|
||||
.map((language) => `'${language}'`)
|
||||
.join(", ")}.`,
|
||||
code: "DuplicateLanguageInMatrix",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const steps = job?.steps;
|
||||
if (Array.isArray(steps)) {
|
||||
for (const step of steps) {
|
||||
@@ -127,7 +173,7 @@ function getWorkflowErrors(doc) {
|
||||
return errors;
|
||||
}
|
||||
exports.getWorkflowErrors = getWorkflowErrors;
|
||||
async function validateWorkflow(logger) {
|
||||
async function validateWorkflow(codeql, logger) {
|
||||
let workflow;
|
||||
try {
|
||||
workflow = await getWorkflow(logger);
|
||||
@@ -137,7 +183,7 @@ async function validateWorkflow(logger) {
|
||||
}
|
||||
let workflowErrors;
|
||||
try {
|
||||
workflowErrors = getWorkflowErrors(workflow);
|
||||
workflowErrors = await getWorkflowErrors(workflow, codeql);
|
||||
}
|
||||
catch (e) {
|
||||
return `error: getWorkflowErrors() failed: ${String(e)}`;
|
||||
|
||||
File diff suppressed because one or more lines are too long
240
lib/workflow.test.js
generated
240
lib/workflow.test.js
generated
@@ -28,119 +28,114 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const sinon = __importStar(require("sinon"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const workflow_1 = require("./workflow");
|
||||
function errorCodes(actual, expected) {
|
||||
return [actual.map(({ code }) => code), expected.map(({ code }) => code)];
|
||||
}
|
||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||
(0, ava_1.default)("getWorkflowErrors() when on is empty", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({ on: {} });
|
||||
(0, ava_1.default)("getWorkflowErrors() when on is empty", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({ on: {} }, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing pull_request", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({ on: ["push"] });
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing pull_request", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({ on: ["push"] }, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing push", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({ on: ["pull_request"] });
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing push", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({ on: ["pull_request"] }, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.MissingPushHook]));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is valid", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is valid", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: ["push", "pull_request"],
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is a valid superset", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is a valid superset", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: ["push", "pull_request", "schedule"],
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is a correct object", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
on: { push: { branches: ["main"] }, pull_request: { branches: ["main"] } },
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is a correct object", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: {
|
||||
push: { branches: ["main"] },
|
||||
pull_request: { branches: ["main"] },
|
||||
},
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.pull_requests is a string and correct", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.pull_requests is a string and correct", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: { push: { branches: "*" }, pull_request: { branches: "*" } },
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is correct with empty objects", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is correct with empty objects", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is not mismatched", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push is not mismatched", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: {
|
||||
push: { branches: ["main", "feature"] },
|
||||
pull_request: { branches: ["main"] },
|
||||
},
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() for a range of malformed workflows", (t) => {
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() for a range of malformed workflows", async (t) => {
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: {
|
||||
push: 1,
|
||||
pull_request: 1,
|
||||
},
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
(0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: 1,
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
(0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: [1],
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { 1: 1 },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { test: 1 },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { test: [1] },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
(0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { test: { steps: 1 } },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
(0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { test: { steps: [{ notrun: "git checkout HEAD^2" }] } },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: 1,
|
||||
jobs: { test: [undefined] },
|
||||
}), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(1), []));
|
||||
t.deepEqual(...errorCodes(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
(0, workflow_1.getWorkflowErrors)({
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(1, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
|
||||
on: {
|
||||
push: {
|
||||
branches: 1,
|
||||
@@ -149,25 +144,86 @@ function errorCodes(actual, expected) {
|
||||
branches: 1,
|
||||
},
|
||||
},
|
||||
}), []));
|
||||
}, await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.pull_request for wildcard branches", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.pull_request for wildcard branches", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: {
|
||||
push: { branches: ["feature/*"] },
|
||||
pull_request: { branches: "feature/moose" },
|
||||
},
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when HEAD^2 is checked out", (t) => {
|
||||
(0, ava_1.default)("getWorkflowErrors() when HEAD^2 is checked out", async (t) => {
|
||||
process.env.GITHUB_JOB = "test";
|
||||
const errors = (0, workflow_1.getWorkflowErrors)({
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: ["push", "pull_request"],
|
||||
jobs: { test: { steps: [{ run: "git checkout HEAD^2" }] } },
|
||||
});
|
||||
}, await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead]));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() produces an error for workflow with language name and its alias", async (t) => {
|
||||
await testLanguageAliases(t, ["java", "kotlin"], { java: ["java-kotlin", "kotlin"] }, [
|
||||
"CodeQL language 'java' is referenced by more than one entry in the 'language' matrix " +
|
||||
"parameter for job 'test'. This may result in duplicate alerts. Please edit the 'language' " +
|
||||
"matrix parameter to keep only one of the following: 'java', 'kotlin'.",
|
||||
]);
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() produces an error for workflow with two aliases same language", async (t) => {
|
||||
await testLanguageAliases(t, ["java-kotlin", "kotlin"], { java: ["java-kotlin", "kotlin"] }, [
|
||||
"CodeQL language 'java' is referenced by more than one entry in the 'language' matrix " +
|
||||
"parameter for job 'test'. This may result in duplicate alerts. Please edit the 'language' " +
|
||||
"matrix parameter to keep only one of the following: 'java-kotlin', 'kotlin'.",
|
||||
]);
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() does not produce an error for workflow with two distinct languages", async (t) => {
|
||||
await testLanguageAliases(t, ["java", "typescript"], {
|
||||
java: ["java-kotlin", "kotlin"],
|
||||
javascript: ["javascript-typescript", "typescript"],
|
||||
}, []);
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() does not produce an error if codeql doesn't support language aliases", async (t) => {
|
||||
await testLanguageAliases(t, ["java-kotlin", "kotlin"], undefined, []);
|
||||
});
|
||||
async function testLanguageAliases(t, matrixLanguages, aliases, expectedErrorMessages) {
|
||||
process.env.GITHUB_JOB = "test";
|
||||
const codeql = await (0, codeql_1.getCodeQLForTesting)();
|
||||
sinon.stub(codeql, "betterResolveLanguages").resolves({
|
||||
aliases: aliases !== undefined
|
||||
? // Remap from languageName -> aliases to alias -> languageName
|
||||
Object.assign({}, ...Object.entries(aliases).flatMap(([language, languageAliases]) => languageAliases.map((alias) => ({
|
||||
[alias]: language,
|
||||
}))))
|
||||
: undefined,
|
||||
extractors: {
|
||||
java: [
|
||||
{
|
||||
extractor_root: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)({
|
||||
on: ["push", "pull_request"],
|
||||
jobs: {
|
||||
test: {
|
||||
strategy: {
|
||||
matrix: {
|
||||
language: matrixLanguages,
|
||||
},
|
||||
},
|
||||
steps: [
|
||||
{ uses: "actions/checkout@v2" },
|
||||
{ uses: "github/codeql-action/init@v2" },
|
||||
{ uses: "github/codeql-action/analyze@v2" },
|
||||
],
|
||||
},
|
||||
},
|
||||
}, codeql);
|
||||
t.is(errors.length, expectedErrorMessages.length);
|
||||
t.deepEqual(errors.map((e) => e.message), expectedErrorMessages);
|
||||
}
|
||||
(0, ava_1.default)("formatWorkflowErrors() when there is one error", (t) => {
|
||||
const message = (0, workflow_1.formatWorkflowErrors)([workflow_1.WorkflowErrors.CheckoutWrongHead]);
|
||||
t.true(message.startsWith("1 issue was detected with this workflow:"));
|
||||
@@ -213,19 +269,19 @@ function errorCodes(actual, expected) {
|
||||
t.true((0, workflow_1.patternIsSuperset)("/robin/*/release/*", "/robin/moose/release/goose"));
|
||||
t.false((0, workflow_1.patternIsSuperset)("/robin/moose/release/goose", "/robin/*/release/*"));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when branches contain dots", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() when branches contain dots", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
on:
|
||||
push:
|
||||
branches: [4.1, master]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [4.1, master]
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push has a trailing comma", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() when on.push has a trailing comma", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
@@ -233,12 +289,12 @@ function errorCodes(actual, expected) {
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() should only report the current job's CheckoutWrongHead", (t) => {
|
||||
(0, ava_1.default)("getWorkflowErrors() should only report the current job's CheckoutWrongHead", async (t) => {
|
||||
process.env.GITHUB_JOB = "test";
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
@@ -257,12 +313,12 @@ function errorCodes(actual, expected) {
|
||||
|
||||
test3:
|
||||
steps: []
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead]));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() should not report a different job's CheckoutWrongHead", (t) => {
|
||||
(0, ava_1.default)("getWorkflowErrors() should not report a different job's CheckoutWrongHead", async (t) => {
|
||||
process.env.GITHUB_JOB = "test3";
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
@@ -281,41 +337,41 @@ function errorCodes(actual, expected) {
|
||||
|
||||
test3:
|
||||
steps: []
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() when on is missing", (t) => {
|
||||
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() when on is missing", async (t) => {
|
||||
const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
`));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)());
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() with a different on setup", (t) => {
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() with a different on setup", async (t) => {
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: "workflow_dispatch"
|
||||
`)), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
`), await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: [workflow_dispatch]
|
||||
`)), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
`), await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
`)), []));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
});
|
||||
(0, ava_1.default)("getWorkflowErrors() should not report an error if PRs are totally unconfigured", (t) => {
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
(0, ava_1.default)("getWorkflowErrors() should not report an error if PRs are totally unconfigured", async (t) => {
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
`)), []));
|
||||
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
`), await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: ["push"]
|
||||
`)), []));
|
||||
`), await (0, codeql_1.getCodeQLForTesting)()), []));
|
||||
});
|
||||
(0, ava_1.default)("getCategoryInputOrThrow returns category for simple workflow with category", (t) => {
|
||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||
|
||||
File diff suppressed because one or more lines are too long
51
node_modules/.package-lock.json
generated
vendored
51
node_modules/.package-lock.json
generated
vendored
@@ -448,9 +448,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz",
|
||||
"integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==",
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -762,13 +762,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz",
|
||||
"integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==",
|
||||
"version": "12.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.0.0.tgz",
|
||||
"integrity": "sha512-EzD434aHTFifGudYAygnFlS1Tl6KhbTynEWELQXIbTY8Msvb5nEqTZIm7sbPEt4mQYLZwu3zPKVdeIrw0g7ovg==",
|
||||
"dependencies": {
|
||||
"@octokit/openapi-types": "^18.0.0"
|
||||
"@octokit/openapi-types": "^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types/node_modules/@octokit/openapi-types": {
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.0.0.tgz",
|
||||
"integrity": "sha512-PclQ6JGMTE9iUStpzMkwLCISFn/wDeRjkZFIKALpvJQNBGwDoYYi2fFvuHwssoQ1rXI5mfh6jgTgWuddeUzfWw=="
|
||||
},
|
||||
"node_modules/@opentelemetry/api": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz",
|
||||
@@ -835,9 +840,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/adm-zip": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.1.tgz",
|
||||
"integrity": "sha512-3+psmbh60N5JXM2LMkujFqnjMf3KB0LZoIQO73NJvkv57q+384nK/A7pP0v+ZkB/Zrfqn+5xtAyt5OsY+GiYLQ==",
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.2.tgz",
|
||||
"integrity": "sha512-33OTTnnW3onOE6HJuoqsi7T7Ojupz7zO/Vs5ddRNVCYQnu4lg05RqH/pr9eidHGvGyYfdO4uPO9cvegAMixBCQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
@@ -900,15 +905,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz",
|
||||
"integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==",
|
||||
"version": "7.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz",
|
||||
"integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/sinon": {
|
||||
"version": "10.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.16.tgz",
|
||||
"integrity": "sha512-j2Du5SYpXZjJVJtXBokASpPRj+e2z+VUhCPHmM6WMfe3dpHu6iVKJMU6AiBcMp/XTAYnEj6Wc1trJUWwZ0QaAQ==",
|
||||
"version": "10.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.17.tgz",
|
||||
"integrity": "sha512-+6ILpcixQ0Ma3dHMTLv4rSycbDXkDljgKL+E0nI2RUxxhYTFyPSjt6RVMxh7jUshvyVcBvicb0Ktj+lAJcjgeA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
@@ -2465,15 +2470,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz",
|
||||
"integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==",
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.49.0",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
@@ -2551,9 +2556,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-import-resolver-typescript": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz",
|
||||
"integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==",
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz",
|
||||
"integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
|
||||
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "8.49.0",
|
||||
"version": "8.50.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {},
|
||||
|
||||
2
node_modules/@eslint/js/src/configs/eslint-all.js
generated
vendored
2
node_modules/@eslint/js/src/configs/eslint-all.js
generated
vendored
@@ -152,11 +152,11 @@ module.exports = Object.freeze({
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-native-nonconstructor": "error",
|
||||
"no-new-object": "error",
|
||||
"no-new-symbol": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-nonoctal-decimal-escape": "error",
|
||||
"no-obj-calls": "error",
|
||||
"no-object-constructor": "error",
|
||||
"no-octal": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": "error",
|
||||
|
||||
2
node_modules/@octokit/types/dist-types/VERSION.d.ts
generated
vendored
2
node_modules/@octokit/types/dist-types/VERSION.d.ts
generated
vendored
@@ -1 +1 @@
|
||||
export declare const VERSION = "11.1.0";
|
||||
export declare const VERSION = "12.0.0";
|
||||
|
||||
1606
node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts
generated
vendored
1606
node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
7
node_modules/@octokit/types/node_modules/@octokit/openapi-types/LICENSE
generated
vendored
Normal file
7
node_modules/@octokit/types/node_modules/@octokit/openapi-types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2020 Gregor Martynus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
17
node_modules/@octokit/types/node_modules/@octokit/openapi-types/README.md
generated
vendored
Normal file
17
node_modules/@octokit/types/node_modules/@octokit/openapi-types/README.md
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# @octokit/openapi-types
|
||||
|
||||
> Generated TypeScript definitions based on GitHub's OpenAPI spec
|
||||
|
||||
This package is continously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { components } from "@octokit/openapi-types";
|
||||
|
||||
type Repository = components["schemas"]["full-repository"];
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
20
node_modules/@octokit/types/node_modules/@octokit/openapi-types/package.json
generated
vendored
Normal file
20
node_modules/@octokit/types/node_modules/@octokit/openapi-types/package.json
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@octokit/openapi-types",
|
||||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/octokit/openapi-types.ts.git",
|
||||
"directory": "packages/openapi-types"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "19.0.0",
|
||||
"main": "",
|
||||
"types": "types.d.ts",
|
||||
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"octokit": {
|
||||
"openapi-version": "13.0.0"
|
||||
}
|
||||
}
|
||||
115824
node_modules/@octokit/types/node_modules/@octokit/openapi-types/types.d.ts
generated
vendored
Normal file
115824
node_modules/@octokit/types/node_modules/@octokit/openapi-types/types.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
node_modules/@octokit/types/package.json
generated
vendored
10
node_modules/@octokit/types/package.json
generated
vendored
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@octokit/types",
|
||||
"version": "11.1.0",
|
||||
"version": "12.0.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "Shared TypeScript definitions for Octokit projects",
|
||||
"dependencies": {
|
||||
"@octokit/openapi-types": "^18.0.0"
|
||||
"@octokit/openapi-types": "^19.0.0"
|
||||
},
|
||||
"repository": "github:octokit/types.ts",
|
||||
"keywords": [
|
||||
@@ -28,15 +28,15 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"pascal-case": "^3.1.1",
|
||||
"prettier": "^3.0.0",
|
||||
"semantic-release": "^21.0.0",
|
||||
"semantic-release": "^22.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"sort-keys": "^5.0.0",
|
||||
"string-to-jsdoc-comment": "^1.0.0",
|
||||
"typedoc": "^0.24.0",
|
||||
"typedoc": "^0.25.0",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"octokit": {
|
||||
"openapi-version": "12.0.0"
|
||||
"openapi-version": "13.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist-types/**"
|
||||
|
||||
0
node_modules/@types/adm-zip/LICENSE
generated
vendored
Executable file → Normal file
0
node_modules/@types/adm-zip/LICENSE
generated
vendored
Executable file → Normal file
2
node_modules/@types/adm-zip/README.md
generated
vendored
Executable file → Normal file
2
node_modules/@types/adm-zip/README.md
generated
vendored
Executable file → Normal file
@@ -8,7 +8,7 @@ This package contains type definitions for adm-zip (https://github.com/cthackers
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/adm-zip.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 09 Sep 2023 20:33:02 GMT
|
||||
* Last updated: Fri, 22 Sep 2023 18:11:03 GMT
|
||||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||
* Global values: none
|
||||
|
||||
|
||||
5
node_modules/@types/adm-zip/index.d.ts
generated
vendored
Executable file → Normal file
5
node_modules/@types/adm-zip/index.d.ts
generated
vendored
Executable file → Normal file
@@ -9,8 +9,8 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as FS from 'fs';
|
||||
import { Constants } from './util';
|
||||
import * as FS from "fs";
|
||||
import { Constants } from "./util";
|
||||
|
||||
declare class AdmZip {
|
||||
/**
|
||||
@@ -118,7 +118,6 @@ declare class AdmZip {
|
||||
filter?: RegExp | ((filename: string) => boolean),
|
||||
): void;
|
||||
/**
|
||||
*
|
||||
* @param localPath - path where files will be extracted
|
||||
* @param props - optional properties
|
||||
* @param props.zipPath - optional path inside zip
|
||||
|
||||
6
node_modules/@types/adm-zip/package.json
generated
vendored
Executable file → Normal file
6
node_modules/@types/adm-zip/package.json
generated
vendored
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@types/adm-zip",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "TypeScript definitions for adm-zip",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/adm-zip",
|
||||
"license": "MIT",
|
||||
@@ -42,6 +42,6 @@
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "2e5ee14b2604eed0df716f3fbe0ab112c0e9202577bf8b71e85576326fedaa6d",
|
||||
"typeScriptVersion": "4.3"
|
||||
"typesPublisherContentHash": "760a250ea3b5679cae48f06c02648470299cac3e2afe9f0ab03cffc9d703048d",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
||||
48
node_modules/@types/adm-zip/util.d.ts
generated
vendored
Executable file → Normal file
48
node_modules/@types/adm-zip/util.d.ts
generated
vendored
Executable file → Normal file
@@ -143,36 +143,36 @@ export const Constants: {
|
||||
|
||||
export const Errors: {
|
||||
/* Header error messages */
|
||||
INVALID_LOC: 'Invalid LOC header (bad signature)';
|
||||
INVALID_CEN: 'Invalid CEN header (bad signature)';
|
||||
INVALID_END: 'Invalid END header (bad signature)';
|
||||
INVALID_LOC: "Invalid LOC header (bad signature)";
|
||||
INVALID_CEN: "Invalid CEN header (bad signature)";
|
||||
INVALID_END: "Invalid END header (bad signature)";
|
||||
|
||||
/* ZipEntry error messages */
|
||||
NO_DATA: 'Nothing to decompress';
|
||||
BAD_CRC: 'CRC32 checksum failed';
|
||||
FILE_IN_THE_WAY: 'There is a file in the way: %s';
|
||||
UNKNOWN_METHOD: 'Invalid/unsupported compression method';
|
||||
NO_DATA: "Nothing to decompress";
|
||||
BAD_CRC: "CRC32 checksum failed";
|
||||
FILE_IN_THE_WAY: "There is a file in the way: %s";
|
||||
UNKNOWN_METHOD: "Invalid/unsupported compression method";
|
||||
|
||||
/* Inflater error messages */
|
||||
AVAIL_DATA: 'inflate::Available inflate data did not terminate';
|
||||
INVALID_DISTANCE: 'inflate::Invalid literal/length or distance code in fixed or dynamic block';
|
||||
TO_MANY_CODES: 'inflate::Dynamic block code description: too many length or distance codes';
|
||||
INVALID_REPEAT_LEN: 'inflate::Dynamic block code description: repeat more than specified lengths';
|
||||
INVALID_REPEAT_FIRST: 'inflate::Dynamic block code description: repeat lengths with no first length';
|
||||
INCOMPLETE_CODES: 'inflate::Dynamic block code description: code lengths codes incomplete';
|
||||
INVALID_DYN_DISTANCE: 'inflate::Dynamic block code description: invalid distance code lengths';
|
||||
INVALID_CODES_LEN: 'inflate::Dynamic block code description: invalid literal/length code lengths';
|
||||
AVAIL_DATA: "inflate::Available inflate data did not terminate";
|
||||
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block";
|
||||
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes";
|
||||
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths";
|
||||
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length";
|
||||
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete";
|
||||
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths";
|
||||
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths";
|
||||
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement";
|
||||
INVALID_BLOCK_TYPE: 'inflate::Invalid block type (type == 3)';
|
||||
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)";
|
||||
|
||||
/* ADM-ZIP error messages */
|
||||
CANT_EXTRACT_FILE: 'Could not extract the file';
|
||||
CANT_OVERRIDE: 'Target file already exists';
|
||||
NO_ZIP: 'No zip file was loaded';
|
||||
CANT_EXTRACT_FILE: "Could not extract the file";
|
||||
CANT_OVERRIDE: "Target file already exists";
|
||||
NO_ZIP: "No zip file was loaded";
|
||||
NO_ENTRY: "Entry doesn't exist";
|
||||
DIRECTORY_CONTENT_ERROR: 'A directory cannot have content';
|
||||
FILE_NOT_FOUND: 'File not found: %s';
|
||||
NOT_IMPLEMENTED: 'Not implemented';
|
||||
INVALID_FILENAME: 'Invalid filename';
|
||||
INVALID_FORMAT: 'Invalid or unsupported zip format. No END header found';
|
||||
DIRECTORY_CONTENT_ERROR: "A directory cannot have content";
|
||||
FILE_NOT_FOUND: "File not found: %s";
|
||||
NOT_IMPLEMENTED: "Not implemented";
|
||||
INVALID_FILENAME: "Invalid filename";
|
||||
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found";
|
||||
};
|
||||
|
||||
2
node_modules/@types/semver/README.md
generated
vendored
2
node_modules/@types/semver/README.md
generated
vendored
@@ -8,7 +8,7 @@ This package contains type definitions for semver (https://github.com/npm/node-s
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 14 Sep 2023 01:49:19 GMT
|
||||
* Last updated: Mon, 25 Sep 2023 13:39:06 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
|
||||
6
node_modules/@types/semver/classes/comparator.d.ts
generated
vendored
6
node_modules/@types/semver/classes/comparator.d.ts
generated
vendored
@@ -1,11 +1,11 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('./semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("./semver");
|
||||
|
||||
declare class Comparator {
|
||||
constructor(comp: string | Comparator, optionsOrLoose?: boolean | semver.Options);
|
||||
|
||||
semver: SemVer;
|
||||
operator: '' | '=' | '<' | '>' | '<=' | '>=';
|
||||
operator: "" | "=" | "<" | ">" | "<=" | ">=";
|
||||
value: string;
|
||||
loose: boolean;
|
||||
options: semver.Options;
|
||||
|
||||
6
node_modules/@types/semver/classes/range.d.ts
generated
vendored
6
node_modules/@types/semver/classes/range.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import semver = require('../index');
|
||||
import Comparator = require('./comparator');
|
||||
import SemVer = require('./semver');
|
||||
import semver = require("../index");
|
||||
import Comparator = require("./comparator");
|
||||
import SemVer = require("./semver");
|
||||
|
||||
declare class Range {
|
||||
constructor(range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions);
|
||||
|
||||
2
node_modules/@types/semver/classes/semver.d.ts
generated
vendored
2
node_modules/@types/semver/classes/semver.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import semver = require('../index');
|
||||
import semver = require("../index");
|
||||
|
||||
declare class SemVer {
|
||||
constructor(version: string | SemVer, optionsOrLoose?: boolean | semver.RangeOptions);
|
||||
|
||||
2
node_modules/@types/semver/functions/clean.d.ts
generated
vendored
2
node_modules/@types/semver/functions/clean.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import semver = require('../index');
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.
|
||||
|
||||
4
node_modules/@types/semver/functions/cmp.d.ts
generated
vendored
4
node_modules/@types/semver/functions/cmp.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
/**
|
||||
* Pass in a comparison string, and it'll call the corresponding semver comparison function.
|
||||
|
||||
4
node_modules/@types/semver/functions/coerce.d.ts
generated
vendored
4
node_modules/@types/semver/functions/coerce.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
/**
|
||||
* Coerces a string to SemVer if possible
|
||||
|
||||
4
node_modules/@types/semver/functions/compare-build.d.ts
generated
vendored
4
node_modules/@types/semver/functions/compare-build.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
/**
|
||||
* Compares two versions including build identifiers (the bit after `+` in the semantic version string).
|
||||
|
||||
2
node_modules/@types/semver/functions/compare-loose.d.ts
generated
vendored
2
node_modules/@types/semver/functions/compare-loose.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
declare function compareLoose(v1: string | SemVer, v2: string | SemVer): 1 | 0 | -1;
|
||||
|
||||
|
||||
4
node_modules/@types/semver/functions/compare.d.ts
generated
vendored
4
node_modules/@types/semver/functions/compare.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
/**
|
||||
* Compares two versions excluding build identifiers (the bit after `+` in the semantic version string).
|
||||
|
||||
4
node_modules/@types/semver/functions/diff.d.ts
generated
vendored
4
node_modules/@types/semver/functions/diff.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
|
||||
/**
|
||||
* Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same.
|
||||
|
||||
4
node_modules/@types/semver/functions/eq.d.ts
generated
vendored
4
node_modules/@types/semver/functions/eq.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
|
||||
|
||||
4
node_modules/@types/semver/functions/gt.d.ts
generated
vendored
4
node_modules/@types/semver/functions/gt.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 > v2
|
||||
|
||||
4
node_modules/@types/semver/functions/gte.d.ts
generated
vendored
4
node_modules/@types/semver/functions/gte.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 >= v2
|
||||
|
||||
8
node_modules/@types/semver/functions/inc.d.ts
generated
vendored
8
node_modules/@types/semver/functions/inc.d.ts
generated
vendored
@@ -1,9 +1,9 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
declare namespace inc {
|
||||
/** Base number to be used for the prerelease identifier */
|
||||
type IdentifierBase = '0' | '1';
|
||||
type IdentifierBase = "0" | "1";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ declare function inc(
|
||||
version: string | SemVer,
|
||||
release: semver.ReleaseType,
|
||||
optionsOrLoose?: boolean | semver.Options,
|
||||
identifier?: string
|
||||
identifier?: string,
|
||||
): string | null;
|
||||
declare function inc(
|
||||
version: string | SemVer,
|
||||
|
||||
4
node_modules/@types/semver/functions/lt.d.ts
generated
vendored
4
node_modules/@types/semver/functions/lt.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 < v2
|
||||
|
||||
4
node_modules/@types/semver/functions/lte.d.ts
generated
vendored
4
node_modules/@types/semver/functions/lte.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 <= v2
|
||||
|
||||
4
node_modules/@types/semver/functions/major.d.ts
generated
vendored
4
node_modules/@types/semver/functions/major.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the major version number.
|
||||
|
||||
4
node_modules/@types/semver/functions/minor.d.ts
generated
vendored
4
node_modules/@types/semver/functions/minor.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the minor version number.
|
||||
|
||||
4
node_modules/@types/semver/functions/neq.d.ts
generated
vendored
4
node_modules/@types/semver/functions/neq.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* v1 != v2 The opposite of eq.
|
||||
|
||||
4
node_modules/@types/semver/functions/parse.d.ts
generated
vendored
4
node_modules/@types/semver/functions/parse.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the parsed version as a SemVer object, or null if it's not valid.
|
||||
|
||||
4
node_modules/@types/semver/functions/patch.d.ts
generated
vendored
4
node_modules/@types/semver/functions/patch.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the patch version number.
|
||||
|
||||
4
node_modules/@types/semver/functions/prerelease.d.ts
generated
vendored
4
node_modules/@types/semver/functions/prerelease.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Returns an array of prerelease components, or null if none exist.
|
||||
|
||||
4
node_modules/@types/semver/functions/rcompare.d.ts
generated
vendored
4
node_modules/@types/semver/functions/rcompare.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* The reverse of compare.
|
||||
|
||||
4
node_modules/@types/semver/functions/rsort.d.ts
generated
vendored
4
node_modules/@types/semver/functions/rsort.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Sorts an array of semver entries in descending order using `compareBuild()`.
|
||||
|
||||
6
node_modules/@types/semver/functions/satisfies.d.ts
generated
vendored
6
node_modules/@types/semver/functions/satisfies.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if the version satisfies the range.
|
||||
|
||||
4
node_modules/@types/semver/functions/sort.d.ts
generated
vendored
4
node_modules/@types/semver/functions/sort.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Sorts an array of semver entries in ascending order using `compareBuild()`.
|
||||
|
||||
4
node_modules/@types/semver/functions/valid.d.ts
generated
vendored
4
node_modules/@types/semver/functions/valid.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import semver = require('../index');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require("../index");
|
||||
import SemVer = require("../classes/semver");
|
||||
/**
|
||||
* Return the parsed version as a string, or null if it's not valid.
|
||||
*/
|
||||
|
||||
126
node_modules/@types/semver/index.d.ts
generated
vendored
126
node_modules/@types/semver/index.d.ts
generated
vendored
@@ -11,107 +11,107 @@
|
||||
// re-exports for index file
|
||||
|
||||
// functions for working with versions
|
||||
import semverParse = require('./functions/parse');
|
||||
import semverValid = require('./functions/valid');
|
||||
import semverClean = require('./functions/clean');
|
||||
import semverInc = require('./functions/inc');
|
||||
import semverDiff = require('./functions/diff');
|
||||
import semverMajor = require('./functions/major');
|
||||
import semverMinor = require('./functions/minor');
|
||||
import semverPatch = require('./functions/patch');
|
||||
import semverPrerelease = require('./functions/prerelease');
|
||||
import semverCompare = require('./functions/compare');
|
||||
import semverRcompare = require('./functions/rcompare');
|
||||
import semverCompareLoose = require('./functions/compare-loose');
|
||||
import semverCompareBuild = require('./functions/compare-build');
|
||||
import semverSort = require('./functions/sort');
|
||||
import semverRsort = require('./functions/rsort');
|
||||
import semverParse = require("./functions/parse");
|
||||
import semverValid = require("./functions/valid");
|
||||
import semverClean = require("./functions/clean");
|
||||
import semverInc = require("./functions/inc");
|
||||
import semverDiff = require("./functions/diff");
|
||||
import semverMajor = require("./functions/major");
|
||||
import semverMinor = require("./functions/minor");
|
||||
import semverPatch = require("./functions/patch");
|
||||
import semverPrerelease = require("./functions/prerelease");
|
||||
import semverCompare = require("./functions/compare");
|
||||
import semverRcompare = require("./functions/rcompare");
|
||||
import semverCompareLoose = require("./functions/compare-loose");
|
||||
import semverCompareBuild = require("./functions/compare-build");
|
||||
import semverSort = require("./functions/sort");
|
||||
import semverRsort = require("./functions/rsort");
|
||||
|
||||
export {
|
||||
semverParse as parse,
|
||||
semverValid as valid,
|
||||
semverClean as clean,
|
||||
semverInc as inc,
|
||||
semverCompare as compare,
|
||||
semverCompareBuild as compareBuild,
|
||||
semverCompareLoose as compareLoose,
|
||||
semverDiff as diff,
|
||||
semverInc as inc,
|
||||
semverMajor as major,
|
||||
semverMinor as minor,
|
||||
semverParse as parse,
|
||||
semverPatch as patch,
|
||||
semverPrerelease as prerelease,
|
||||
semverCompare as compare,
|
||||
semverRcompare as rcompare,
|
||||
semverCompareLoose as compareLoose,
|
||||
semverCompareBuild as compareBuild,
|
||||
semverSort as sort,
|
||||
semverRsort as rsort,
|
||||
semverSort as sort,
|
||||
semverValid as valid,
|
||||
};
|
||||
|
||||
// low-level comparators between versions
|
||||
import semverGt = require('./functions/gt');
|
||||
import semverLt = require('./functions/lt');
|
||||
import semverEq = require('./functions/eq');
|
||||
import semverNeq = require('./functions/neq');
|
||||
import semverGte = require('./functions/gte');
|
||||
import semverLte = require('./functions/lte');
|
||||
import semverCmp = require('./functions/cmp');
|
||||
import semverCoerce = require('./functions/coerce');
|
||||
import semverGt = require("./functions/gt");
|
||||
import semverLt = require("./functions/lt");
|
||||
import semverEq = require("./functions/eq");
|
||||
import semverNeq = require("./functions/neq");
|
||||
import semverGte = require("./functions/gte");
|
||||
import semverLte = require("./functions/lte");
|
||||
import semverCmp = require("./functions/cmp");
|
||||
import semverCoerce = require("./functions/coerce");
|
||||
|
||||
export {
|
||||
semverGt as gt,
|
||||
semverLt as lt,
|
||||
semverEq as eq,
|
||||
semverNeq as neq,
|
||||
semverGte as gte,
|
||||
semverLte as lte,
|
||||
semverCmp as cmp,
|
||||
semverCoerce as coerce,
|
||||
semverEq as eq,
|
||||
semverGt as gt,
|
||||
semverGte as gte,
|
||||
semverLt as lt,
|
||||
semverLte as lte,
|
||||
semverNeq as neq,
|
||||
};
|
||||
|
||||
// working with ranges
|
||||
import semverSatisfies = require('./functions/satisfies');
|
||||
import semverMaxSatisfying = require('./ranges/max-satisfying');
|
||||
import semverMinSatisfying = require('./ranges/min-satisfying');
|
||||
import semverToComparators = require('./ranges/to-comparators');
|
||||
import semverMinVersion = require('./ranges/min-version');
|
||||
import semverValidRange = require('./ranges/valid');
|
||||
import semverOutside = require('./ranges/outside');
|
||||
import semverGtr = require('./ranges/gtr');
|
||||
import semverLtr = require('./ranges/ltr');
|
||||
import semverIntersects = require('./ranges/intersects');
|
||||
import simplify = require('./ranges/simplify');
|
||||
import rangeSubset = require('./ranges/subset');
|
||||
import semverSatisfies = require("./functions/satisfies");
|
||||
import semverMaxSatisfying = require("./ranges/max-satisfying");
|
||||
import semverMinSatisfying = require("./ranges/min-satisfying");
|
||||
import semverToComparators = require("./ranges/to-comparators");
|
||||
import semverMinVersion = require("./ranges/min-version");
|
||||
import semverValidRange = require("./ranges/valid");
|
||||
import semverOutside = require("./ranges/outside");
|
||||
import semverGtr = require("./ranges/gtr");
|
||||
import semverLtr = require("./ranges/ltr");
|
||||
import semverIntersects = require("./ranges/intersects");
|
||||
import simplify = require("./ranges/simplify");
|
||||
import rangeSubset = require("./ranges/subset");
|
||||
|
||||
export {
|
||||
semverSatisfies as satisfies,
|
||||
rangeSubset as subset,
|
||||
semverGtr as gtr,
|
||||
semverIntersects as intersects,
|
||||
semverLtr as ltr,
|
||||
semverMaxSatisfying as maxSatisfying,
|
||||
semverMinSatisfying as minSatisfying,
|
||||
semverToComparators as toComparators,
|
||||
semverMinVersion as minVersion,
|
||||
semverValidRange as validRange,
|
||||
semverOutside as outside,
|
||||
semverGtr as gtr,
|
||||
semverLtr as ltr,
|
||||
semverIntersects as intersects,
|
||||
semverSatisfies as satisfies,
|
||||
semverToComparators as toComparators,
|
||||
semverValidRange as validRange,
|
||||
simplify as simplifyRange,
|
||||
rangeSubset as subset,
|
||||
};
|
||||
|
||||
// classes
|
||||
import SemVer = require('./classes/semver');
|
||||
import Range = require('./classes/range');
|
||||
import Comparator = require('./classes/comparator');
|
||||
import SemVer = require("./classes/semver");
|
||||
import Range = require("./classes/range");
|
||||
import Comparator = require("./classes/comparator");
|
||||
|
||||
export { SemVer, Range, Comparator };
|
||||
export { Comparator, Range, SemVer };
|
||||
|
||||
// internals
|
||||
import identifiers = require('./internals/identifiers');
|
||||
import identifiers = require("./internals/identifiers");
|
||||
export import compareIdentifiers = identifiers.compareIdentifiers;
|
||||
export import rcompareIdentifiers = identifiers.rcompareIdentifiers;
|
||||
|
||||
export const SEMVER_SPEC_VERSION: '2.0.0';
|
||||
export const SEMVER_SPEC_VERSION: "2.0.0";
|
||||
|
||||
export const RELEASE_TYPES: ReleaseType[];
|
||||
|
||||
export type ReleaseType = 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease';
|
||||
export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease";
|
||||
|
||||
export interface Options {
|
||||
loose?: boolean | undefined;
|
||||
@@ -135,4 +135,4 @@ export interface CoerceOptions extends Options {
|
||||
rtl?: boolean | undefined;
|
||||
}
|
||||
|
||||
export type Operator = '===' | '!==' | '' | '=' | '==' | '!=' | '>' | '>=' | '<' | '<=';
|
||||
export type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<=";
|
||||
|
||||
4
node_modules/@types/semver/package.json
generated
vendored
4
node_modules/@types/semver/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@types/semver",
|
||||
"version": "7.5.2",
|
||||
"version": "7.5.3",
|
||||
"description": "TypeScript definitions for semver",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver",
|
||||
"license": "MIT",
|
||||
@@ -45,6 +45,6 @@
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "82353707fa0620975ca147a80b51777ddd4978164cbf2da1b37183ba8840b04c",
|
||||
"typesPublisherContentHash": "899f87e0aba8e7570c139c1d8aa9356942a2d5e12f7612a3ca18ec2f39ef67cd",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
||||
2
node_modules/@types/semver/preload.d.ts
generated
vendored
2
node_modules/@types/semver/preload.d.ts
generated
vendored
@@ -1,2 +1,2 @@
|
||||
import semver = require('.');
|
||||
import semver = require(".");
|
||||
export = semver;
|
||||
|
||||
6
node_modules/@types/semver/ranges/gtr.d.ts
generated
vendored
6
node_modules/@types/semver/ranges/gtr.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if version is greater than all the versions possible in the range.
|
||||
|
||||
4
node_modules/@types/semver/ranges/intersects.d.ts
generated
vendored
4
node_modules/@types/semver/ranges/intersects.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if any of the ranges comparators intersect
|
||||
|
||||
6
node_modules/@types/semver/ranges/ltr.d.ts
generated
vendored
6
node_modules/@types/semver/ranges/ltr.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if version is less than all the versions possible in the range.
|
||||
|
||||
6
node_modules/@types/semver/ranges/max-satisfying.d.ts
generated
vendored
6
node_modules/@types/semver/ranges/max-satisfying.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the highest version in the list that satisfies the range, or null if none of them do.
|
||||
|
||||
6
node_modules/@types/semver/ranges/min-satisfying.d.ts
generated
vendored
6
node_modules/@types/semver/ranges/min-satisfying.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the lowest version in the list that satisfies the range, or null if none of them do.
|
||||
|
||||
6
node_modules/@types/semver/ranges/min-version.d.ts
generated
vendored
6
node_modules/@types/semver/ranges/min-version.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the lowest version that can possibly match the given range.
|
||||
|
||||
8
node_modules/@types/semver/ranges/outside.d.ts
generated
vendored
8
node_modules/@types/semver/ranges/outside.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import Range = require('../classes/range');
|
||||
import SemVer = require('../classes/semver');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import SemVer = require("../classes/semver");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if the version is outside the bounds of the range in either the high or low direction.
|
||||
@@ -9,7 +9,7 @@ import semver = require('../index');
|
||||
declare function outside(
|
||||
version: string | SemVer,
|
||||
range: string | Range,
|
||||
hilo: '>' | '<',
|
||||
hilo: ">" | "<",
|
||||
optionsOrLoose?: boolean | semver.RangeOptions,
|
||||
): boolean;
|
||||
export = outside;
|
||||
|
||||
4
node_modules/@types/semver/ranges/simplify.d.ts
generated
vendored
4
node_modules/@types/semver/ranges/simplify.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return a "simplified" range that matches the same items in `versions` list as the range specified.
|
||||
|
||||
4
node_modules/@types/semver/ranges/subset.d.ts
generated
vendored
4
node_modules/@types/semver/ranges/subset.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return true if the subRange range is entirely contained by the superRange range.
|
||||
|
||||
4
node_modules/@types/semver/ranges/to-comparators.d.ts
generated
vendored
4
node_modules/@types/semver/ranges/to-comparators.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Mostly just for testing and legacy API reasons
|
||||
|
||||
4
node_modules/@types/semver/ranges/valid.d.ts
generated
vendored
4
node_modules/@types/semver/ranges/valid.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import Range = require('../classes/range');
|
||||
import semver = require('../index');
|
||||
import Range = require("../classes/range");
|
||||
import semver = require("../index");
|
||||
|
||||
/**
|
||||
* Return the valid range or null if it's not valid
|
||||
|
||||
0
node_modules/@types/sinon/LICENSE
generated
vendored
Executable file → Normal file
0
node_modules/@types/sinon/LICENSE
generated
vendored
Executable file → Normal file
2
node_modules/@types/sinon/README.md
generated
vendored
Executable file → Normal file
2
node_modules/@types/sinon/README.md
generated
vendored
Executable file → Normal file
@@ -8,7 +8,7 @@ This package contains type definitions for Sinon (https://sinonjs.org).
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinon.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 01 Aug 2023 09:02:50 GMT
|
||||
* Last updated: Mon, 25 Sep 2023 13:39:06 GMT
|
||||
* Dependencies: [@types/sinonjs__fake-timers](https://npmjs.com/package/@types/sinonjs__fake-timers)
|
||||
* Global values: `sinon`
|
||||
|
||||
|
||||
50
node_modules/@types/sinon/index.d.ts
generated
vendored
Executable file → Normal file
50
node_modules/@types/sinon/index.d.ts
generated
vendored
Executable file → Normal file
@@ -10,7 +10,7 @@
|
||||
// Mathias Schreck <https://github.com/lo1tuma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as FakeTimers from '@sinonjs/fake-timers';
|
||||
import * as FakeTimers from "@sinonjs/fake-timers";
|
||||
|
||||
// sinon uses DOM dependencies which are absent in browser-less environment like node.js
|
||||
// to avoid compiler errors this monkey patch is used
|
||||
@@ -132,7 +132,8 @@ declare namespace Sinon {
|
||||
}
|
||||
|
||||
interface SinonSpyCall<TArgs extends readonly any[] = any[], TReturnValue = any>
|
||||
extends SinonSpyCallApi<TArgs, TReturnValue> {
|
||||
extends SinonSpyCallApi<TArgs, TReturnValue>
|
||||
{
|
||||
/**
|
||||
* The call’s this value.
|
||||
*/
|
||||
@@ -164,7 +165,6 @@ declare namespace Sinon {
|
||||
/**
|
||||
* Returns true if the spy call occurred before another spy call.
|
||||
* @param call
|
||||
*
|
||||
*/
|
||||
calledBefore(call: SinonSpyCall<any>): boolean;
|
||||
/**
|
||||
@@ -174,11 +174,12 @@ declare namespace Sinon {
|
||||
calledAfter(call: SinonSpyCall<any>): boolean;
|
||||
}
|
||||
|
||||
interface SinonSpy<TArgs extends readonly any[] = any[], TReturnValue = any>
|
||||
extends Pick<
|
||||
interface SinonSpy<TArgs extends readonly any[] = any[], TReturnValue = any> extends
|
||||
Pick<
|
||||
SinonSpyCallApi<TArgs, TReturnValue>,
|
||||
Exclude<keyof SinonSpyCallApi<TArgs, TReturnValue>, 'args'>
|
||||
> {
|
||||
Exclude<keyof SinonSpyCallApi<TArgs, TReturnValue>, "args">
|
||||
>
|
||||
{
|
||||
// Properties
|
||||
/**
|
||||
* The number of recorded calls.
|
||||
@@ -386,11 +387,13 @@ declare namespace Sinon {
|
||||
* The original method can be restored by calling object.method.restore().
|
||||
* The returned spy is the function object which replaced the original method. spy === object.method.
|
||||
*/
|
||||
<T, K extends keyof T>(obj: T, method: K): T[K] extends (...args: infer TArgs) => infer TReturnValue
|
||||
? SinonSpy<TArgs, TReturnValue>
|
||||
<T, K extends keyof T>(
|
||||
obj: T,
|
||||
method: K,
|
||||
): T[K] extends (...args: infer TArgs) => infer TReturnValue ? SinonSpy<TArgs, TReturnValue>
|
||||
: SinonSpy;
|
||||
|
||||
<T, K extends keyof T>(obj: T, method: K, types: Array<'get' | 'set'>): PropertyDescriptor & {
|
||||
<T, K extends keyof T>(obj: T, method: K, types: Array<"get" | "set">): PropertyDescriptor & {
|
||||
get: SinonSpy<[], T[K]>;
|
||||
set: SinonSpy<[T[K]], void>;
|
||||
};
|
||||
@@ -400,12 +403,12 @@ declare namespace Sinon {
|
||||
[P in keyof T]: SinonSpiedMember<T[P]>;
|
||||
};
|
||||
|
||||
type SinonSpiedMember<T> = T extends (...args: infer TArgs) => infer TReturnValue
|
||||
? SinonSpy<TArgs, TReturnValue>
|
||||
type SinonSpiedMember<T> = T extends (...args: infer TArgs) => infer TReturnValue ? SinonSpy<TArgs, TReturnValue>
|
||||
: T;
|
||||
|
||||
interface SinonStub<TArgs extends readonly any[] = any[], TReturnValue = any>
|
||||
extends SinonSpy<TArgs, TReturnValue> {
|
||||
extends SinonSpy<TArgs, TReturnValue>
|
||||
{
|
||||
/**
|
||||
* Resets the stub’s behaviour to the default behaviour
|
||||
* You can reset behaviour of all stubs using sinon.resetBehavior()
|
||||
@@ -684,8 +687,10 @@ declare namespace Sinon {
|
||||
* An exception is thrown if the property is not already a function.
|
||||
* The original function can be restored by calling object.method.restore(); (or stub.restore();).
|
||||
*/
|
||||
<T, K extends keyof T>(obj: T, method: K): T[K] extends (...args: infer TArgs) => infer TReturnValue
|
||||
? SinonStub<TArgs, TReturnValue>
|
||||
<T, K extends keyof T>(
|
||||
obj: T,
|
||||
method: K,
|
||||
): T[K] extends (...args: infer TArgs) => infer TReturnValue ? SinonStub<TArgs, TReturnValue>
|
||||
: SinonStub;
|
||||
}
|
||||
|
||||
@@ -883,7 +888,7 @@ declare namespace Sinon {
|
||||
}
|
||||
|
||||
interface SinonFakeXMLHttpRequestStatic {
|
||||
new (): SinonFakeXMLHttpRequest;
|
||||
new(): SinonFakeXMLHttpRequest;
|
||||
/**
|
||||
* Default false.
|
||||
* When set to true, Sinon will check added filters if certain requests should be “unfaked”
|
||||
@@ -1470,15 +1475,16 @@ declare namespace Sinon {
|
||||
*
|
||||
* @template TType Object type being stubbed.
|
||||
*/
|
||||
type SinonStubbedInstance<TType> = TType & {
|
||||
[P in keyof TType]: SinonStubbedMember<TType[P]>;
|
||||
};
|
||||
type SinonStubbedInstance<TType> =
|
||||
& TType
|
||||
& {
|
||||
[P in keyof TType]: SinonStubbedMember<TType[P]>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a type with a Sinon stub if it's a function.
|
||||
*/
|
||||
type SinonStubbedMember<T> = T extends (...args: infer TArgs) => infer TReturnValue
|
||||
? SinonStub<TArgs, TReturnValue>
|
||||
type SinonStubbedMember<T> = T extends (...args: infer TArgs) => infer TReturnValue ? SinonStub<TArgs, TReturnValue>
|
||||
: T;
|
||||
|
||||
interface SinonFake {
|
||||
@@ -1670,7 +1676,7 @@ declare namespace Sinon {
|
||||
}
|
||||
|
||||
type SinonPromise<T> = Promise<T> & {
|
||||
status: 'pending' | 'resolved' | 'rejected';
|
||||
status: "pending" | "resolved" | "rejected";
|
||||
resolve(val: unknown): Promise<T>;
|
||||
reject(reason: unknown): Promise<void>;
|
||||
resolvedValue?: T;
|
||||
|
||||
6
node_modules/@types/sinon/package.json
generated
vendored
Executable file → Normal file
6
node_modules/@types/sinon/package.json
generated
vendored
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@types/sinon",
|
||||
"version": "10.0.16",
|
||||
"version": "10.0.17",
|
||||
"description": "TypeScript definitions for Sinon",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinon",
|
||||
"license": "MIT",
|
||||
@@ -57,6 +57,6 @@
|
||||
"dependencies": {
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "80a97a78fae8ba4177fdc4c2d9cb72ff3c90b9c29fbc7c54a1ecaa647e7128ed",
|
||||
"typeScriptVersion": "4.3"
|
||||
"typesPublisherContentHash": "2012d8a927c9716abe3aba878c235064296c06cc5d07c978bdbd9f41d013cda3",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
||||
5
node_modules/eslint-import-resolver-typescript/lib/index.cjs
generated
vendored
5
node_modules/eslint-import-resolver-typescript/lib/index.cjs
generated
vendored
@@ -5,7 +5,7 @@ var path = require('node:path');
|
||||
var debug = require('debug');
|
||||
var enhancedResolve = require('enhanced-resolve');
|
||||
var hash_js = require('eslint-module-utils/hash.js');
|
||||
var fastGlob = require('fast-glob');
|
||||
var fg = require('fast-glob');
|
||||
var getTsconfig = require('get-tsconfig');
|
||||
var isCore = require('is-core-module');
|
||||
var isGlob = require('is-glob');
|
||||
@@ -29,6 +29,7 @@ var __spreadValues = (a, b) => {
|
||||
return a;
|
||||
};
|
||||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||||
const { globSync } = fg;
|
||||
const IMPORTER_NAME = "eslint-import-resolver-typescript";
|
||||
const log = debug(IMPORTER_NAME);
|
||||
const defaultConditionNames = [
|
||||
@@ -244,7 +245,7 @@ function initMappers(options) {
|
||||
const projectPaths = [
|
||||
.../* @__PURE__ */ new Set([
|
||||
...configPaths.filter((path2) => !isGlob(path2)),
|
||||
...fastGlob.sync([...configPaths.filter((path2) => isGlob(path2)), ...ignore])
|
||||
...globSync([...configPaths.filter((path2) => isGlob(path2)), ...ignore])
|
||||
])
|
||||
];
|
||||
mappers = projectPaths.map((projectPath) => {
|
||||
|
||||
5
node_modules/eslint-import-resolver-typescript/lib/index.es2020.mjs
generated
vendored
5
node_modules/eslint-import-resolver-typescript/lib/index.es2020.mjs
generated
vendored
@@ -3,11 +3,12 @@ import path from 'node:path';
|
||||
import debug from 'debug';
|
||||
import enhancedResolve from 'enhanced-resolve';
|
||||
import { hashObject } from 'eslint-module-utils/hash.js';
|
||||
import { sync } from 'fast-glob';
|
||||
import fg from 'fast-glob';
|
||||
import { getTsconfig, createPathsMatcher } from 'get-tsconfig';
|
||||
import isCore from 'is-core-module';
|
||||
import isGlob from 'is-glob';
|
||||
|
||||
const { globSync } = fg;
|
||||
const IMPORTER_NAME = "eslint-import-resolver-typescript";
|
||||
const log = debug(IMPORTER_NAME);
|
||||
const defaultConditionNames = [
|
||||
@@ -222,7 +223,7 @@ function initMappers(options) {
|
||||
const projectPaths = [
|
||||
.../* @__PURE__ */ new Set([
|
||||
...configPaths.filter((path2) => !isGlob(path2)),
|
||||
...sync([...configPaths.filter((path2) => isGlob(path2)), ...ignore])
|
||||
...globSync([...configPaths.filter((path2) => isGlob(path2)), ...ignore])
|
||||
])
|
||||
];
|
||||
mappers = projectPaths.map((projectPath) => {
|
||||
|
||||
3
node_modules/eslint-import-resolver-typescript/lib/index.js
generated
vendored
3
node_modules/eslint-import-resolver-typescript/lib/index.js
generated
vendored
@@ -3,10 +3,11 @@ import path from 'node:path';
|
||||
import debug from 'debug';
|
||||
import enhancedResolve from 'enhanced-resolve';
|
||||
import { hashObject } from 'eslint-module-utils/hash.js';
|
||||
import { sync as globSync } from 'fast-glob';
|
||||
import fg from 'fast-glob';
|
||||
import { createPathsMatcher, getTsconfig } from 'get-tsconfig';
|
||||
import isCore from 'is-core-module';
|
||||
import isGlob from 'is-glob';
|
||||
const { globSync } = fg;
|
||||
const IMPORTER_NAME = 'eslint-import-resolver-typescript';
|
||||
const log = debug(IMPORTER_NAME);
|
||||
export const defaultConditionNames = [
|
||||
|
||||
2
node_modules/eslint-import-resolver-typescript/lib/index.js.map
generated
vendored
2
node_modules/eslint-import-resolver-typescript/lib/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/eslint-import-resolver-typescript/package.json
generated
vendored
8
node_modules/eslint-import-resolver-typescript/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint-import-resolver-typescript",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"type": "module",
|
||||
"description": "This plugin adds `TypeScript` support to `eslint-plugin-import`",
|
||||
"repository": "git+https://github.com/import-js/eslint-import-resolver-typescript",
|
||||
@@ -10,7 +10,7 @@
|
||||
],
|
||||
"funding": "https://opencollective.com/unts/projects/eslint-import-resolver-ts",
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@8.0.0",
|
||||
"packageManager": "pnpm@8.7.6",
|
||||
"engines": {
|
||||
"node": "^14.18.0 || >=16.0.0"
|
||||
},
|
||||
@@ -57,13 +57,13 @@
|
||||
"devDependencies": {
|
||||
"@1stg/lib-config": "^11.0.1",
|
||||
"@changesets/changelog-github": "^0.4.8",
|
||||
"@changesets/cli": "^2.26.1",
|
||||
"@changesets/cli": "^2.26.2",
|
||||
"@mozilla/glean": "^1.3.0",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/is-core-module": "^2.2.0",
|
||||
"@types/is-glob": "^4.0.2",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/unist": "^2.0.6",
|
||||
"@types/unist": "^2.0.8",
|
||||
"dummy.js": "link:dummy.js",
|
||||
"react": "^18.2.0",
|
||||
"size-limit": "^8.2.4",
|
||||
|
||||
2
node_modules/eslint/README.md
generated
vendored
2
node_modules/eslint/README.md
generated
vendored
@@ -289,7 +289,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
||||
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://github.com/about"><img src="https://avatars.githubusercontent.com/u/9919?v=4" alt="GitHub" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
|
||||
## Technology Sponsors
|
||||
|
||||
12
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
12
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
@@ -507,7 +507,7 @@ const eslintrcKeys = [
|
||||
// Full schema
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
exports.flatConfigSchema = {
|
||||
const flatConfigSchema = {
|
||||
|
||||
// eslintrc-style keys that should always error
|
||||
...Object.fromEntries(eslintrcKeys.map(key => [key, createEslintrcErrorSchema(key)])),
|
||||
@@ -533,3 +533,13 @@ exports.flatConfigSchema = {
|
||||
plugins: pluginsSchema,
|
||||
rules: rulesSchema
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
flatConfigSchema,
|
||||
assertIsRuleSeverity,
|
||||
assertIsRuleOptions
|
||||
};
|
||||
|
||||
231
node_modules/eslint/lib/linter/linter.js
generated
vendored
231
node_modules/eslint/lib/linter/linter.js
generated
vendored
@@ -42,7 +42,8 @@ const
|
||||
ruleReplacements = require("../../conf/replacements.json");
|
||||
const { getRuleFromConfig } = require("../config/flat-config-helpers");
|
||||
const { FlatConfigArray } = require("../config/flat-config-array");
|
||||
|
||||
const { RuleValidator } = require("../config/rule-validator");
|
||||
const { assertIsRuleOptions, assertIsRuleSeverity } = require("../config/flat-config-schema");
|
||||
const debug = require("debug")("eslint:linter");
|
||||
const MAX_AUTOFIX_PASSES = 10;
|
||||
const DEFAULT_PARSER_NAME = "espree";
|
||||
@@ -50,7 +51,6 @@ const DEFAULT_ECMA_VERSION = 5;
|
||||
const commentParser = new ConfigCommentParser();
|
||||
const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } };
|
||||
const parserSymbol = Symbol.for("eslint.RuleTester.parser");
|
||||
const globals = require("../../conf/globals");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
@@ -145,29 +145,6 @@ function isEspree(parser) {
|
||||
return !!(parser === espree || parser[parserSymbol] === espree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves globals for the given ecmaVersion.
|
||||
* @param {number} ecmaVersion The version to retrieve globals for.
|
||||
* @returns {Object} The globals for the given ecmaVersion.
|
||||
*/
|
||||
function getGlobalsForEcmaVersion(ecmaVersion) {
|
||||
|
||||
switch (ecmaVersion) {
|
||||
case 3:
|
||||
return globals.es3;
|
||||
|
||||
case 5:
|
||||
return globals.es5;
|
||||
|
||||
default:
|
||||
if (ecmaVersion < 2015) {
|
||||
return globals[`es${ecmaVersion + 2009}`];
|
||||
}
|
||||
|
||||
return globals[`es${ecmaVersion}`];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that variables representing built-in properties of the Global Object,
|
||||
* and any globals declared by special block comments, are present in the global
|
||||
@@ -361,13 +338,13 @@ function extractDirectiveComment(value) {
|
||||
* Parses comments in file to extract file-specific config of rules, globals
|
||||
* and environments and merges them with global config; also code blocks
|
||||
* where reporting is disabled or enabled and merges them with reporting config.
|
||||
* @param {ASTNode} ast The top node of the AST.
|
||||
* @param {SourceCode} sourceCode The SourceCode object to get comments from.
|
||||
* @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
|
||||
* @param {string|null} warnInlineConfig If a string then it should warn directive comments as disabled. The string value is the config name what the setting came from.
|
||||
* @returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: LintMessage[], disableDirectives: DisableDirective[]}}
|
||||
* A collection of the directive comments that were found, along with any problems that occurred when parsing
|
||||
*/
|
||||
function getDirectiveComments(ast, ruleMapper, warnInlineConfig) {
|
||||
function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig) {
|
||||
const configuredRules = {};
|
||||
const enabledGlobals = Object.create(null);
|
||||
const exportedVariables = {};
|
||||
@@ -377,7 +354,7 @@ function getDirectiveComments(ast, ruleMapper, warnInlineConfig) {
|
||||
builtInRules: Rules
|
||||
});
|
||||
|
||||
ast.comments.filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
@@ -511,6 +488,69 @@ function getDirectiveComments(ast, ruleMapper, warnInlineConfig) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses comments in file to extract disable directives.
|
||||
* @param {SourceCode} sourceCode The SourceCode object to get comments from.
|
||||
* @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
|
||||
* @returns {{problems: LintMessage[], disableDirectives: DisableDirective[]}}
|
||||
* A collection of the directive comments that were found, along with any problems that occurred when parsing
|
||||
*/
|
||||
function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper) {
|
||||
const problems = [];
|
||||
const disableDirectives = [];
|
||||
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
const directiveText = match[1];
|
||||
const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(directiveText);
|
||||
|
||||
if (comment.type === "Line" && !lineCommentSupported) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) {
|
||||
const message = `${directiveText} comment should not span multiple lines.`;
|
||||
|
||||
problems.push(createLintingProblem({
|
||||
ruleId: null,
|
||||
message,
|
||||
loc: comment.loc
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
const directiveValue = directivePart.slice(match.index + directiveText.length);
|
||||
|
||||
switch (directiveText) {
|
||||
case "eslint-disable":
|
||||
case "eslint-enable":
|
||||
case "eslint-disable-next-line":
|
||||
case "eslint-disable-line": {
|
||||
const directiveType = directiveText.slice("eslint-".length);
|
||||
const options = { commentToken: comment, type: directiveType, value: directiveValue, justification: justificationPart, ruleMapper };
|
||||
const { directives, directiveProblems } = createDisableDirectives(options);
|
||||
|
||||
disableDirectives.push(...directives);
|
||||
problems.push(...directiveProblems);
|
||||
break;
|
||||
}
|
||||
|
||||
// no default
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
problems,
|
||||
disableDirectives
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize ECMAScript version from the initial config
|
||||
* @param {Parser} parser The parser which uses this options.
|
||||
@@ -1313,7 +1353,7 @@ class Linter {
|
||||
|
||||
const sourceCode = slots.lastSourceCode;
|
||||
const commentDirectives = options.allowInlineConfig
|
||||
? getDirectiveComments(sourceCode.ast, ruleId => getRule(slots, ruleId), options.warnInlineConfig)
|
||||
? getDirectiveComments(sourceCode, ruleId => getRule(slots, ruleId), options.warnInlineConfig)
|
||||
: { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] };
|
||||
|
||||
// augment global scope with declared global variables
|
||||
@@ -1324,7 +1364,6 @@ class Linter {
|
||||
);
|
||||
|
||||
const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules);
|
||||
|
||||
let lintingProblems;
|
||||
|
||||
try {
|
||||
@@ -1540,19 +1579,6 @@ class Linter {
|
||||
languageOptions.ecmaVersion
|
||||
);
|
||||
|
||||
/*
|
||||
* add configured globals and language globals
|
||||
*
|
||||
* using Object.assign instead of object spread for performance reasons
|
||||
* https://github.com/eslint/eslint/issues/16302
|
||||
*/
|
||||
const configuredGlobals = Object.assign(
|
||||
{},
|
||||
getGlobalsForEcmaVersion(languageOptions.ecmaVersion),
|
||||
languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0,
|
||||
languageOptions.globals
|
||||
);
|
||||
|
||||
// double check that there is a parser to avoid mysterious error messages
|
||||
if (!languageOptions.parser) {
|
||||
throw new TypeError(`No parser specified for ${options.filename}`);
|
||||
@@ -1608,25 +1634,113 @@ class Linter {
|
||||
}
|
||||
|
||||
const sourceCode = slots.lastSourceCode;
|
||||
const commentDirectives = options.allowInlineConfig
|
||||
? getDirectiveComments(
|
||||
sourceCode.ast,
|
||||
ruleId => getRuleFromConfig(ruleId, config),
|
||||
options.warnInlineConfig
|
||||
|
||||
/*
|
||||
* Make adjustments based on the language options. For JavaScript,
|
||||
* this is primarily about adding variables into the global scope
|
||||
* to account for ecmaVersion and configured globals.
|
||||
*/
|
||||
sourceCode.applyLanguageOptions(languageOptions);
|
||||
|
||||
const mergedInlineConfig = {
|
||||
rules: {}
|
||||
};
|
||||
const inlineConfigProblems = [];
|
||||
|
||||
/*
|
||||
* Inline config can be either enabled or disabled. If disabled, it's possible
|
||||
* to detect the inline config and emit a warning (though this is not required).
|
||||
* So we first check to see if inline config is allowed at all, and if so, we
|
||||
* need to check if it's a warning or not.
|
||||
*/
|
||||
if (options.allowInlineConfig) {
|
||||
|
||||
// if inline config should warn then add the warnings
|
||||
if (options.warnInlineConfig) {
|
||||
sourceCode.getInlineConfigNodes().forEach(node => {
|
||||
inlineConfigProblems.push(createLintingProblem({
|
||||
ruleId: null,
|
||||
message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`,
|
||||
loc: node.loc,
|
||||
severity: 1
|
||||
}));
|
||||
|
||||
});
|
||||
} else {
|
||||
const inlineConfigResult = sourceCode.applyInlineConfig();
|
||||
|
||||
inlineConfigProblems.push(
|
||||
...inlineConfigResult.problems
|
||||
.map(createLintingProblem)
|
||||
.map(problem => {
|
||||
problem.fatal = true;
|
||||
return problem;
|
||||
})
|
||||
);
|
||||
|
||||
// next we need to verify information about the specified rules
|
||||
const ruleValidator = new RuleValidator();
|
||||
|
||||
for (const { config: inlineConfig, node } of inlineConfigResult.configs) {
|
||||
|
||||
Object.keys(inlineConfig.rules).forEach(ruleId => {
|
||||
const rule = getRuleFromConfig(ruleId, config);
|
||||
const ruleValue = inlineConfig.rules[ruleId];
|
||||
|
||||
if (!rule) {
|
||||
inlineConfigProblems.push(createLintingProblem({ ruleId, loc: node.loc }));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue];
|
||||
|
||||
assertIsRuleOptions(ruleId, ruleValue);
|
||||
assertIsRuleSeverity(ruleId, ruleOptions[0]);
|
||||
|
||||
ruleValidator.validate({
|
||||
plugins: config.plugins,
|
||||
rules: {
|
||||
[ruleId]: ruleOptions
|
||||
}
|
||||
});
|
||||
mergedInlineConfig.rules[ruleId] = ruleValue;
|
||||
} catch (err) {
|
||||
|
||||
let baseMessage = err.message.slice(
|
||||
err.message.startsWith("Key \"rules\":")
|
||||
? err.message.indexOf(":", 12) + 1
|
||||
: err.message.indexOf(":") + 1
|
||||
).trim();
|
||||
|
||||
if (err.messageTemplate) {
|
||||
baseMessage += ` You passed "${ruleValue}".`;
|
||||
}
|
||||
|
||||
inlineConfigProblems.push(createLintingProblem({
|
||||
ruleId,
|
||||
message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`,
|
||||
loc: node.loc
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const commentDirectives = options.allowInlineConfig && !options.warnInlineConfig
|
||||
? getDirectiveCommentsForFlatConfig(
|
||||
sourceCode,
|
||||
ruleId => getRuleFromConfig(ruleId, config)
|
||||
)
|
||||
: { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] };
|
||||
|
||||
// augment global scope with declared global variables
|
||||
addDeclaredGlobals(
|
||||
sourceCode.scopeManager.scopes[0],
|
||||
configuredGlobals,
|
||||
{ exportedVariables: commentDirectives.exportedVariables, enabledGlobals: commentDirectives.enabledGlobals }
|
||||
);
|
||||
|
||||
const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules);
|
||||
: { problems: [], disableDirectives: [] };
|
||||
|
||||
const configuredRules = Object.assign({}, config.rules, mergedInlineConfig.rules);
|
||||
let lintingProblems;
|
||||
|
||||
sourceCode.finalize();
|
||||
|
||||
try {
|
||||
lintingProblems = runRules(
|
||||
sourceCode,
|
||||
@@ -1667,6 +1781,7 @@ class Linter {
|
||||
disableFixes: options.disableFixes,
|
||||
problems: lintingProblems
|
||||
.concat(commentDirectives.problems)
|
||||
.concat(inlineConfigProblems)
|
||||
.sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column),
|
||||
reportUnusedDisableDirectives: options.reportUnusedDisableDirectives
|
||||
});
|
||||
|
||||
55
node_modules/eslint/lib/rule-tester/flat-rule-tester.js
generated
vendored
55
node_modules/eslint/lib/rule-tester/flat-rule-tester.js
generated
vendored
@@ -133,6 +133,15 @@ const suggestionObjectParameters = new Set([
|
||||
]);
|
||||
const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`;
|
||||
|
||||
const forbiddenMethods = [
|
||||
"applyInlineConfig",
|
||||
"applyLanguageOptions",
|
||||
"finalize"
|
||||
];
|
||||
|
||||
/** @type {Map<string,WeakSet>} */
|
||||
const forbiddenMethodCalls = new Map(forbiddenMethods.map(methodName => ([methodName, new WeakSet()])));
|
||||
|
||||
const hasOwnProperty = Function.call.bind(Object.hasOwnProperty);
|
||||
|
||||
/**
|
||||
@@ -291,6 +300,34 @@ function emitCodePathCurrentSegmentsWarning(ruleName) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to replace forbidden `SourceCode` methods. Allows just one call per method.
|
||||
* @param {string} methodName The name of the method to forbid.
|
||||
* @param {Function} prototype The prototype with the original method to call.
|
||||
* @returns {Function} The function that throws the error.
|
||||
*/
|
||||
function throwForbiddenMethodError(methodName, prototype) {
|
||||
|
||||
const original = prototype[methodName];
|
||||
|
||||
return function(...args) {
|
||||
|
||||
const called = forbiddenMethodCalls.get(methodName);
|
||||
|
||||
/* eslint-disable no-invalid-this -- needed to operate as a method. */
|
||||
if (!called.has(this)) {
|
||||
called.add(this);
|
||||
|
||||
return original.apply(this, args);
|
||||
}
|
||||
/* eslint-enable no-invalid-this -- not needed past this point */
|
||||
|
||||
throw new Error(
|
||||
`\`SourceCode#${methodName}()\` cannot be called inside a rule.`
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -498,6 +535,7 @@ class FlatRuleTester {
|
||||
}
|
||||
|
||||
const baseConfig = [
|
||||
{ files: ["**"] }, // Make sure the default config matches for all files
|
||||
{
|
||||
plugins: {
|
||||
|
||||
@@ -679,11 +717,6 @@ class FlatRuleTester {
|
||||
}
|
||||
}
|
||||
|
||||
// Verify the code.
|
||||
const { getComments } = SourceCode.prototype;
|
||||
const originalCurrentSegments = Object.getOwnPropertyDescriptor(CodePath.prototype, "currentSegments");
|
||||
let messages;
|
||||
|
||||
// check for validation errors
|
||||
try {
|
||||
configs.normalizeSync();
|
||||
@@ -693,6 +726,11 @@ class FlatRuleTester {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Verify the code.
|
||||
const { getComments, applyLanguageOptions, applyInlineConfig, finalize } = SourceCode.prototype;
|
||||
const originalCurrentSegments = Object.getOwnPropertyDescriptor(CodePath.prototype, "currentSegments");
|
||||
let messages;
|
||||
|
||||
try {
|
||||
SourceCode.prototype.getComments = getCommentsDeprecation;
|
||||
Object.defineProperty(CodePath.prototype, "currentSegments", {
|
||||
@@ -702,10 +740,17 @@ class FlatRuleTester {
|
||||
}
|
||||
});
|
||||
|
||||
forbiddenMethods.forEach(methodName => {
|
||||
SourceCode.prototype[methodName] = throwForbiddenMethodError(methodName, SourceCode.prototype);
|
||||
});
|
||||
|
||||
messages = linter.verify(code, configs, filename);
|
||||
} finally {
|
||||
SourceCode.prototype.getComments = getComments;
|
||||
Object.defineProperty(CodePath.prototype, "currentSegments", originalCurrentSegments);
|
||||
SourceCode.prototype.applyInlineConfig = applyInlineConfig;
|
||||
SourceCode.prototype.applyLanguageOptions = applyLanguageOptions;
|
||||
SourceCode.prototype.finalize = finalize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
94
node_modules/eslint/lib/rule-tester/rule-tester.js
generated
vendored
94
node_modules/eslint/lib/rule-tester/rule-tester.js
generated
vendored
@@ -163,6 +163,12 @@ const suggestionObjectParameters = new Set([
|
||||
]);
|
||||
const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`;
|
||||
|
||||
const forbiddenMethods = [
|
||||
"applyInlineConfig",
|
||||
"applyLanguageOptions",
|
||||
"finalize"
|
||||
];
|
||||
|
||||
const hasOwnProperty = Function.call.bind(Object.hasOwnProperty);
|
||||
|
||||
const DEPRECATED_SOURCECODE_PASSTHROUGHS = {
|
||||
@@ -186,7 +192,12 @@ const DEPRECATED_SOURCECODE_PASSTHROUGHS = {
|
||||
getTokens: "getTokens",
|
||||
getTokensAfter: "getTokensAfter",
|
||||
getTokensBefore: "getTokensBefore",
|
||||
getTokensBetween: "getTokensBetween"
|
||||
getTokensBetween: "getTokensBetween",
|
||||
|
||||
getScope: "getScope",
|
||||
getAncestors: "getAncestors",
|
||||
getDeclaredVariables: "getDeclaredVariables",
|
||||
markVariableAsUsed: "markVariableAsUsed"
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -330,6 +341,19 @@ function getCommentsDeprecation() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to replace forbidden `SourceCode` methods.
|
||||
* @param {string} methodName The name of the method to forbid.
|
||||
* @returns {Function} The function that throws the error.
|
||||
*/
|
||||
function throwForbiddenMethodError(methodName) {
|
||||
return () => {
|
||||
throw new Error(
|
||||
`\`SourceCode#${methodName}()\` cannot be called inside a rule.`
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a deprecation warning if function-style format is being used.
|
||||
* @param {string} ruleName Name of the rule.
|
||||
@@ -391,6 +415,22 @@ function emitCodePathCurrentSegmentsWarning(ruleName) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a deprecation warning if `context.parserServices` is used.
|
||||
* @param {string} ruleName Name of the rule.
|
||||
* @returns {void}
|
||||
*/
|
||||
function emitParserServicesWarning(ruleName) {
|
||||
if (!emitParserServicesWarning[`warned-${ruleName}`]) {
|
||||
emitParserServicesWarning[`warned-${ruleName}`] = true;
|
||||
process.emitWarning(
|
||||
`"${ruleName}" rule is using \`context.parserServices\`, which is deprecated and will be removed in ESLint v9. Please use \`sourceCode.parserServices\` instead.`,
|
||||
"DeprecationWarning"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -622,26 +662,37 @@ class RuleTester {
|
||||
freezeDeeply(context.settings);
|
||||
freezeDeeply(context.parserOptions);
|
||||
|
||||
const newContext = Object.freeze(
|
||||
Object.create(
|
||||
context,
|
||||
Object.fromEntries(Object.keys(DEPRECATED_SOURCECODE_PASSTHROUGHS).map(methodName => [
|
||||
methodName,
|
||||
{
|
||||
value(...args) {
|
||||
// wrap all deprecated methods
|
||||
const newContext = Object.create(
|
||||
context,
|
||||
Object.fromEntries(Object.keys(DEPRECATED_SOURCECODE_PASSTHROUGHS).map(methodName => [
|
||||
methodName,
|
||||
{
|
||||
value(...args) {
|
||||
|
||||
// emit deprecation warning
|
||||
emitDeprecatedContextMethodWarning(ruleName, methodName);
|
||||
// emit deprecation warning
|
||||
emitDeprecatedContextMethodWarning(ruleName, methodName);
|
||||
|
||||
// call the original method
|
||||
return context[methodName].call(this, ...args);
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
]))
|
||||
)
|
||||
// call the original method
|
||||
return context[methodName].call(this, ...args);
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
]))
|
||||
);
|
||||
|
||||
// emit warning about context.parserServices
|
||||
const parserServices = context.parserServices;
|
||||
|
||||
Object.defineProperty(newContext, "parserServices", {
|
||||
get() {
|
||||
emitParserServicesWarning(ruleName);
|
||||
return parserServices;
|
||||
}
|
||||
});
|
||||
|
||||
Object.freeze(newContext);
|
||||
|
||||
return (typeof rule === "function" ? rule : rule.create)(newContext);
|
||||
}
|
||||
}));
|
||||
@@ -761,7 +812,7 @@ class RuleTester {
|
||||
validate(config, "rule-tester", id => (id === ruleName ? rule : null));
|
||||
|
||||
// Verify the code.
|
||||
const { getComments } = SourceCode.prototype;
|
||||
const { getComments, applyLanguageOptions, applyInlineConfig, finalize } = SourceCode.prototype;
|
||||
const originalCurrentSegments = Object.getOwnPropertyDescriptor(CodePath.prototype, "currentSegments");
|
||||
let messages;
|
||||
|
||||
@@ -774,10 +825,17 @@ class RuleTester {
|
||||
}
|
||||
});
|
||||
|
||||
forbiddenMethods.forEach(methodName => {
|
||||
SourceCode.prototype[methodName] = throwForbiddenMethodError(methodName);
|
||||
});
|
||||
|
||||
messages = linter.verify(code, config, filename);
|
||||
} finally {
|
||||
SourceCode.prototype.getComments = getComments;
|
||||
Object.defineProperty(CodePath.prototype, "currentSegments", originalCurrentSegments);
|
||||
SourceCode.prototype.applyInlineConfig = applyInlineConfig;
|
||||
SourceCode.prototype.applyLanguageOptions = applyLanguageOptions;
|
||||
SourceCode.prototype.finalize = finalize;
|
||||
}
|
||||
|
||||
const fatalErrorMessage = messages.find(m => m.fatal);
|
||||
|
||||
153
node_modules/eslint/lib/rules/array-callback-return.js
generated
vendored
153
node_modules/eslint/lib/rules/array-callback-return.js
generated
vendored
@@ -136,6 +136,76 @@ function getArrayMethodName(node) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given node is a void expression.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} - `true` if the node is a void expression
|
||||
*/
|
||||
function isExpressionVoid(node) {
|
||||
return node.type === "UnaryExpression" && node.operator === "void";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes the linting error by prepending "void " to the given node
|
||||
* @param {Object} sourceCode context given by context.sourceCode
|
||||
* @param {ASTNode} node The node to fix.
|
||||
* @param {Object} fixer The fixer object provided by ESLint.
|
||||
* @returns {Array<Object>} - An array of fix objects to apply to the node.
|
||||
*/
|
||||
function voidPrependFixer(sourceCode, node, fixer) {
|
||||
|
||||
const requiresParens =
|
||||
|
||||
// prepending `void ` will fail if the node has a lower precedence than void
|
||||
astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression", operator: "void" }) &&
|
||||
|
||||
// check if there are parentheses around the node to avoid redundant parentheses
|
||||
!astUtils.isParenthesised(sourceCode, node);
|
||||
|
||||
// avoid parentheses issues
|
||||
const returnOrArrowToken = sourceCode.getTokenBefore(
|
||||
node,
|
||||
node.parent.type === "ArrowFunctionExpression"
|
||||
? astUtils.isArrowToken
|
||||
|
||||
// isReturnToken
|
||||
: token => token.type === "Keyword" && token.value === "return"
|
||||
);
|
||||
|
||||
const firstToken = sourceCode.getTokenAfter(returnOrArrowToken);
|
||||
|
||||
const prependSpace =
|
||||
|
||||
// is return token, as => allows void to be adjacent
|
||||
returnOrArrowToken.value === "return" &&
|
||||
|
||||
// If two tokens (return and "(") are adjacent
|
||||
returnOrArrowToken.range[1] === firstToken.range[0];
|
||||
|
||||
return [
|
||||
fixer.insertTextBefore(firstToken, `${prependSpace ? " " : ""}void ${requiresParens ? "(" : ""}`),
|
||||
fixer.insertTextAfter(node, requiresParens ? ")" : "")
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes the linting error by `wrapping {}` around the given node's body.
|
||||
* @param {Object} sourceCode context given by context.sourceCode
|
||||
* @param {ASTNode} node The node to fix.
|
||||
* @param {Object} fixer The fixer object provided by ESLint.
|
||||
* @returns {Array<Object>} - An array of fix objects to apply to the node.
|
||||
*/
|
||||
function curlyWrapFixer(sourceCode, node, fixer) {
|
||||
const arrowToken = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken);
|
||||
const firstToken = sourceCode.getTokenAfter(arrowToken);
|
||||
const lastToken = sourceCode.getLastToken(node);
|
||||
|
||||
return [
|
||||
fixer.insertTextBefore(firstToken, "{"),
|
||||
fixer.insertTextAfter(lastToken, "}")
|
||||
];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -151,6 +221,9 @@ module.exports = {
|
||||
url: "https://eslint.org/docs/latest/rules/array-callback-return"
|
||||
},
|
||||
|
||||
// eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- false positive
|
||||
hasSuggestions: true,
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
@@ -162,6 +235,10 @@ module.exports = {
|
||||
checkForEach: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
},
|
||||
allowVoid: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@@ -172,13 +249,15 @@ module.exports = {
|
||||
expectedAtEnd: "{{arrayMethodName}}() expects a value to be returned at the end of {{name}}.",
|
||||
expectedInside: "{{arrayMethodName}}() expects a return value from {{name}}.",
|
||||
expectedReturnValue: "{{arrayMethodName}}() expects a return value from {{name}}.",
|
||||
expectedNoReturnValue: "{{arrayMethodName}}() expects no useless return value from {{name}}."
|
||||
expectedNoReturnValue: "{{arrayMethodName}}() expects no useless return value from {{name}}.",
|
||||
wrapBraces: "Wrap the expression in `{}`.",
|
||||
prependVoid: "Prepend `void` to the expression."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
||||
const options = context.options[0] || { allowImplicit: false, checkForEach: false };
|
||||
const options = context.options[0] || { allowImplicit: false, checkForEach: false, allowVoid: false };
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
let funcInfo = {
|
||||
@@ -205,26 +284,56 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
let messageId = null;
|
||||
const messageAndSuggestions = { messageId: "", suggest: [] };
|
||||
|
||||
if (funcInfo.arrayMethodName === "forEach") {
|
||||
if (options.checkForEach && node.type === "ArrowFunctionExpression" && node.expression) {
|
||||
messageId = "expectedNoReturnValue";
|
||||
|
||||
if (options.allowVoid) {
|
||||
if (isExpressionVoid(node.body)) {
|
||||
return;
|
||||
}
|
||||
|
||||
messageAndSuggestions.messageId = "expectedNoReturnValue";
|
||||
messageAndSuggestions.suggest = [
|
||||
{
|
||||
messageId: "wrapBraces",
|
||||
fix(fixer) {
|
||||
return curlyWrapFixer(sourceCode, node, fixer);
|
||||
}
|
||||
},
|
||||
{
|
||||
messageId: "prependVoid",
|
||||
fix(fixer) {
|
||||
return voidPrependFixer(sourceCode, node.body, fixer);
|
||||
}
|
||||
}
|
||||
];
|
||||
} else {
|
||||
messageAndSuggestions.messageId = "expectedNoReturnValue";
|
||||
messageAndSuggestions.suggest = [{
|
||||
messageId: "wrapBraces",
|
||||
fix(fixer) {
|
||||
return curlyWrapFixer(sourceCode, node, fixer);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (node.body.type === "BlockStatement" && isAnySegmentReachable(funcInfo.currentSegments)) {
|
||||
messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside";
|
||||
messageAndSuggestions.messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside";
|
||||
}
|
||||
}
|
||||
|
||||
if (messageId) {
|
||||
if (messageAndSuggestions.messageId) {
|
||||
const name = astUtils.getFunctionNameWithKind(node);
|
||||
|
||||
context.report({
|
||||
node,
|
||||
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
|
||||
messageId,
|
||||
data: { name, arrayMethodName: fullMethodName(funcInfo.arrayMethodName) }
|
||||
messageId: messageAndSuggestions.messageId,
|
||||
data: { name, arrayMethodName: fullMethodName(funcInfo.arrayMethodName) },
|
||||
suggest: messageAndSuggestions.suggest.length !== 0 ? messageAndSuggestions.suggest : null
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -285,30 +394,46 @@ module.exports = {
|
||||
|
||||
funcInfo.hasReturn = true;
|
||||
|
||||
let messageId = null;
|
||||
const messageAndSuggestions = { messageId: "", suggest: [] };
|
||||
|
||||
if (funcInfo.arrayMethodName === "forEach") {
|
||||
|
||||
// if checkForEach: true, returning a value at any path inside a forEach is not allowed
|
||||
if (options.checkForEach && node.argument) {
|
||||
messageId = "expectedNoReturnValue";
|
||||
|
||||
if (options.allowVoid) {
|
||||
if (isExpressionVoid(node.argument)) {
|
||||
return;
|
||||
}
|
||||
|
||||
messageAndSuggestions.messageId = "expectedNoReturnValue";
|
||||
messageAndSuggestions.suggest = [{
|
||||
messageId: "prependVoid",
|
||||
fix(fixer) {
|
||||
return voidPrependFixer(sourceCode, node.argument, fixer);
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
messageAndSuggestions.messageId = "expectedNoReturnValue";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// if allowImplicit: false, should also check node.argument
|
||||
if (!options.allowImplicit && !node.argument) {
|
||||
messageId = "expectedReturnValue";
|
||||
messageAndSuggestions.messageId = "expectedReturnValue";
|
||||
}
|
||||
}
|
||||
|
||||
if (messageId) {
|
||||
if (messageAndSuggestions.messageId) {
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
messageId: messageAndSuggestions.messageId,
|
||||
data: {
|
||||
name: astUtils.getFunctionNameWithKind(funcInfo.node),
|
||||
arrayMethodName: fullMethodName(funcInfo.arrayMethodName)
|
||||
}
|
||||
},
|
||||
suggest: messageAndSuggestions.suggest.length !== 0 ? messageAndSuggestions.suggest : null
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
1
node_modules/eslint/lib/rules/index.js
generated
vendored
1
node_modules/eslint/lib/rules/index.js
generated
vendored
@@ -175,6 +175,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
|
||||
"no-new-wrappers": () => require("./no-new-wrappers"),
|
||||
"no-nonoctal-decimal-escape": () => require("./no-nonoctal-decimal-escape"),
|
||||
"no-obj-calls": () => require("./no-obj-calls"),
|
||||
"no-object-constructor": () => require("./no-object-constructor"),
|
||||
"no-octal": () => require("./no-octal"),
|
||||
"no-octal-escape": () => require("./no-octal-escape"),
|
||||
"no-param-reassign": () => require("./no-param-reassign"),
|
||||
|
||||
80
node_modules/eslint/lib/rules/no-misleading-character-class.js
generated
vendored
80
node_modules/eslint/lib/rules/no-misleading-character-class.js
generated
vendored
@@ -13,27 +13,34 @@ const { isValidWithUnicodeFlag } = require("./utils/regular-expressions");
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @typedef {import('@eslint-community/regexpp').AST.Character} Character
|
||||
* @typedef {import('@eslint-community/regexpp').AST.CharacterClassElement} CharacterClassElement
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate character sequences of a given nodes.
|
||||
*
|
||||
* CharacterClassRange syntax can steal a part of character sequence,
|
||||
* so this function reverts CharacterClassRange syntax and restore the sequence.
|
||||
* @param {import('@eslint-community/regexpp').AST.CharacterClassElement[]} nodes The node list to iterate character sequences.
|
||||
* @returns {IterableIterator<number[]>} The list of character sequences.
|
||||
* @param {CharacterClassElement[]} nodes The node list to iterate character sequences.
|
||||
* @returns {IterableIterator<Character[]>} The list of character sequences.
|
||||
*/
|
||||
function *iterateCharacterSequence(nodes) {
|
||||
|
||||
/** @type {Character[]} */
|
||||
let seq = [];
|
||||
|
||||
for (const node of nodes) {
|
||||
switch (node.type) {
|
||||
case "Character":
|
||||
seq.push(node.value);
|
||||
seq.push(node);
|
||||
break;
|
||||
|
||||
case "CharacterClassRange":
|
||||
seq.push(node.min.value);
|
||||
seq.push(node.min);
|
||||
yield seq;
|
||||
seq = [node.max.value];
|
||||
seq = [node.max];
|
||||
break;
|
||||
|
||||
case "CharacterSet":
|
||||
@@ -55,32 +62,74 @@ function *iterateCharacterSequence(nodes) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the given character node is a Unicode code point escape or not.
|
||||
* @param {Character} char the character node to check.
|
||||
* @returns {boolean} `true` if the character node is a Unicode code point escape.
|
||||
*/
|
||||
function isUnicodeCodePointEscape(char) {
|
||||
return /^\\u\{[\da-f]+\}$/iu.test(char.raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Each function returns `true` if it detects that kind of problem.
|
||||
* @type {Record<string, (chars: Character[]) => boolean>}
|
||||
*/
|
||||
const hasCharacterSequence = {
|
||||
surrogatePairWithoutUFlag(chars) {
|
||||
return chars.some((c, i) => i !== 0 && isSurrogatePair(chars[i - 1], c));
|
||||
return chars.some((c, i) => {
|
||||
if (i === 0) {
|
||||
return false;
|
||||
}
|
||||
const c1 = chars[i - 1];
|
||||
|
||||
return (
|
||||
isSurrogatePair(c1.value, c.value) &&
|
||||
!isUnicodeCodePointEscape(c1) &&
|
||||
!isUnicodeCodePointEscape(c)
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
surrogatePair(chars) {
|
||||
return chars.some((c, i) => {
|
||||
if (i === 0) {
|
||||
return false;
|
||||
}
|
||||
const c1 = chars[i - 1];
|
||||
|
||||
return (
|
||||
isSurrogatePair(c1.value, c.value) &&
|
||||
(
|
||||
isUnicodeCodePointEscape(c1) ||
|
||||
isUnicodeCodePointEscape(c)
|
||||
)
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
combiningClass(chars) {
|
||||
return chars.some((c, i) => (
|
||||
i !== 0 &&
|
||||
isCombiningCharacter(c) &&
|
||||
!isCombiningCharacter(chars[i - 1])
|
||||
isCombiningCharacter(c.value) &&
|
||||
!isCombiningCharacter(chars[i - 1].value)
|
||||
));
|
||||
},
|
||||
|
||||
emojiModifier(chars) {
|
||||
return chars.some((c, i) => (
|
||||
i !== 0 &&
|
||||
isEmojiModifier(c) &&
|
||||
!isEmojiModifier(chars[i - 1])
|
||||
isEmojiModifier(c.value) &&
|
||||
!isEmojiModifier(chars[i - 1].value)
|
||||
));
|
||||
},
|
||||
|
||||
regionalIndicatorSymbol(chars) {
|
||||
return chars.some((c, i) => (
|
||||
i !== 0 &&
|
||||
isRegionalIndicatorSymbol(c) &&
|
||||
isRegionalIndicatorSymbol(chars[i - 1])
|
||||
isRegionalIndicatorSymbol(c.value) &&
|
||||
isRegionalIndicatorSymbol(chars[i - 1].value)
|
||||
));
|
||||
},
|
||||
|
||||
@@ -90,9 +139,9 @@ const hasCharacterSequence = {
|
||||
return chars.some((c, i) => (
|
||||
i !== 0 &&
|
||||
i !== lastIndex &&
|
||||
c === 0x200d &&
|
||||
chars[i - 1] !== 0x200d &&
|
||||
chars[i + 1] !== 0x200d
|
||||
c.value === 0x200d &&
|
||||
chars[i - 1].value !== 0x200d &&
|
||||
chars[i + 1].value !== 0x200d
|
||||
));
|
||||
}
|
||||
};
|
||||
@@ -120,6 +169,7 @@ module.exports = {
|
||||
|
||||
messages: {
|
||||
surrogatePairWithoutUFlag: "Unexpected surrogate pair in character class. Use 'u' flag.",
|
||||
surrogatePair: "Unexpected surrogate pair in character class.",
|
||||
combiningClass: "Unexpected combined character in character class.",
|
||||
emojiModifier: "Unexpected modified Emoji in character class.",
|
||||
regionalIndicatorSymbol: "Unexpected national flag in character class.",
|
||||
|
||||
7
node_modules/eslint/lib/rules/no-new-object.js
generated
vendored
7
node_modules/eslint/lib/rules/no-new-object.js
generated
vendored
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A rule to disallow calls to the Object constructor
|
||||
* @author Matt DuVall <http://www.mattduvall.com/>
|
||||
* @deprecated in ESLint v8.50.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -26,6 +27,12 @@ module.exports = {
|
||||
url: "https://eslint.org/docs/latest/rules/no-new-object"
|
||||
},
|
||||
|
||||
deprecated: true,
|
||||
|
||||
replacedBy: [
|
||||
"no-object-constructor"
|
||||
],
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
|
||||
118
node_modules/eslint/lib/rules/no-object-constructor.js
generated
vendored
Normal file
118
node_modules/eslint/lib/rules/no-object-constructor.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @fileoverview Rule to disallow calls to the `Object` constructor without an argument
|
||||
* @author Francesco Trotta
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const { getVariableByName, isArrowToken } = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} Whether the node appears at the beginning of an ancestor ExpressionStatement node.
|
||||
*/
|
||||
function isStartOfExpressionStatement(node) {
|
||||
const start = node.range[0];
|
||||
let ancestor = node;
|
||||
|
||||
while ((ancestor = ancestor.parent) && ancestor.range[0] === start) {
|
||||
if (ancestor.type === "ExpressionStatement") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow calls to the `Object` constructor without an argument",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-object-constructor"
|
||||
},
|
||||
|
||||
hasSuggestions: true,
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
preferLiteral: "The object literal notation {} is preferable.",
|
||||
useLiteral: "Replace with '{{replacement}}'."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Determines whether or not an object literal that replaces a specified node needs to be enclosed in parentheses.
|
||||
* @param {ASTNode} node The node to be replaced.
|
||||
* @returns {boolean} Whether or not parentheses around the object literal are required.
|
||||
*/
|
||||
function needsParentheses(node) {
|
||||
if (isStartOfExpressionStatement(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const prevToken = sourceCode.getTokenBefore(node);
|
||||
|
||||
if (prevToken && isArrowToken(prevToken)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports on nodes where the `Object` constructor is called without arguments.
|
||||
* @param {ASTNode} node The node to evaluate.
|
||||
* @returns {void}
|
||||
*/
|
||||
function check(node) {
|
||||
if (node.callee.type !== "Identifier" || node.callee.name !== "Object" || node.arguments.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const variable = getVariableByName(sourceCode.getScope(node), "Object");
|
||||
|
||||
if (variable && variable.identifiers.length === 0) {
|
||||
const replacement = needsParentheses(node) ? "({})" : "{}";
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: "preferLiteral",
|
||||
suggest: [
|
||||
{
|
||||
messageId: "useLiteral",
|
||||
data: { replacement },
|
||||
fix: fixer => fixer.replaceText(node, replacement)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
CallExpression: check,
|
||||
NewExpression: check
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
353
node_modules/eslint/lib/source-code/source-code.js
generated
vendored
353
node_modules/eslint/lib/source-code/source-code.js
generated
vendored
@@ -12,7 +12,15 @@ const
|
||||
{ isCommentToken } = require("@eslint-community/eslint-utils"),
|
||||
TokenStore = require("./token-store"),
|
||||
astUtils = require("../shared/ast-utils"),
|
||||
Traverser = require("../shared/traverser");
|
||||
Traverser = require("../shared/traverser"),
|
||||
globals = require("../../conf/globals"),
|
||||
{
|
||||
directivesPattern
|
||||
} = require("../shared/directives"),
|
||||
|
||||
/* eslint-disable-next-line n/no-restricted-require -- Too messy to figure out right now. */
|
||||
ConfigCommentParser = require("../linter/config-comment-parser"),
|
||||
eslintScope = require("eslint-scope");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
@@ -24,6 +32,8 @@ const
|
||||
// Private
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const commentParser = new ConfigCommentParser();
|
||||
|
||||
/**
|
||||
* Validates that the given AST has the required information.
|
||||
* @param {ASTNode} ast The Program node of the AST to check.
|
||||
@@ -49,6 +59,29 @@ function validate(ast) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves globals for the given ecmaVersion.
|
||||
* @param {number} ecmaVersion The version to retrieve globals for.
|
||||
* @returns {Object} The globals for the given ecmaVersion.
|
||||
*/
|
||||
function getGlobalsForEcmaVersion(ecmaVersion) {
|
||||
|
||||
switch (ecmaVersion) {
|
||||
case 3:
|
||||
return globals.es3;
|
||||
|
||||
case 5:
|
||||
return globals.es5;
|
||||
|
||||
default:
|
||||
if (ecmaVersion < 2015) {
|
||||
return globals[`es${ecmaVersion + 2009}`];
|
||||
}
|
||||
|
||||
return globals[`es${ecmaVersion}`];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if its a ES6 export declaration.
|
||||
* @param {ASTNode} astNode An AST node.
|
||||
@@ -83,6 +116,36 @@ function sortedMerge(tokens, comments) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes a value for a global in a config
|
||||
* @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in
|
||||
* a global directive comment
|
||||
* @returns {("readable"|"writeable"|"off")} The value normalized as a string
|
||||
* @throws Error if global value is invalid
|
||||
*/
|
||||
function normalizeConfigGlobal(configuredValue) {
|
||||
switch (configuredValue) {
|
||||
case "off":
|
||||
return "off";
|
||||
|
||||
case true:
|
||||
case "true":
|
||||
case "writeable":
|
||||
case "writable":
|
||||
return "writable";
|
||||
|
||||
case null:
|
||||
case false:
|
||||
case "false":
|
||||
case "readable":
|
||||
case "readonly":
|
||||
return "readonly";
|
||||
|
||||
default:
|
||||
throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if two nodes or tokens overlap.
|
||||
* @param {ASTNode|Token} first The first node or token to check.
|
||||
@@ -145,6 +208,116 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Directive Comments
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
function extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that variables representing built-in properties of the Global Object,
|
||||
* and any globals declared by special block comments, are present in the global
|
||||
* scope.
|
||||
* @param {Scope} globalScope The global scope.
|
||||
* @param {Object|undefined} configGlobals The globals declared in configuration
|
||||
* @param {Object|undefined} inlineGlobals The globals declared in the source code
|
||||
* @returns {void}
|
||||
*/
|
||||
function addDeclaredGlobals(globalScope, configGlobals = {}, inlineGlobals = {}) {
|
||||
|
||||
// Define configured global variables.
|
||||
for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(inlineGlobals)])) {
|
||||
|
||||
/*
|
||||
* `normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would
|
||||
* typically be caught when validating a config anyway (validity for inline global comments is checked separately).
|
||||
*/
|
||||
const configValue = configGlobals[id] === void 0 ? void 0 : normalizeConfigGlobal(configGlobals[id]);
|
||||
const commentValue = inlineGlobals[id] && inlineGlobals[id].value;
|
||||
const value = commentValue || configValue;
|
||||
const sourceComments = inlineGlobals[id] && inlineGlobals[id].comments;
|
||||
|
||||
if (value === "off") {
|
||||
continue;
|
||||
}
|
||||
|
||||
let variable = globalScope.set.get(id);
|
||||
|
||||
if (!variable) {
|
||||
variable = new eslintScope.Variable(id, globalScope);
|
||||
|
||||
globalScope.variables.push(variable);
|
||||
globalScope.set.set(id, variable);
|
||||
}
|
||||
|
||||
variable.eslintImplicitGlobalSetting = configValue;
|
||||
variable.eslintExplicitGlobal = sourceComments !== void 0;
|
||||
variable.eslintExplicitGlobalComments = sourceComments;
|
||||
variable.writeable = (value === "writable");
|
||||
}
|
||||
|
||||
/*
|
||||
* "through" contains all references which definitions cannot be found.
|
||||
* Since we augment the global scope using configuration, we need to update
|
||||
* references and remove the ones that were added by configuration.
|
||||
*/
|
||||
globalScope.through = globalScope.through.filter(reference => {
|
||||
const name = reference.identifier.name;
|
||||
const variable = globalScope.set.get(name);
|
||||
|
||||
if (variable) {
|
||||
|
||||
/*
|
||||
* Links the variable and the reference.
|
||||
* And this reference is removed from `Scope#through`.
|
||||
*/
|
||||
reference.resolved = variable;
|
||||
variable.references.push(reference);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given variable names as exported so they won't be triggered by
|
||||
* the `no-unused-vars` rule.
|
||||
* @param {eslint.Scope} globalScope The global scope to define exports in.
|
||||
* @param {Record<string,string>} variables An object whose keys are the variable
|
||||
* names to export.
|
||||
* @returns {void}
|
||||
*/
|
||||
function markExportedVariables(globalScope, variables) {
|
||||
|
||||
Object.keys(variables).forEach(name => {
|
||||
const variable = globalScope.set.get(name);
|
||||
|
||||
if (variable) {
|
||||
variable.eslintUsed = true;
|
||||
variable.eslintExported = true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -187,7 +360,9 @@ class SourceCode extends TokenStore {
|
||||
* General purpose caching for the class.
|
||||
*/
|
||||
this[caches] = new Map([
|
||||
["scopes", new WeakMap()]
|
||||
["scopes", new WeakMap()],
|
||||
["vars", new Map()],
|
||||
["configNodes", void 0]
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -266,7 +441,7 @@ class SourceCode extends TokenStore {
|
||||
// Cache for comments found using getComments().
|
||||
this._commentCache = new WeakMap();
|
||||
|
||||
// don't allow modification of this object
|
||||
// don't allow further modification of this object
|
||||
Object.freeze(this);
|
||||
Object.freeze(this.lines);
|
||||
}
|
||||
@@ -724,6 +899,178 @@ class SourceCode extends TokenStore {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of all inline configuration nodes found in the
|
||||
* source code.
|
||||
* @returns {Array<Token>} An array of all inline configuration nodes.
|
||||
*/
|
||||
getInlineConfigNodes() {
|
||||
|
||||
// check the cache first
|
||||
let configNodes = this[caches].get("configNodes");
|
||||
|
||||
if (configNodes) {
|
||||
return configNodes;
|
||||
}
|
||||
|
||||
// calculate fresh config nodes
|
||||
configNodes = this.ast.comments.filter(comment => {
|
||||
|
||||
// shebang comments are never directives
|
||||
if (comment.type === "Shebang") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { directivePart } = extractDirectiveComment(comment.value);
|
||||
|
||||
const directiveMatch = directivesPattern.exec(directivePart);
|
||||
|
||||
if (!directiveMatch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// only certain comment types are supported as line comments
|
||||
return comment.type !== "Line" || !!/^eslint-disable-(next-)?line$/u.test(directiveMatch[1]);
|
||||
});
|
||||
|
||||
this[caches].set("configNodes", configNodes);
|
||||
|
||||
return configNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies language options sent in from the core.
|
||||
* @param {Object} languageOptions The language options for this run.
|
||||
* @returns {void}
|
||||
*/
|
||||
applyLanguageOptions(languageOptions) {
|
||||
|
||||
/*
|
||||
* Add configured globals and language globals
|
||||
*
|
||||
* Using Object.assign instead of object spread for performance reasons
|
||||
* https://github.com/eslint/eslint/issues/16302
|
||||
*/
|
||||
const configGlobals = Object.assign(
|
||||
{},
|
||||
getGlobalsForEcmaVersion(languageOptions.ecmaVersion),
|
||||
languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0,
|
||||
languageOptions.globals
|
||||
);
|
||||
const varsCache = this[caches].get("vars");
|
||||
|
||||
varsCache.set("configGlobals", configGlobals);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies configuration found inside of the source code. This method is only
|
||||
* called when ESLint is running with inline configuration allowed.
|
||||
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,node:ASTNode}}} Information
|
||||
* that ESLint needs to further process the inline configuration.
|
||||
*/
|
||||
applyInlineConfig() {
|
||||
|
||||
const problems = [];
|
||||
const configs = [];
|
||||
const exportedVariables = {};
|
||||
const inlineGlobals = Object.create(null);
|
||||
|
||||
this.getInlineConfigNodes().forEach(comment => {
|
||||
|
||||
const { directivePart } = extractDirectiveComment(comment.value);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(match.index + directiveText.length);
|
||||
|
||||
switch (directiveText) {
|
||||
case "exported":
|
||||
Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment));
|
||||
break;
|
||||
|
||||
case "globals":
|
||||
case "global":
|
||||
for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) {
|
||||
let normalizedValue;
|
||||
|
||||
try {
|
||||
normalizedValue = normalizeConfigGlobal(value);
|
||||
} catch (err) {
|
||||
problems.push({
|
||||
ruleId: null,
|
||||
loc: comment.loc,
|
||||
message: err.message
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inlineGlobals[id]) {
|
||||
inlineGlobals[id].comments.push(comment);
|
||||
inlineGlobals[id].value = normalizedValue;
|
||||
} else {
|
||||
inlineGlobals[id] = {
|
||||
comments: [comment],
|
||||
value: normalizedValue
|
||||
};
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "eslint": {
|
||||
const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);
|
||||
|
||||
if (parseResult.success) {
|
||||
configs.push({
|
||||
config: {
|
||||
rules: parseResult.config
|
||||
},
|
||||
node: comment
|
||||
});
|
||||
} else {
|
||||
problems.push(parseResult.error);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// no default
|
||||
}
|
||||
});
|
||||
|
||||
// save all the new variables for later
|
||||
const varsCache = this[caches].get("vars");
|
||||
|
||||
varsCache.set("inlineGlobals", inlineGlobals);
|
||||
varsCache.set("exportedVariables", exportedVariables);
|
||||
|
||||
return {
|
||||
configs,
|
||||
problems
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ESLint core to indicate that it has finished providing
|
||||
* information. We now add in all the missing variables and ensure that
|
||||
* state-changing methods cannot be called by rules.
|
||||
* @returns {void}
|
||||
*/
|
||||
finalize() {
|
||||
|
||||
// Step 1: ensure that all of the necessary variables are up to date
|
||||
const varsCache = this[caches].get("vars");
|
||||
const globalScope = this.scopeManager.scopes[0];
|
||||
const configGlobals = varsCache.get("configGlobals");
|
||||
const inlineGlobals = varsCache.get("inlineGlobals");
|
||||
const exportedVariables = varsCache.get("exportedVariables");
|
||||
|
||||
addDeclaredGlobals(globalScope, configGlobals, inlineGlobals);
|
||||
|
||||
if (exportedVariables) {
|
||||
markExportedVariables(globalScope, exportedVariables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = SourceCode;
|
||||
|
||||
4
node_modules/eslint/package.json
generated
vendored
4
node_modules/eslint/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint",
|
||||
"version": "8.49.0",
|
||||
"version": "8.50.0",
|
||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||
"description": "An AST-based pattern checker for JavaScript.",
|
||||
"bin": {
|
||||
@@ -63,7 +63,7 @@
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.49.0",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
||||
63
package-lock.json
generated
63
package-lock.json
generated
@@ -18,7 +18,7 @@
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^11.1.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"adm-zip": "^0.5.10",
|
||||
@@ -39,17 +39,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "4.1.0",
|
||||
"@types/adm-zip": "^0.5.1",
|
||||
"@types/adm-zip": "^0.5.2",
|
||||
"@types/get-folder-size": "^2.0.0",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.2",
|
||||
"@types/sinon": "^10.0.16",
|
||||
"@types/semver": "^7.5.3",
|
||||
"@types/sinon": "^10.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
@@ -505,9 +505,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz",
|
||||
"integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==",
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -819,13 +819,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz",
|
||||
"integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==",
|
||||
"version": "12.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.0.0.tgz",
|
||||
"integrity": "sha512-EzD434aHTFifGudYAygnFlS1Tl6KhbTynEWELQXIbTY8Msvb5nEqTZIm7sbPEt4mQYLZwu3zPKVdeIrw0g7ovg==",
|
||||
"dependencies": {
|
||||
"@octokit/openapi-types": "^18.0.0"
|
||||
"@octokit/openapi-types": "^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types/node_modules/@octokit/openapi-types": {
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.0.0.tgz",
|
||||
"integrity": "sha512-PclQ6JGMTE9iUStpzMkwLCISFn/wDeRjkZFIKALpvJQNBGwDoYYi2fFvuHwssoQ1rXI5mfh6jgTgWuddeUzfWw=="
|
||||
},
|
||||
"node_modules/@opentelemetry/api": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz",
|
||||
@@ -892,9 +897,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/adm-zip": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.1.tgz",
|
||||
"integrity": "sha512-3+psmbh60N5JXM2LMkujFqnjMf3KB0LZoIQO73NJvkv57q+384nK/A7pP0v+ZkB/Zrfqn+5xtAyt5OsY+GiYLQ==",
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.2.tgz",
|
||||
"integrity": "sha512-33OTTnnW3onOE6HJuoqsi7T7Ojupz7zO/Vs5ddRNVCYQnu4lg05RqH/pr9eidHGvGyYfdO4uPO9cvegAMixBCQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
@@ -957,15 +962,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz",
|
||||
"integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==",
|
||||
"version": "7.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz",
|
||||
"integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/sinon": {
|
||||
"version": "10.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.16.tgz",
|
||||
"integrity": "sha512-j2Du5SYpXZjJVJtXBokASpPRj+e2z+VUhCPHmM6WMfe3dpHu6iVKJMU6AiBcMp/XTAYnEj6Wc1trJUWwZ0QaAQ==",
|
||||
"version": "10.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.17.tgz",
|
||||
"integrity": "sha512-+6ILpcixQ0Ma3dHMTLv4rSycbDXkDljgKL+E0nI2RUxxhYTFyPSjt6RVMxh7jUshvyVcBvicb0Ktj+lAJcjgeA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
@@ -2522,15 +2527,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz",
|
||||
"integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==",
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.49.0",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
@@ -2608,9 +2613,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-import-resolver-typescript": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz",
|
||||
"integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==",
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz",
|
||||
"integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
|
||||
12
package.json
12
package.json
@@ -30,7 +30,7 @@
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^11.1.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"adm-zip": "^0.5.10",
|
||||
@@ -54,17 +54,17 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "4.1.0",
|
||||
"@types/adm-zip": "^0.5.1",
|
||||
"@types/adm-zip": "^0.5.2",
|
||||
"@types/get-folder-size": "^2.0.0",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.2",
|
||||
"@types/sinon": "^10.0.16",
|
||||
"@types/semver": "^7.5.3",
|
||||
"@types/sinon": "^10.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
|
||||
@@ -23,7 +23,7 @@ predicate isSafeForDefaultSetup(string envVar) {
|
||||
"GITHUB_BASE_REF", "GITHUB_EVENT_NAME", "GITHUB_JOB", "GITHUB_RUN_ATTEMPT", "GITHUB_RUN_ID",
|
||||
"GITHUB_SHA", "GITHUB_REPOSITORY", "GITHUB_SERVER_URL", "GITHUB_TOKEN", "GITHUB_WORKFLOW",
|
||||
"GITHUB_WORKSPACE", "GOFLAGS", "ImageVersion", "JAVA_TOOL_OPTIONS", "RUNNER_ARCH",
|
||||
"RUNNER_NAME", "RUNNER_OS", "RUNNER_TEMP", "RUNNER_TOOL_CACHE"
|
||||
"RUNNER_ENVIRONMENT", "RUNNER_NAME", "RUNNER_OS", "RUNNER_TEMP", "RUNNER_TOOL_CACHE"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { getCodeQL } from "./codeql";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { getTemporaryDirectory, getWorkflowEventName } from "./actions-util";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { CodeQL, getCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { Language, isTracedLanguage } from "./languages";
|
||||
import { Feature, featureConfig, Features } from "./feature-flags";
|
||||
import { isTracedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
import { getRequiredEnvParam } from "./util";
|
||||
|
||||
export async function determineAutobuildLanguages(
|
||||
config: configUtils.Config,
|
||||
@@ -91,6 +98,47 @@ export async function determineAutobuildLanguages(
|
||||
return languages;
|
||||
}
|
||||
|
||||
async function setupCppAutobuild(codeql: CodeQL, logger: Logger) {
|
||||
const envVar = featureConfig[Feature.CppDependencyInstallation].envVar;
|
||||
const featureName = "C++ automatic installation of dependencies";
|
||||
const envDoc =
|
||||
"https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
const repositoryNwo = parseRepositoryNwo(
|
||||
getRequiredEnvParam("GITHUB_REPOSITORY"),
|
||||
);
|
||||
const features = new Features(
|
||||
gitHubVersion,
|
||||
repositoryNwo,
|
||||
getTemporaryDirectory(),
|
||||
logger,
|
||||
);
|
||||
if (await features.getValue(Feature.CppDependencyInstallation, codeql)) {
|
||||
// disable autoinstall on self-hosted runners unless explicitly requested
|
||||
if (
|
||||
process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
|
||||
process.env[envVar] !== "true"
|
||||
) {
|
||||
logger.info(
|
||||
`Disabling ${featureName} as we are on a self-hosted runner.${
|
||||
getWorkflowEventName() !== "dynamic"
|
||||
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
|
||||
: ""
|
||||
}`,
|
||||
);
|
||||
core.exportVariable(envVar, "false");
|
||||
} else {
|
||||
logger.info(
|
||||
`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`,
|
||||
);
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
} else {
|
||||
logger.info(`Disabling ${featureName}.`);
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
}
|
||||
|
||||
export async function runAutobuild(
|
||||
language: Language,
|
||||
config: configUtils.Config,
|
||||
@@ -98,6 +146,9 @@ export async function runAutobuild(
|
||||
) {
|
||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = await getCodeQL(config.codeQLCmd);
|
||||
if (language === Language.cpp) {
|
||||
await setupCppAutobuild(codeQL, logger);
|
||||
}
|
||||
await codeQL.runAutobuild(language);
|
||||
logger.endGroup();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
Feature,
|
||||
FeatureEnablement,
|
||||
useCodeScanningConfigInCli,
|
||||
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
} from "./feature-flags";
|
||||
import { isTracedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
@@ -611,6 +612,19 @@ export async function getCodeQLForCmd(
|
||||
extraArgs.push("--calculate-language-specific-baseline");
|
||||
}
|
||||
|
||||
if (
|
||||
await features.getValue(Feature.SublanguageFileCoverageEnabled, this)
|
||||
) {
|
||||
extraArgs.push("--sublanguage-file-coverage");
|
||||
} else if (
|
||||
await util.codeQlVersionAbove(
|
||||
this,
|
||||
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
)
|
||||
) {
|
||||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
|
||||
await runTool(
|
||||
cmd,
|
||||
[
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-v2.14.5",
|
||||
"cliVersion": "2.14.5",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.4",
|
||||
"priorCliVersion": "2.14.4"
|
||||
"bundleVersion": "codeql-bundle-v2.14.6",
|
||||
"cliVersion": "2.14.6",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.5",
|
||||
"priorCliVersion": "2.14.5"
|
||||
}
|
||||
|
||||
@@ -24,9 +24,15 @@ export const CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
|
||||
export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||
|
||||
/**
|
||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options.
|
||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options, but we
|
||||
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
|
||||
*/
|
||||
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
||||
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
||||
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||
*/
|
||||
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
||||
|
||||
export interface CodeQLDefaultVersionInfo {
|
||||
cliVersion: string;
|
||||
@@ -51,12 +57,14 @@ export enum Feature {
|
||||
AnalysisSummaryV2Enabled = "analysis_summary_v2_enabled",
|
||||
CliConfigFileEnabled = "cli_config_file_enabled",
|
||||
CodeqlJavaLombokEnabled = "codeql_java_lombok_enabled",
|
||||
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
||||
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
|
||||
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
|
||||
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
|
||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||
SublanguageFileCoverageEnabled = "sublanguage_file_coverage_enabled",
|
||||
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
|
||||
}
|
||||
|
||||
@@ -74,6 +82,11 @@ export const featureConfig: Record<
|
||||
minimumVersion: "2.14.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
minimumVersion: "2.15.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
||||
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
|
||||
minimumVersion: undefined,
|
||||
@@ -104,6 +117,11 @@ export const featureConfig: Record<
|
||||
minimumVersion: undefined,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.SublanguageFileCoverageEnabled]: {
|
||||
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
|
||||
minimumVersion: CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.UploadFailedSarifEnabled]: {
|
||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||
minimumVersion: "2.11.3",
|
||||
|
||||
@@ -217,8 +217,6 @@ async function run() {
|
||||
core.exportVariable(EnvVar.JOB_RUN_UUID, uuidV4());
|
||||
|
||||
try {
|
||||
const workflowErrors = await validateWorkflow(logger);
|
||||
|
||||
if (
|
||||
!(await sendStatusReport(
|
||||
await createStatusReportBase(
|
||||
@@ -226,7 +224,6 @@ async function run() {
|
||||
"starting",
|
||||
startedAt,
|
||||
await checkDiskUsage(logger),
|
||||
workflowErrors,
|
||||
),
|
||||
))
|
||||
) {
|
||||
@@ -250,6 +247,8 @@ async function run() {
|
||||
toolsVersion = initCodeQLResult.toolsVersion;
|
||||
toolsSource = initCodeQLResult.toolsSource;
|
||||
|
||||
await validateWorkflow(codeql, logger);
|
||||
|
||||
config = await initConfig(
|
||||
getOptionalInput("languages"),
|
||||
getOptionalInput("queries"),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user