Skip to content

Commit d2fba9d

Browse files
authored
chore: Updated eslint configuration (#2851)
1 parent 59f2bd9 commit d2fba9d

File tree

387 files changed

+2028
-1886
lines changed

Some content is hidden

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

387 files changed

+2028
-1886
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In general, we try to limit adding third-party production dependencies. If one i
5353

5454
### Coding Style Guidelines/Conventions
5555

56-
We use eslint to enforce certain coding standards. Please see our [.eslintrc](./.eslintrc.js) file for specific rule configuration.
56+
We use eslint to enforce certain coding standards. Please see our [eslint.config.js](./eslint.config.js) file for specific rule configuration.
5757

5858
### Commit Guidelines
5959

THIRD_PARTY_NOTICES.md

Lines changed: 226 additions & 415 deletions
Large diffs are not rendered by default.

api.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ API.prototype.startSegment = function startSegment(name, record, handler, callba
905905
// Create the segment and call the handler.
906906
const wrappedHandler = this.shim.record(handler, function handlerNamer(shim) {
907907
return {
908-
name: name,
908+
name,
909909
recorder: record ? customRecorder : null,
910910
callback: callback ? shim.FIRST : null,
911911
promise: !callback
@@ -1301,6 +1301,7 @@ API.prototype.recordCustomEvent = function recordCustomEvent(eventType, attribut
13011301
}
13021302

13031303
const tx = this.agent.getTransaction()
1304+
// eslint-disable-next-line sonarjs/pseudo-random
13041305
const priority = (tx && tx.priority) || Math.random()
13051306
this.agent.customEventAggregator.add([intrinsics, filteredAttributes], priority)
13061307
}
@@ -1326,9 +1327,9 @@ API.prototype.instrument = function instrument(moduleName, onRequire, onError) {
13261327
let opts = moduleName
13271328
if (typeof opts === 'string') {
13281329
opts = {
1329-
moduleName: moduleName,
1330-
onRequire: onRequire,
1331-
onError: onError
1330+
moduleName,
1331+
onRequire,
1332+
onError
13321333
}
13331334
}
13341335

@@ -1391,9 +1392,9 @@ API.prototype.instrumentDatastore = function instrumentDatastore(moduleName, onR
13911392
let opts = moduleName
13921393
if (typeof opts === 'string') {
13931394
opts = {
1394-
moduleName: moduleName,
1395-
onRequire: onRequire,
1396-
onError: onError
1395+
moduleName,
1396+
onRequire,
1397+
onError
13971398
}
13981399
}
13991400

@@ -1428,9 +1429,9 @@ API.prototype.instrumentWebframework = function instrumentWebframework(
14281429
let opts = moduleName
14291430
if (typeof opts === 'string') {
14301431
opts = {
1431-
moduleName: moduleName,
1432-
onRequire: onRequire,
1433-
onError: onError
1432+
moduleName,
1433+
onRequire,
1434+
onError
14341435
}
14351436
}
14361437

@@ -1461,9 +1462,9 @@ API.prototype.instrumentMessages = function instrumentMessages(moduleName, onReq
14611462
let opts = moduleName
14621463
if (typeof opts === 'string') {
14631464
opts = {
1464-
moduleName: moduleName,
1465-
onRequire: onRequire,
1466-
onError: onError
1465+
moduleName,
1466+
onRequire,
1467+
onError
14671468
}
14681469
}
14691470

bin/compare-bench-results.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
'use strict'
7-
/* eslint-disable sonarjs/no-duplicate-string, no-console */
87

98
const fs = require('fs/promises')
109
const { errorAndExit } = require('./utils')
@@ -114,7 +113,7 @@ const reportResults = async (resultFiles) => {
114113
const resultPath = 'benchmark_results'
115114
try {
116115
await fs.stat(resultPath)
117-
} catch (e) {
116+
} catch {
118117
await fs.mkdir(resultPath)
119118
}
120119
const fileName = `${resultPath}/comparison_${date.getTime()}.md`

bin/conventional-changelog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ConventionalChangelog {
137137
* @returns {string} the commit message header with any PR links removed and whitespace trimmed
138138
*/
139139
removePrLinks(subject) {
140-
return subject.replace(/\(\#\d+\)$/, '').trim()
140+
return subject.replace(/\(#\d+\)$/, '').trim()
141141
}
142142

143143
/**
@@ -211,7 +211,7 @@ class ConventionalChangelog {
211211

212212
const markdownFormatter = conventionalChangelogWriter(context, {
213213
...config.writerOpts,
214-
mainTemplate: mainTemplate,
214+
mainTemplate,
215215
headerPartial: headerTemplate,
216216
commitPartial: commitTemplate,
217217
commitGroupsSort: self.rankedGroupSort

bin/create-docs-pr.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ program.option('--dry-run', 'executes script but does not commit nor create PR')
3333
program.option(
3434
'--repo-path <path',
3535
'Path to the docs-website fork on local machine',
36+
// eslint-disable-next-line sonarjs/publicly-writable-directories
3637
'/tmp/docs-website'
3738
)
3839
program.option(
@@ -242,7 +243,7 @@ function formatReleaseNotes(releaseDate, version, body, frontmatter) {
242243
'subject: Node.js agent',
243244
`releaseDate: '${releaseDate}'`,
244245
`version: ${version.substring(1)}`, // remove the `v` from start of version
245-
`downloadLink: 'https://www.npmjs.com/package/newrelic'`,
246+
"downloadLink: 'https://www.npmjs.com/package/newrelic'",
246247
`security: ${frontmatter.security}`,
247248
`bugs: ${frontmatter.bugfixes}`,
248249
`features: ${frontmatter.features}`,
@@ -324,7 +325,7 @@ async function createPR(version, branch, dryRun, repoOwner) {
324325

325326
const github = new Github(repoOwner, 'docs-website')
326327
const title = `chore: add Node.js Agent ${version} Release Notes`
327-
const head = repoOwner === `newrelic` ? branch : `${repoOwner}:${branch}`
328+
const head = repoOwner === 'newrelic' ? branch : `${repoOwner}:${branch}`
328329
const body =
329330
'This is an automated PR generated when the Node.js agent is released. Please merge as soon as possible.'
330331

bin/git-commands.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function execAsPromise(command) {
126126
return new Promise((resolve, reject) => {
127127
console.log(`Executing: '${command}'`)
128128

129+
// eslint-disable-next-line sonarjs/os-command
129130
exec(command, (err, stdout) => {
130131
if (err) {
131132
reject(err)

bin/github.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class Github {
4545
owner: this.repoOwner,
4646
repo: this.repository,
4747
tag_name: tag,
48-
name: name,
49-
body: body
48+
name,
49+
body
5050
})
5151

5252
return result.data
@@ -146,7 +146,7 @@ class Github {
146146
owner: this.repoOwner,
147147
repo: this.repository,
148148
workflow_id: nameOrId,
149-
branch: branch,
149+
branch,
150150
per_page: 5
151151
})
152152

@@ -159,11 +159,11 @@ class Github {
159159
await octokit.pulls.create({
160160
owner: this.repoOwner,
161161
repo: this.repository,
162-
head: head,
163-
base: base,
164-
title: title,
165-
body: body,
166-
draft: draft
162+
head,
163+
base,
164+
title,
165+
body,
166+
draft
167167
})
168168
}
169169

@@ -181,7 +181,7 @@ class Github {
181181
release_id: id,
182182
body
183183
})
184-
} catch (err) {
184+
} catch {
185185
await new Promise((resolve) => {
186186
const retryWait = 2 ** retryCount * 1000
187187
console.log(

0 commit comments

Comments
 (0)