From a29269a0de809c66e58b87dae8bc0fcd47bf277e Mon Sep 17 00:00:00 2001 From: Arya Date: Tue, 17 Dec 2024 12:17:32 +0530 Subject: [PATCH] chore: updated the eslint rule to disable no-restricted-syntax --- .eslintrc.js | 1 + bin/currency/generate-currency-report.js | 1 - packages/autoprofile/lib/profile.js | 2 -- packages/autoprofile/lib/samplers/allocation_sampler.js | 1 - packages/autoprofile/lib/samplers/async_sampler.js | 2 -- packages/autoprofile/lib/samplers/cpu_sampler.js | 1 - packages/collector/src/announceCycle/defaultGatewayParser.js | 1 - packages/collector/test/tracing/database/redis/app.js | 1 - packages/collector/test/tracing/messaging/nats/subscriber.js | 2 -- packages/core/src/tracing/instrumentation/messaging/nats.js | 2 -- packages/core/src/util/clone.js | 1 - packages/core/src/util/compression.js | 3 +-- packages/shared-metrics/src/healthchecks.js | 1 - 13 files changed, 2 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b5424c1975..83e6092115 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -70,6 +70,7 @@ module.exports = { 'no-plusplus': 'off', 'no-promise-executor-return': 'off', 'no-restricted-globals': 'off', + 'no-restricted-syntax': 'off', 'no-underscore-dangle': 'off', 'no-use-before-define': ['error', 'nofunc'], 'no-var': 'error', diff --git a/bin/currency/generate-currency-report.js b/bin/currency/generate-currency-report.js index 30b44385b7..051126cea1 100644 --- a/bin/currency/generate-currency-report.js +++ b/bin/currency/generate-currency-report.js @@ -129,7 +129,6 @@ function jsonToMarkdown(data) { // eslint-disable-next-line max-len '|--------------|---------|---------|-----------------------------|----------------|-------------|------------|------|--------------|--------------|\n'; - // eslint-disable-next-line no-restricted-syntax for (const entry of data) { // eslint-disable-next-line max-len markdown += `| ${entry.name} | ${entry.lastSupportedVersion} | ${entry.latestVersion} | ${entry.publishedAt} | ${entry.policy} | ${entry.daysBehind} day/s | ${entry.upToDate} | ${entry.note} | ${entry.cloudNative} | ${entry.isBeta} |\n`; diff --git a/packages/autoprofile/lib/profile.js b/packages/autoprofile/lib/profile.js index b42077c11a..7510aef722 100644 --- a/packages/autoprofile/lib/profile.js +++ b/packages/autoprofile/lib/profile.js @@ -3,8 +3,6 @@ * (c) Copyright Instana Inc. and contributors 2020 */ -/* eslint-disable no-restricted-syntax */ - 'use strict'; const process = require('process'); diff --git a/packages/autoprofile/lib/samplers/allocation_sampler.js b/packages/autoprofile/lib/samplers/allocation_sampler.js index 731524bd94..ef809f0168 100644 --- a/packages/autoprofile/lib/samplers/allocation_sampler.js +++ b/packages/autoprofile/lib/samplers/allocation_sampler.js @@ -62,7 +62,6 @@ class AllocationSampler { buildProfile(duration, timespan) { const roots = new Set(); - // eslint-disable-next-line no-restricted-syntax for (const child of this.top.children.values()) { roots.add(child); } diff --git a/packages/autoprofile/lib/samplers/async_sampler.js b/packages/autoprofile/lib/samplers/async_sampler.js index 9a75f593d8..2240484c21 100644 --- a/packages/autoprofile/lib/samplers/async_sampler.js +++ b/packages/autoprofile/lib/samplers/async_sampler.js @@ -3,8 +3,6 @@ * (c) Copyright Instana Inc. and contributors 2020 */ -/* eslint-disable no-restricted-syntax */ - 'use strict'; const { uninstrumentedFs: fs } = require('@instana/core'); diff --git a/packages/autoprofile/lib/samplers/cpu_sampler.js b/packages/autoprofile/lib/samplers/cpu_sampler.js index e720a7c654..9c8bb9a057 100644 --- a/packages/autoprofile/lib/samplers/cpu_sampler.js +++ b/packages/autoprofile/lib/samplers/cpu_sampler.js @@ -50,7 +50,6 @@ class CpuSampler { buildProfile(duration, timespan) { const roots = new Set(); - // eslint-disable-next-line no-restricted-syntax for (const child of this.top.children.values()) { roots.add(child); } diff --git a/packages/collector/src/announceCycle/defaultGatewayParser.js b/packages/collector/src/announceCycle/defaultGatewayParser.js index dff2bd4b26..c08ca53bc1 100644 --- a/packages/collector/src/announceCycle/defaultGatewayParser.js +++ b/packages/collector/src/announceCycle/defaultGatewayParser.js @@ -51,7 +51,6 @@ exports._parseFile = async function _parseFile(filename) { } logger.debug(`Successfully opened ${filename} for reading to determine the default gateway IP.`); - // eslint-disable-next-line no-restricted-syntax for (const line of fileContent.split('\n')) { const fields = line.split('\t'); if (exports._isDefaultGatewayLine(fields)) { diff --git a/packages/collector/test/tracing/database/redis/app.js b/packages/collector/test/tracing/database/redis/app.js index 1da94a24ee..5824a075e8 100644 --- a/packages/collector/test/tracing/database/redis/app.js +++ b/packages/collector/test/tracing/database/redis/app.js @@ -140,7 +140,6 @@ app.get('/blocking', async (req, res) => { }); app.get('/scan-iterator', async (req, res) => { - // eslint-disable-next-line no-restricted-syntax for await (const key of connection.scanIterator()) { try { await connection.get(key); diff --git a/packages/collector/test/tracing/messaging/nats/subscriber.js b/packages/collector/test/tracing/messaging/nats/subscriber.js index 46df255506..1d08b7b9fa 100644 --- a/packages/collector/test/tracing/messaging/nats/subscriber.js +++ b/packages/collector/test/tracing/messaging/nats/subscriber.js @@ -38,7 +38,6 @@ if (process.env.NATS_VERSION === 'latest') { const sub = nats.subscribe('publish-test-subject'); (async () => { - // eslint-disable-next-line no-restricted-syntax for await (const m of sub) { const msg = sc.decode(m.data); log(`publish-test-subject: received: "${msg}"`); @@ -57,7 +56,6 @@ if (process.env.NATS_VERSION === 'latest') { let currentSpan; (async () => { - // eslint-disable-next-line no-restricted-syntax for await (const m of sub2) { const msg = sc.decode(m.data); log(`subscribe-test-subject: received: "${msg}"`); diff --git a/packages/core/src/tracing/instrumentation/messaging/nats.js b/packages/core/src/tracing/instrumentation/messaging/nats.js index a1f8eb3876..54a90e1877 100644 --- a/packages/core/src/tracing/instrumentation/messaging/nats.js +++ b/packages/core/src/tracing/instrumentation/messaging/nats.js @@ -302,7 +302,6 @@ function instrumentedSubscribe(ctx, originalSubscribe, originalSubscribeArgs, is const createIterator = async function* instanaIterator() { cls.ns.enter(currentCtx); - // eslint-disable-next-line no-restricted-syntax for await (const msg of sub) { await new Promise(resolve => { instrumentedSubscribeCallback(ctx._natsUrl, subject, resolve, currentCtx, isLatest)(null, msg); @@ -332,7 +331,6 @@ function instrumentedSubscribeCallback(natsUrl, subject, originalSubscribeCallba } if (isLatest && msg && msg.headers) { - // eslint-disable-next-line no-restricted-syntax for (const [key, value] of msg.headers) { if (key === constants.traceLevelHeaderName && value[0] === '0') { suppressed = true; diff --git a/packages/core/src/util/clone.js b/packages/core/src/util/clone.js index 2cee8267aa..84ba2639e1 100644 --- a/packages/core/src/util/clone.js +++ b/packages/core/src/util/clone.js @@ -29,7 +29,6 @@ module.exports = function clone(x) { if (typeof x === 'object') { r = {}; - // eslint-disable-next-line no-restricted-syntax for (const key in x) { // eslint-disable-next-line no-prototype-builtins if (x.hasOwnProperty(key)) { diff --git a/packages/core/src/util/compression.js b/packages/core/src/util/compression.js index 499015c9bf..124580cdce 100644 --- a/packages/core/src/util/compression.js +++ b/packages/core/src/util/compression.js @@ -67,7 +67,6 @@ function applyCompressionToObject(path, prev, next, excludeList) { const result = {}; let addedProps = 0; - // eslint-disable-next-line no-restricted-syntax for (const nKey in next) { // eslint-disable-next-line no-prototype-builtins if (next.hasOwnProperty(nKey)) { @@ -121,7 +120,7 @@ function isExcluded(path, excludeList) { } // Compare the given path to all excludeList entries. - // eslint-disable-next-line no-restricted-syntax + outer: for (let i = 0; i < excludeList.length; i++) { if (excludeList[i].length !== path.length) { // The excludeList entry and then given path have different lengths, this cannot be a match. Continue with next diff --git a/packages/shared-metrics/src/healthchecks.js b/packages/shared-metrics/src/healthchecks.js index 1e51174f95..b1f3e4c0f1 100644 --- a/packages/shared-metrics/src/healthchecks.js +++ b/packages/shared-metrics/src/healthchecks.js @@ -57,7 +57,6 @@ function gatherHealthcheckResults() { /** @type {Object.} */ const previousResults = exports.currentPayload; - // eslint-disable-next-line no-restricted-syntax for (const key in adminHealthcheckResults) { // eslint-disable-next-line no-prototype-builtins if (adminHealthcheckResults.hasOwnProperty(key)) {