Skip to content

Commit d70e6a0

Browse files
authored
chore(eslint): enable JSDoc parameter and type checks (#9566)
1 parent f6912b6 commit d70e6a0

73 files changed

Lines changed: 404 additions & 109 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ci/diagnose.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const UNSUPPORTED_FRAMEWORKS = [
224224
*
225225
* @param {object} [options] diagnosis options
226226
* @param {string} [options.root] repository path to inspect
227-
* @param {NodeJS.ProcessEnv} [options.env] environment to inspect
227+
* @param {typeof process.env} [options.env] environment to inspect
228228
* @param {Function} [options.execFile] command runner used for git checks
229229
* @param {string} [options.gitExecutable] trusted git executable used for git checks
230230
* @param {number} [options.maxFiles] maximum number of text files to scan
@@ -544,7 +544,7 @@ function checkUnsupportedFrameworks (results, unsupported, supported) {
544544
* @param {Array<object>} results mutable result list
545545
* @param {Array<object>} frameworks detected supported frameworks
546546
* @param {object} evidence repository evidence
547-
* @param {NodeJS.ProcessEnv} env environment
547+
* @param {typeof process.env} env environment
548548
*/
549549
function checkInitialization (results, frameworks, evidence, env) {
550550
if (!frameworks.length) return
@@ -772,7 +772,7 @@ function checkCypressConfiguration (results, evidence) {
772772
* @param {Array<object>} results mutable result list
773773
* @param {Array<object>} workflowFiles scanned CI workflow files
774774
* @param {object} evidence repository evidence
775-
* @param {NodeJS.ProcessEnv} env environment
775+
* @param {typeof process.env} env environment
776776
*/
777777
function checkCiConfiguration (results, workflowFiles, evidence, env) {
778778
if (!workflowFiles.length) {
@@ -878,7 +878,7 @@ function checkCiConfiguration (results, workflowFiles, evidence, env) {
878878
*
879879
* @param {Array<object>} results mutable result list
880880
* @param {string} root repository root
881-
* @param {NodeJS.ProcessEnv} env environment
881+
* @param {typeof process.env} env environment
882882
* @param {Function} execFile command runner
883883
* @param {string|undefined} gitExecutable trusted git executable
884884
*/
@@ -961,7 +961,7 @@ function checkGit (results, root, env, execFile, gitExecutable) {
961961
* Checks current environment variables relevant to Test Optimization.
962962
*
963963
* @param {Array<object>} results mutable result list
964-
* @param {NodeJS.ProcessEnv} env environment
964+
* @param {typeof process.env} env environment
965965
* @param {object} evidence repository evidence
966966
*/
967967
function checkCurrentEnvironment (results, env, evidence) {
@@ -1041,7 +1041,7 @@ function checkCurrentEnvironment (results, env, evidence) {
10411041
* Checks current CI provider metadata.
10421042
*
10431043
* @param {Array<object>} results mutable result list
1044-
* @param {NodeJS.ProcessEnv} env environment
1044+
* @param {typeof process.env} env environment
10451045
*/
10461046
function checkCurrentCiMetadata (results, env) {
10471047
const providerDetected = CURRENT_ENV_PROVIDER_KEYS.some(key => env[key])
@@ -1374,7 +1374,7 @@ function detectUnsupportedFrameworks (definitions, manifests, scripts) {
13741374
* Collects useful boolean evidence from scanned files and environment.
13751375
*
13761376
* @param {Array<object>} textFiles scanned text files
1377-
* @param {NodeJS.ProcessEnv} env environment
1377+
* @param {typeof process.env} env environment
13781378
* @returns {object} evidence object
13791379
*/
13801380
function collectEvidence (textFiles, env) {
@@ -1890,7 +1890,7 @@ function isTestSetupOrCiFile (file) {
18901890
* @param {Function} execFile command runner
18911891
* @param {string} root repository root
18921892
* @param {string|undefined} gitExecutable trusted git executable
1893-
* @param {NodeJS.ProcessEnv} env credential-free git environment
1893+
* @param {typeof process.env} env credential-free git environment
18941894
* @returns {boolean} true if git runs
18951895
*/
18961896
function canRunGit (execFile, root, gitExecutable, env) {
@@ -1910,7 +1910,7 @@ function canRunGit (execFile, root, gitExecutable, env) {
19101910
* @param {Function} execFile command runner
19111911
* @param {string} root repository root
19121912
* @param {string} gitExecutable trusted git executable
1913-
* @param {NodeJS.ProcessEnv} env credential-free git environment
1913+
* @param {typeof process.env} env credential-free git environment
19141914
* @param {string[]} args git arguments
19151915
* @returns {string} command output
19161916
*/
@@ -1954,8 +1954,8 @@ function findTrustedGitExecutable () {
19541954
* Creates the minimal environment needed by read-only local git metadata commands.
19551955
*
19561956
* @param {string|undefined} gitExecutable trusted git executable
1957-
* @param {NodeJS.ProcessEnv} sourceEnv source environment
1958-
* @returns {NodeJS.ProcessEnv} credential-free git environment
1957+
* @param {typeof process.env} sourceEnv source environment
1958+
* @returns {typeof process.env} credential-free git environment
19591959
*/
19601960
function getGitEnvironment (gitExecutable, sourceEnv) {
19611961
const env = {
@@ -2067,7 +2067,7 @@ function hasRegisterInNodeOptions (nodeOptions) {
20672067
/**
20682068
* Checks whether environment contains branch or tag metadata.
20692069
*
2070-
* @param {NodeJS.ProcessEnv} env environment
2070+
* @param {typeof process.env} env environment
20712071
* @returns {boolean} true if branch metadata exists
20722072
*/
20732073
function hasBranchMetadata (env) {
@@ -2091,7 +2091,7 @@ function hasBranchMetadata (env) {
20912091
/**
20922092
* Checks whether environment contains commit SHA metadata.
20932093
*
2094-
* @param {NodeJS.ProcessEnv} env environment
2094+
* @param {typeof process.env} env environment
20952095
* @returns {boolean} true if SHA metadata exists
20962096
*/
20972097
function hasShaMetadata (env) {

ci/test-optimization-validation/cli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ function getStaticFailure (framework, blocker, reportPath) {
906906
* @param {object} framework framework entry
907907
* @param {string} diagnosis blocker diagnosis
908908
* @param {string} reasonCode blocker id
909+
* @param {string | undefined} blockerCategory blocker category
909910
* @returns {object} result
910911
*/
911912
function getBasicNotReached (framework, diagnosis, reasonCode, blockerCategory) {

ci/test-optimization-validation/command-runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ function buildOfflineCaptureEnv ({ fixture, outputRoot }) {
522522
* @param {object} input offline validation inputs
523523
* @param {{manifestPath: string}} input.fixture authoritative cache fixture
524524
* @param {string} input.outputRoot pre-created payload output root
525-
* @returns {NodeJS.ProcessEnv} validation transport environment
525+
* @returns {typeof process.env} validation transport environment
526526
*/
527527
function buildOfflineValidationEnv ({ fixture, outputRoot }) {
528528
return {
@@ -551,7 +551,7 @@ function buildOfflineValidationEnv ({ fixture, outputRoot }) {
551551
* Rejects command-local assignments that can bypass validator-controlled offline routing.
552552
*
553553
* @param {object} command command to execute
554-
* @param {NodeJS.ProcessEnv} env validator environment overrides
554+
* @param {typeof process.env} env validator environment overrides
555555
*/
556556
function assertNoInlineValidationEnvOverrides (command, env) {
557557
if (!env[VALIDATION_MODE_ENV]) return

ci/test-optimization-validation/framework-adapters/cucumber.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ function getGeneratedStepsPath (testDirectory) {
164164
* Returns Cucumber arguments that select one existing feature.
165165
*
166166
* @param {string} filename selected Cucumber feature
167+
* @param {string} cwd project working directory
167168
* @returns {string[]} focused Cucumber arguments
168169
*/
169170
function getFocusedTestArgs (filename, cwd) {
@@ -175,6 +176,7 @@ function getFocusedTestArgs (filename, cwd) {
175176
*
176177
* @param {string} filename generated Cucumber feature
177178
* @param {string} stepsFile generated Cucumber step definitions
179+
* @param {string} cwd project working directory
178180
* @returns {string[]} generated scenario arguments
179181
*/
180182
function getGeneratedTestArgs (filename, stepsFile, cwd) {

eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ export default [
293293
'jsdoc/no-blank-blocks': 'error',
294294
// TODO: Enable the rules that we want to use.
295295
'jsdoc/no-defaults': 'error',
296-
'jsdoc/no-undefined-types': 'off',
296+
'jsdoc/no-undefined-types': 'error',
297297
'jsdoc/reject-function-type': 'off',
298298
'jsdoc/require-jsdoc': 'off',
299299
'jsdoc/require-param-description': 'off', // Having a description is not crucial for now.
300-
'jsdoc/require-param': 'off',
300+
'jsdoc/require-param': 'error',
301301
'jsdoc/require-property-description': 'off',
302302
'jsdoc/require-returns-check': 'error',
303303
'jsdoc/require-returns-description': 'off',

integration-tests/ci-visibility-intake.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ class FakeCiVisIntake extends FakeAgent {
462462
// drain. `hardTimeout` is a backstop for a genuinely hung child — bump it per-call
463463
// only when a workload's child runtime is provably above the default.
464464
/**
465-
* @param {import('child_process').ChildProcess | NodeJS.EventEmitter} childProcess
465+
* @param {import('child_process').ChildProcess | import('node:events').EventEmitter} childProcess
466466
* Source of the `'exit'` event. `exitCode` / `signalCode` are read synchronously
467467
* so a child that has already exited is handled correctly.
468468
* @param {(message: object) => boolean} [payloadMatch] Per-message filter; falsy

integration-tests/coverage-child-process.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ w.once('exit', code => process.exit(code))
393393
` v8Dir: process.env.${V8_COVERAGE_ENV} || '',\n` +
394394
'}))\n')
395395

396-
/** @type {NodeJS.ProcessEnv} */
396+
/** @type {typeof process.env} */
397397
const env = { ...process.env, [DISABLE_ENV]: '1' }
398398

399399
await new Promise(/** @type {(resolve: (value?: void) => void, reject: (reason?: Error) => void) => void} */

integration-tests/coverage/runtime.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function canonicalizePath (value) {
4141
}
4242

4343
/**
44-
* @param {NodeJS.ProcessEnv} [env]
44+
* @param {typeof process.env} [env]
4545
* @returns {boolean}
4646
*/
4747
function isCoverageActive (env = process.env) {
@@ -65,7 +65,7 @@ function labelSuffix () {
6565
}
6666

6767
/**
68-
* @param {NodeJS.ProcessEnv} [env]
68+
* @param {typeof process.env} [env]
6969
* @returns {string}
7070
*/
7171
function getCollectorRoot (env = process.env) {
@@ -242,11 +242,11 @@ function prependBootstrapRequire (nodeOptions) {
242242
* copies the parent's value to a child even when a custom env omits it, so omitting is not enough),
243243
* while a foreign directory the child set itself is preserved.
244244
*
245-
* @param {NodeJS.ProcessEnv | undefined} env
245+
* @param {typeof process.env | undefined} env
246246
* @param {object} [options]
247247
* @param {string} [options.cwd]
248248
* @param {string | URL} [options.scriptPath]
249-
* @returns {NodeJS.ProcessEnv | undefined}
249+
* @returns {typeof process.env | undefined}
250250
*/
251251
function applyCoverageEnv (env, options = {}) {
252252
if (!isCoverageActive()) return env

integration-tests/cypress/cypress-reporting-instrumentation.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ if (requestedVersion === 'latest' &&
15861586
* @param {string} code filesystem error code
15871587
* @param {string} filePath affected path
15881588
* @param {string} [syscall] failed system call
1589-
* @returns {NodeJS.ErrnoException} filesystem error
1589+
* @returns {Error & { code: string, path: string, syscall: string }} filesystem error
15901590
*/
15911591
function createFileError (code, filePath, syscall = 'open') {
15921592
return Object.assign(new Error(`${code}: ${syscall} ${filePath}`), {

integration-tests/debugger/target-app/time-budget.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ const complexTypes = ['object', 'array', 'map', 'set']
6363

6464
/**
6565
* Generate a complex nested object that requires a lot of async CDP calls to traverse
66+
*
67+
* @param {number} depth
68+
* @param {number} breath
69+
* @returns {Record<string, unknown>}
6670
*/
6771
function generateObject (depth, breath) {
6872
const obj = {}

0 commit comments

Comments
 (0)