From 493b4533c2e2e9f602d98f89babc59a71f2f7ca6 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Thu, 14 Nov 2024 03:11:25 -0800 Subject: [PATCH] refactor: fewer irritating warnings (#10464) closes: #XXXX refs: #XXXX ## Description I noticed at the bottom of https://github.com/Agoric/agoric-sdk/pull/10359/files# in the section "Unchanged files with check annotations" that we still have unfixed irritating warning noise. Both from .go files (which I expected) and from .js files. This PR just attempts to silence the .js warnings. The "Unchanged files with check annotations" section of this PR no longer shows any warnings on .js files as intended. ### Security Considerations Persistent warnings that we ignore habituates us into ignoring warnings. By silencing warnings that we habitually ignore, we're more likely to notice new warnings that we should pay attention to. But of course, warnings should suggest code improvements. Silencing warnings with suboptimal "fixes" makes it less likely we fix these locations correctly in the future. So if there are better changes to make at these locations to make the warnings go away, please let me know. ### Scaling Considerations none ### Documentation Considerations It would be good to avoid giving devex advice such as "ignore these warnings", so silencing warnings that we habitually ignore would avoid the need for such advice. However, this PR still leaves the .go warnings, which we still seem to habitually ignore. ### Testing Considerations none ### Upgrade Considerations none --- .eslintrc.cjs | 3 +++ .../proposals/n:upgrade-next/synthetic-chain-excerpt.js | 1 - a3p-integration/proposals/z:acceptance/test-lib/vaults.js | 2 +- packages/SwingSet/test/metering/metered-code.js | 2 +- packages/deployment/src/init.js | 1 - packages/deployment/src/main.js | 1 - packages/network/test/fakes.js | 1 - packages/notifier/test/makeNotifierFromSubscriber.test.js | 2 -- 8 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1711f4831b6..fe5a25050e7 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -141,6 +141,9 @@ module.exports = { // CI has a separate format check but keep this warn to maintain that "eslint --fix" prettifies // UNTIL https://github.com/Agoric/agoric-sdk/issues/4339 'prettier/prettier': 'warn', + + // Not a risk with our coding style + 'no-constant-condition': 'off', }, settings: { jsdoc: { diff --git a/a3p-integration/proposals/n:upgrade-next/synthetic-chain-excerpt.js b/a3p-integration/proposals/n:upgrade-next/synthetic-chain-excerpt.js index 0c65ed69d5f..b9b73e812fd 100644 --- a/a3p-integration/proposals/n:upgrade-next/synthetic-chain-excerpt.js +++ b/a3p-integration/proposals/n:upgrade-next/synthetic-chain-excerpt.js @@ -57,7 +57,6 @@ const agdBinary = 'agd'; /** * @param {{execFileSync: typeof import('child_process').execFileSync }} io - * @returns */ export const makeAgd = ({ execFileSync }) => { /** diff --git a/a3p-integration/proposals/z:acceptance/test-lib/vaults.js b/a3p-integration/proposals/z:acceptance/test-lib/vaults.js index af37b718b4a..af854337567 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/vaults.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/vaults.js @@ -206,7 +206,7 @@ const paramChangeOfferGeneration = async ( * * @param {string} address * @param {*} debtLimit - * @returns + * @returns {Promise} */ export const proposeNewDebtCeiling = async (address, debtLimit) => { const charterAcceptOfferId = await agops.ec( diff --git a/packages/SwingSet/test/metering/metered-code.js b/packages/SwingSet/test/metering/metered-code.js index 05859f127ae..618a170e6cb 100644 --- a/packages/SwingSet/test/metering/metered-code.js +++ b/packages/SwingSet/test/metering/metered-code.js @@ -18,7 +18,7 @@ export function meterMe(log2, explode = 'no') { } try { if (explode === 'compute') { - // eslint-disable-next-line no-constant-condition, no-empty + // eslint-disable-next-line no-empty while (true) {} } else if (explode === 'stack') { delveForeverIntoTheRecursiveDepths(); diff --git a/packages/deployment/src/init.js b/packages/deployment/src/init.js index df9fcd7c316..b8590ff93c6 100644 --- a/packages/deployment/src/init.js +++ b/packages/deployment/src/init.js @@ -423,7 +423,6 @@ const doInit = } // Allocate the datacenters. - // eslint-disable-next-line no-constant-condition while (true) { const dcsWithNodeCount = dcs && diff --git a/packages/deployment/src/main.js b/packages/deployment/src/main.js index f550e9a37d7..f9c442edf8e 100644 --- a/packages/deployment/src/main.js +++ b/packages/deployment/src/main.js @@ -216,7 +216,6 @@ show-config display the client connection parameters }); await guardFile(`${PROVISION_DIR}/ssh_known_hosts.stamp`, async () => { - // eslint-disable-next-line no-constant-condition while (true) { const code = await reMain(['play', 'update_known_hosts']); if (code === 0) { diff --git a/packages/network/test/fakes.js b/packages/network/test/fakes.js index 9ad80dca982..566c605ce05 100644 --- a/packages/network/test/fakes.js +++ b/packages/network/test/fakes.js @@ -13,7 +13,6 @@ import { * @import {ListenHandler, MakeEchoConnectionKit} from '../src/index.js'; */ -// eslint-disable-next-line no-constant-condition const log = false ? console.log : () => {}; /** diff --git a/packages/notifier/test/makeNotifierFromSubscriber.test.js b/packages/notifier/test/makeNotifierFromSubscriber.test.js index 1193296736f..8ba52d65aeb 100644 --- a/packages/notifier/test/makeNotifierFromSubscriber.test.js +++ b/packages/notifier/test/makeNotifierFromSubscriber.test.js @@ -75,7 +75,6 @@ test('makeNotifierFromSubscriber(finishes) - getUpdateSince', async t => { const results = []; let updateCount; - // eslint-disable-next-line no-constant-condition while (true) { const result = await notifier.getUpdateSince(updateCount); ({ updateCount } = result); @@ -137,7 +136,6 @@ test('makeNotifierFromSubscriber(fails) - getUpdateSince', async t => { const results = []; let updateCount; try { - // eslint-disable-next-line no-constant-condition while (true) { const result = await notifier.getUpdateSince(updateCount); ({ updateCount } = result);