Skip to content

Commit 1bd2860

Browse files
authored
chore: upgrade eslint-plugin-unicorn to v60.0.0 (#6148)
1 parent 3e3d0e2 commit 1bd2860

File tree

11 files changed

+73
-79
lines changed

11 files changed

+73
-79
lines changed

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ export default [
408408
'unicorn/prefer-at': 'off', // 17 errors | Difficult to fix
409409
'unicorn/prevent-abbreviations': 'off', // too strict
410410

411+
// These rules require a newer Node.js version than we support
412+
'unicorn/no-array-reverse': 'off', // Node.js 20
413+
411414
// These rules could potentially evaluated again at a much later point
412415
'unicorn/no-array-callback-reference': 'off',
413416
'unicorn/no-for-loop': 'off', // Activate if this is resolved https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2664

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"eslint-plugin-mocha": "^10.5.0",
166166
"eslint-plugin-n": "^17.20.0",
167167
"eslint-plugin-promise": "^7.2.1",
168-
"eslint-plugin-unicorn": "^59.0.1",
168+
"eslint-plugin-unicorn": "^60.0.0",
169169
"express": "^5.1.0",
170170
"get-port": "^5.1.1",
171171
"glob": "^7.2.3",
@@ -187,8 +187,5 @@
187187
"workerpool": "^9.2.0",
188188
"yaml": "^2.8.0",
189189
"yarn-deduplicate": "^6.0.2"
190-
},
191-
"resolutions": {
192-
"eslint-plugin-unicorn/@eslint/plugin-kit": "0.3.3"
193190
}
194191
}

packages/datadog-plugin-cypress/src/cypress-plugin.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,31 @@ function getSuiteStatus (suiteStats) {
223223
}
224224

225225
class CypressPlugin {
226-
constructor () {
227-
this._isInit = false
228-
this.testEnvironmentMetadata = getTestEnvironmentMetadata(TEST_FRAMEWORK_NAME)
226+
_isInit = false
227+
testEnvironmentMetadata = getTestEnvironmentMetadata(TEST_FRAMEWORK_NAME)
228+
229+
finishedTestsByFile = {}
230+
testStatuses = {}
231+
232+
isTestsSkipped = false
233+
isSuitesSkippingEnabled = false
234+
isCodeCoverageEnabled = false
235+
isFlakyTestRetriesEnabled = false
236+
isEarlyFlakeDetectionEnabled = false
237+
isKnownTestsEnabled = false
238+
earlyFlakeDetectionNumRetries = 0
239+
testsToSkip = []
240+
skippedTests = []
241+
hasForcedToRunSuites = false
242+
hasUnskippableSuites = false
243+
unskippableSuites = []
244+
knownTests = []
245+
isTestManagementTestsEnabled = false
246+
testManagementAttemptToFixRetries = 0
247+
isImpactedTestsEnabled = false
248+
modifiedTests = []
229249

250+
constructor () {
230251
const {
231252
[GIT_REPOSITORY_URL]: repositoryUrl,
232253
[GIT_COMMIT_SHA]: sha,
@@ -265,26 +286,6 @@ class CypressPlugin {
265286
commitHeadSha,
266287
commitHeadMessage
267288
}
268-
this.finishedTestsByFile = {}
269-
this.testStatuses = {}
270-
271-
this.isTestsSkipped = false
272-
this.isSuitesSkippingEnabled = false
273-
this.isCodeCoverageEnabled = false
274-
this.isFlakyTestRetriesEnabled = false
275-
this.isEarlyFlakeDetectionEnabled = false
276-
this.isKnownTestsEnabled = false
277-
this.earlyFlakeDetectionNumRetries = 0
278-
this.testsToSkip = []
279-
this.skippedTests = []
280-
this.hasForcedToRunSuites = false
281-
this.hasUnskippableSuites = false
282-
this.unskippableSuites = []
283-
this.knownTests = []
284-
this.isTestManagementTestsEnabled = false
285-
this.testManagementAttemptToFixRetries = 0
286-
this.isImpactedTestsEnabled = false
287-
this.modifiedTests = []
288289
}
289290

290291
// Init function returns a promise that resolves with the Cypress configuration

packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ const sensitiveHandler = require('./evidence-redaction/sensitive-handler')
44
const { stringifyWithRanges } = require('./utils')
55

66
class VulnerabilityFormatter {
7-
constructor () {
8-
this._redactVulnearbilities = true
9-
}
7+
_redactVulnearbilities = true
108

119
setRedactVulnerabilities (shouldRedactVulnerabilities, redactionNamePattern, redactionValuePattern) {
1210
this._redactVulnearbilities = shouldRedactVulnerabilities

packages/dd-trace/src/datastreams/schemas/schema_builder.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ class SchemaBuilder {
6666
}
6767

6868
class OpenApiSchema {
69-
constructor () {
70-
this.openapi = '3.0.0'
71-
this.components = new OpenApiComponents()
72-
}
69+
openapi = '3.0.0'
70+
components = new OpenApiComponents()
7371
}
7472

7573
OpenApiSchema.SCHEMA = class {
76-
constructor () {
77-
this.type = 'object'
78-
this.properties = {}
79-
}
74+
type = 'object'
75+
properties = {}
8076
}
8177

8278
OpenApiSchema.PROPERTY = class {

packages/dd-trace/src/datastreams/schemas/schema_sampler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
const SAMPLE_INTERVAL_MILLIS = 30 * 1000
44

55
class SchemaSampler {
6-
constructor () {
7-
this.weight = 0
8-
this.lastSampleMs = 0
9-
}
6+
weight = 0
7+
lastSampleMs = 0
108

119
trySample (currentTimeMs) {
1210
if (currentTimeMs >= this.lastSampleMs + SAMPLE_INTERVAL_MILLIS) {

packages/dd-trace/src/profiling/profilers/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@ function createPossionProcessSamplingFilter (samplingIntervalMillis) {
375375
* source with a sampling event filter and an event serializer.
376376
*/
377377
class EventsProfiler {
378-
constructor (options = {}) {
379-
this.type = 'events'
380-
this.eventSerializer = new EventSerializer()
378+
type = 'events'
379+
eventSerializer = new EventSerializer()
381380

381+
constructor (options = {}) {
382382
const eventHandler = event => this.eventSerializer.addEvent(event)
383383
const eventFilter = options.timelineSamplingEnabled
384384
// options.samplingInterval comes in microseconds, we need millis

packages/dd-trace/src/profiling/profilers/space.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ function strategiesToCallbackMode (strategies, callbackMode) {
88
}
99

1010
class NativeSpaceProfiler {
11+
type = 'space'
12+
_pprof
13+
_started = false
14+
1115
constructor (options = {}) {
12-
this.type = 'space'
1316
this._samplingInterval = options.heapSamplingInterval || 512 * 1024
1417
this._stackDepth = options.stackDepth || 64
15-
this._pprof = undefined
1618
this._oomMonitoring = options.oomMonitoring || {}
17-
this._started = false
1819
}
1920

2021
start ({ mapper, nearOOMCallback } = {}) {

packages/dd-trace/src/profiling/profilers/wall.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ function ensureChannelsActivated () {
6969
}
7070

7171
class NativeWallProfiler {
72+
type = 'wall'
73+
_mapper
74+
_pprof
75+
_started = false
76+
7277
constructor (options = {}) {
73-
this.type = 'wall'
7478
this._samplingIntervalMicros = options.samplingInterval || 1e6 / 99 // 99hz
7579
this._flushIntervalMillis = options.flushInterval || 60 * 1e3 // 60 seconds
7680
this._codeHotspotsEnabled = !!options.codeHotspotsEnabled
@@ -86,8 +90,6 @@ class NativeWallProfiler {
8690
// cpu profiling is enabled.
8791
this._withContexts = this._captureSpanData || this._timelineEnabled || this._cpuProfilingEnabled
8892
this._v8ProfilerBugWorkaroundEnabled = !!options.v8ProfilerBugWorkaroundEnabled
89-
this._mapper = undefined
90-
this._pprof = undefined
9193

9294
// Bind these to this so they can be used as callbacks
9395
if (this._withContexts && this._captureSpanData) {
@@ -97,7 +99,6 @@ class NativeWallProfiler {
9799
this._generateLabels = this._generateLabels.bind(this)
98100

99101
this._logger = options.logger
100-
this._started = false
101102
}
102103

103104
codeHotspotsEnabled () {

packages/dd-trace/src/remote_config/scheduler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use strict'
22

33
class Scheduler {
4+
_timer = null
5+
46
constructor (callback, interval) {
5-
this._timer = null
67
this._callback = callback
78
this._interval = interval
89
}

0 commit comments

Comments
 (0)