Skip to content

Commit 3785d0c

Browse files
style: Require jsdoc require-param-description and require-param-type (newrelic#3391)
1 parent cda56cc commit 3785d0c

File tree

90 files changed

+270
-268
lines changed

Some content is hidden

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

90 files changed

+270
-268
lines changed

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ const jsdocConfig = {
6969
'Tracer',
7070
'Exception',
7171
'MetricAggregator',
72+
'Metrics',
7273
'EventEmitter',
7374
'Context'
7475
]
7576
}
7677
],
7778
'jsdoc/valid-types': 'error',
78-
'jsdoc/check-param-names': 'error'
79+
'jsdoc/check-param-names': 'error',
80+
'jsdoc/require-param-description': 'error',
81+
'jsdoc/require-param-type': 'error',
7982
}
8083
}
8184
const jsdocOverrides = {

lib/attributes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Attributes {
6868
* in the list of allowed destinations. If there is a limit on the number of
6969
* attributes allowed, no more than that number will be included in the result.
7070
*
71-
* @param {AttributeFilter.DESTINATIONS} dest
71+
* @param {AttributeFilter.DESTINATIONS} dest - Allowed destinations
7272
* @returns {object}
7373
*/
7474
get(dest) {
@@ -92,7 +92,7 @@ class Attributes {
9292
/**
9393
* Checks if a given key exists in the instance attributes object.
9494
*
95-
* @param {string} key
95+
* @param {string} key the key to check
9696
*/
9797
has(key) {
9898
return !!this.attributes[key]
@@ -163,8 +163,8 @@ class Attributes {
163163
* Returns true if a given key is valid for any of the
164164
* provided destinations.
165165
*
166-
* @param {DESTINATIONS} destinations
167-
* @param {string} key
166+
* @param {DESTINATIONS} destinations - The destinations to check against.
167+
* @param {string} key the key to check
168168
*/
169169
hasValidDestination(destinations, key) {
170170
const validDestinations = this.filter(destinations, key)

lib/collector/facts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function getAllIPAddresses() {
130130
* connections are the same real agent or a separate one.
131131
* https://github.com/newrelic/node-newrelic/issues/654
132132
*
133-
* @param appNames
133+
* @param {Array<string>} appNames list of app names
134134
*/
135135
function getIdentifierOverride(appNames) {
136136
return [

lib/collector/http-agents.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let agentProxyWithKeepAlive = null
1919
/**
2020
* Returns an HTTP agent with keep-alive enabled
2121
*
22-
* @param config
22+
* @param {Object} config configuration for HTTP agent
2323
*/
2424
exports.keepAliveAgent = function keepAliveAgent(config) {
2525
config = config ? config : {}
@@ -45,7 +45,7 @@ exports.keepAliveAgent = function keepAliveAgent(config) {
4545
* to the proxy server as to how its connection is made
4646
* with New Relic's servers.
4747
*
48-
* @param config
48+
* @param {Object} config configuration for proxy agent
4949
*/
5050
exports.proxyAgent = function proxyAgent(config) {
5151
if (agentProxyWithKeepAlive !== null) {

lib/collector/remote-method.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
281281
* Generate the request headers and wire up the request. There are many
282282
* parameters used to make a request:
283283
*
284-
* @param options
284+
* @param {object} options options object
285285
* @param {string} options.host Hostname (or proxy hostname) for collector.
286286
* @param {string} options.port Port (or proxy port) for collector.
287287
* @param {string} options.path URL path for method being invoked on collector.
@@ -363,7 +363,7 @@ RemoteMethod.prototype._path = function _path({ redactLicenseKey } = {}) {
363363
}
364364

365365
/**
366-
* @param {object} options
366+
* @param {object} options options object
367367
* @param {number} options.body - Data to be sent.
368368
* @param {object} options.nrHeaders - NR request headers from the connect response.
369369
* @param {boolean} options.compressed - The compression method used, if any.
@@ -401,7 +401,7 @@ RemoteMethod.prototype._headers = function _headers(options) {
401401
*
402402
* FIXME: come up with a better heuristic
403403
*
404-
* @param data
404+
* @param {*} data the data that might get compressed
405405
*/
406406
RemoteMethod.prototype._shouldCompress = function _shouldCompress(data) {
407407
return data && byteLength(data) > 65536

lib/config/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,8 @@ function _laspReponse(keys) {
15291529
/**
15301530
* Applies the server side LASP policies to a local configuration object
15311531
*
1532-
* @param agent
1533-
* @param {object} policies server side LASP policy
1532+
* @param {Agent} agent Agent instance
1533+
* @param {bject} policies server side LASP policy
15341534
* @returns {object} { missingRequired, finalPolicies } list of missing required fields and finalized LASP policy
15351535
*/
15361536
Config.prototype._buildLaspPolicy = function _buildLaspPolicy(agent, policies) {
@@ -1595,7 +1595,7 @@ Config.prototype._buildLaspPolicy = function _buildLaspPolicy(agent, policies) {
15951595
* by the agent, if LASP-enabled. Responds with an error to shut down
15961596
* the agent if necessary.
15971597
*
1598-
* @param agent
1598+
* @param {Agent} agent Agent instance
15991599
* @param {object} policies lasp policy
16001600
* @returns {CollectorResponse} The result of the processing, with the known
16011601
* policies as the response payload.
@@ -1745,9 +1745,9 @@ Config.prototype._warnDeprecations = function _warnDeprecations() {
17451745
* the environment variables will override their corresponding
17461746
* configuration file settings.
17471747
*
1748-
* @param {object} config Optional configuration to be used in place of a config file.
1749-
* @param root0
1750-
* @param root0.loggerInstance
1748+
* @param {object} [config] Optional configuration to be used in place of a config file.
1749+
* @param {object} [deps] Optional dependencies
1750+
* @param {object} [deps.loggerInstance] Logger instance
17511751
* @returns {object} instantiated configuration object
17521752
*/
17531753
function initialize(config, { loggerInstance } = {}) {

lib/harvester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = class Harvester {
7474
/**
7575
* Registers an aggregator with the Harvester instance.
7676
*
77-
* @param aggregator
77+
* @param {Object} aggregator Aggregator instance
7878
*/
7979
add(aggregator) {
8080
this.aggregators.push(aggregator)

lib/header-processing.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const CONTENT_LENGTH_REGEX = /^Content-Length$/i
1515
* Queue time is provided by certain providers by stamping the request
1616
* header with the time the request arrived at the router.
1717
*
18-
* @param {*} logger
19-
* @param {*} requestHeaders
18+
* @param {Object} logger Logger instance
19+
* @param {Object} requestHeaders Incoming request headers
2020
*/
2121
function getQueueTime(logger, requestHeaders) {
2222
const headerValue = requestHeaders[REQUEST_START_HEADER] || requestHeaders[QUEUE_HEADER]
@@ -62,7 +62,7 @@ function convertUnit(time) {
6262
*
6363
* If no header is found, returns -1
6464
*
65-
* @param {*} headers
65+
* @param {Object} headers Incoming request headers
6666
*/
6767
function getContentLengthFromHeaders(headers) {
6868
const contentLength = -1

lib/instrumentation/@node-redis/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = function initialize(_agent, redis, _moduleName, shim) {
4343
/**
4444
* Instruments a given command when added to the command queue by calling `shim.recordOperation`
4545
*
46-
* @param {object} params
46+
* @param {object} params params object
4747
* @param {Shim} params.shim shim instance
4848
* @param {object} params.commandsQueue instance
4949
*/

lib/instrumentation/aws-sdk/v2/instrumentation-helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
/**
99
* Series of tests to determine if the library
10-
* has the features needed to provide instrumentation
11-
* @param AWS
10+
* has the features needed to provide instrumentation.
11+
* @param {Object} AWS AWS SDK object
1212
*/
1313
const instrumentationSupported = function instrumentationSupported(AWS) {
1414
// instrumentation requires the serviceClientOperationsMap property

0 commit comments

Comments
 (0)