Skip to content

Commit e4cd687

Browse files
style: Require check-types and require-returns-type jsdoc (newrelic#3400)
1 parent d5ca93b commit e4cd687

File tree

84 files changed

+264
-263
lines changed

Some content is hidden

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

84 files changed

+264
-263
lines changed

api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ API.prototype.ignoreApdex = function ignoreApdex() {
19371937
* { role: 'user', content: 'Tell me about Node.js.'}
19381938
* ]})
19391939
* })
1940-
* @param {Object} context LLM custom attributes context
1940+
* @param {object} context LLM custom attributes context
19411941
* @param {Function} callback The function to execute in context.
19421942
*/
19431943
API.prototype.withLlmCustomAttributes = function withLlmCustomAttributes(context, callback) {

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const jsdocConfig = {
5555
rules: {
5656
'jsdoc/require-jsdoc': 'off',
5757
'jsdoc/tag-lines': 'off',
58-
'jsdoc/check-types': 'off',
58+
'jsdoc/check-types': 'error',
5959
'jsdoc/no-undefined-types': [
6060
'warn',
6161
{
@@ -79,6 +79,7 @@ const jsdocConfig = {
7979
'jsdoc/check-param-names': 'error',
8080
'jsdoc/require-param-description': 'error',
8181
'jsdoc/require-param-type': 'error',
82+
'jsdoc/require-returns-type': 'error'
8283
}
8384
}
8485
const jsdocOverrides = {

lib/collector/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ CollectorAPI.prototype._updateEndpoints = function _updateEndpoints(endpoint) {
153153
/**
154154
* Connect to the data collector.
155155
*
156-
* @param {function} callback A typical error first callback to be invoked
156+
* @param {Function} callback A typical error first callback to be invoked
157157
* upon successful or unsuccessful connection. The second parameter will be
158158
* an instance of {@link CollectorResponse}.
159159
*

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 {Object} config configuration for HTTP agent
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 {Object} config configuration for proxy agent
48+
* @param {object} config configuration for proxy agent
4949
*/
5050
exports.proxyAgent = function proxyAgent(config) {
5151
if (agentProxyWithKeepAlive !== null) {

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 {Object} aggregator Aggregator instance
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 {Object} logger Logger instance
19-
* @param {Object} requestHeaders Incoming request headers
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 {Object} headers Incoming request headers
65+
* @param {object} headers Incoming request headers
6666
*/
6767
function getContentLengthFromHeaders(headers) {
6868
const contentLength = -1

lib/health-reporter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class HealthReporter {
112112
* object that has an `agent_control` property which is an instance of
113113
* {@link AgentControlConfig}.
114114
* @param {object} [params.logger] A standard logger instance.
115-
* @param {function} [params.setInterval] A function to use as `setInterval`.
115+
* @param {Function} [params.setInterval] A function to use as `setInterval`.
116116
* Must return an interval object that supports the `unref()` method.
117117
*/
118118
constructor({
@@ -217,7 +217,7 @@ class HealthReporter {
217217
* initiate an immediate write of the status file, and then invoke the
218218
* provided callback.
219219
*
220-
* @param {function} done Callback to be invoked after the status file has
220+
* @param {Function} done Callback to be invoked after the status file has
221221
* been updated.
222222
*/
223223
stop(done) {

lib/instrumentation-descriptor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const IdGen = require('./util/idgen')
99
const idGen = new IdGen()
1010

1111
/**
12-
* @typedef {function} InstrumentationOnRequire
12+
* @typedef {Function} InstrumentationOnRequire
1313
* @param {Shim} shim The shim instance to use for the instrumentation.
1414
* @param {object} resolvedNodule The module being instrumented as returned by
1515
* Node's `require` function.
@@ -19,7 +19,7 @@ const idGen = new IdGen()
1919
*/
2020

2121
/**
22-
* @typedef {function} InstrumentationOnError
22+
* @typedef {Function} InstrumentationOnError
2323
* @param {Error|object} error The error thrown by `onRequire` when there was
2424
* an issue registering the instrumentation.
2525
*/

lib/instrumentation/aws-sdk/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function grabLastUrlSegment(url = '/') {
2020
/**
2121
* Retrieves the db segment params from endpoint and command parameters
2222
*
23-
* @param {Object} endpoint instance of ddb endpoint
24-
* @param {Object} params parameters passed to a ddb command
25-
* @returns {Object}
23+
* @param {object} endpoint instance of ddb endpoint
24+
* @param {object} params parameters passed to a ddb command
25+
* @returns {object}
2626
*/
2727
function setDynamoParameters(endpoint, params) {
2828
return new DatastoreParameters({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Series of tests to determine if the library
1010
* has the features needed to provide instrumentation.
11-
* @param {Object} AWS AWS SDK object
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)