Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused eslint disable directives #6444

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "lerna run build",
"build:watch": "lerna exec --parallel -- 'yarn run build:watch'",
"build:ifchanged": "lerna exec -- ../../scripts/build_if_changed.sh",
"lint": "eslint --color --ext .ts packages/*/src packages/*/test",
"lint": "eslint --report-unused-disable-directives --color --ext .ts packages/*/src packages/*/test",
"lint:fix": "yarn lint --fix",
"lint-dashboards": "node scripts/lint-grafana-dashboards.mjs ./dashboards",
"check-build": "lerna run check-build",
Expand Down
2 changes: 0 additions & 2 deletions packages/api/src/utils/server/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type {FastifyInstance, FastifyContextConfig} from "fastify";
// eslint-disable-next-line import/no-extraneous-dependencies
import type * as fastify from "fastify";
import {ReqGeneric} from "../types.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/api/test/unit/beacon/testData/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {GenericServerTestCases} from "../../../utils/genericServerTest.js";

const abortController = new AbortController();

/* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/naming-convention */

export const testData: GenericServerTestCases<Api> = {
eventstream: {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {MockedObject, vi} from "vitest";
import qs from "qs";
import {parse as parseQueryString} from "qs";
import {FastifyInstance, fastify} from "fastify";
import {mapValues} from "@lodestar/utils";
import {ServerApi} from "../../src/interfaces.js";

export function getTestServer(): {server: FastifyInstance; start: () => Promise<string>} {
const server = fastify({
ajv: {customOptions: {coerceTypes: "array"}},
querystringParser: (str) => qs.parse(str, {comma: true, parseArrays: false}),
querystringParser: (str) => parseQueryString(str, {comma: true, parseArrays: false}),
});

server.addHook("onError", (request, reply, error, done) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const workerData = worker.workerData as NetworkWorkerData;
const parentPort = worker.parentPort;
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (!workerData) throw Error("workerData must be defined");
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (!parentPort) throw Error("parentPort must be defined");

const config = createBeaconConfig(chainConfigFromJson(workerData.chainConfigJson), workerData.genesisValidatorsRoot);
Expand Down
2 changes: 0 additions & 2 deletions packages/beacon-node/src/network/peers/score/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,12 @@ export class MaxScore implements IPeerScore {
return DEFAULT_SCORE;
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
add(): void {}

update(): number {
return MAX_SCORE;
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
updateGossipsubScore(): void {}

getStat(): PeerScoreStat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export class ReqRespBeaconNode extends ReqResp {
* Any protocol not in this list must be un-subscribed.
*/
private getProtocolsAtFork(fork: ForkName): [ProtocolNoHandler, ProtocolHandler][] {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const protocolsAtFork: [ProtocolNoHandler, ProtocolHandler][] = [
[protocols.Ping(this.config), this.onPing.bind(this)],
[protocols.Status(this.config), this.onStatus.bind(this)],
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/util/kzg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const G2POINT_COUNT = 65;
const TOTAL_SIZE = 2 * POINT_COUNT_BYTES + G1POINT_BYTES * G1POINT_COUNT + G2POINT_BYTES * G2POINT_COUNT;

export async function initCKZG(): Promise<void> {
/* eslint-disable import/no-extraneous-dependencies, @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
ckzg = (await import("c-kzg")).default as typeof ckzg;
/* eslint-enable import/no-extraneous-dependencies, @typescript-eslint/ban-ts-comment */
/* eslint-enable @typescript-eslint/ban-ts-comment */
}

export enum TrustedFileMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export async function getEchoWorker(): Promise<EchoWorker> {
const workerThreadjs = new Worker("./workerEcho.js");
const worker = workerThreadjs as unknown as workerThreads.Worker;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
await spawn<any>(workerThreadjs, {
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
// the initialization to timeout. The number below is big enough to almost disable the timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe("network / peers / PeerManager", function () {
const reqResp = new ReqRespFake();
const peerRpcScores = new PeerRpcScoreStore();
const networkEventBus = new NetworkEventBus();
/* eslint-disable @typescript-eslint/no-empty-function */
const mockSubnetsService: IAttnetsService = {
getActiveSubnets: () => [],
shouldProcess: () => true,
Expand Down
6 changes: 1 addition & 5 deletions packages/beacon-node/test/e2e/network/reqresp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import {arrToSource} from "../../unit/network/reqresp/utils.js";
import {GetReqRespHandlerFn, ReqRespMethod} from "../../../src/network/reqresp/types.js";
import {PeerIdStr} from "../../../src/util/peerId.js";

/* eslint-disable
require-yield,
@typescript-eslint/naming-convention,
@typescript-eslint/explicit-function-return-type
*/
/* eslint-disable require-yield, @typescript-eslint/naming-convention */

describe(
"network / reqresp / main thread",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {testLogger} from "../../utils/logger.js";
import {GetReqRespHandlerFn} from "../../../src/network/reqresp/types.js";
import {LocalStatusCache} from "../../../src/network/statusCache.js";

/* eslint-disable require-yield, @typescript-eslint/naming-convention */
/* eslint-disable require-yield */

describe("reqresp encoder", () => {
let port = 60000;
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/e2e/sync/finalizedSync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe(
it("should do a finalized sync from another BN", async function () {
// single node at beginning, use main thread to verify bls
const genesisSlotsDelay = 4;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const genesisTime = Math.floor(Date.now() / 1000) + genesisSlotsDelay * testParams.SECONDS_PER_SLOT;

const testLoggerOpts: TestLoggerOpts = {
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/mocks/mockedBeaconDb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import {vi, Mocked} from "vitest";
import {config as minimalConfig} from "@lodestar/config/default";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe("produceBlockBody", () => {
config: state.config,
db,
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
metrics: null,
anchorState: state,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-relative-packages
import {itBench, setBenchOpts} from "@dapplion/benchmark";
import {expect} from "chai";
import {ssz} from "@lodestar/types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ describe.skip("verify+import blocks - range sync perf test", () => {
config: state.config,
db,
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
metrics: null,
anchorState: state,
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/sim/4844-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
}
});

// eslint-disable-next-line vitest/expect-expect
it("Post-merge, run for a few blocks", async function () {
console.log("\n\nPost-merge, run for a few blocks\n\n");
const {elClient, tearDownCallBack} = await runEL(
Expand Down
3 changes: 0 additions & 3 deletions packages/beacon-node/test/sim/merge-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
}
});

// eslint-disable-next-line vitest/expect-expect
it("Send stub payloads to EL", async () => {
const {elClient, tearDownCallBack} = await runEL(
{...elSetupConfig, mode: ELStartMode.PostMerge},
Expand Down Expand Up @@ -203,7 +202,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
*/
});

// eslint-disable-next-line vitest/expect-expect
it("Post-merge, run for a few blocks", async function () {
console.log("\n\nPost-merge, run for a few blocks\n\n");
const {elClient, tearDownCallBack} = await runEL(
Expand All @@ -220,7 +218,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
});
});

// eslint-disable-next-line vitest/expect-expect
it("Pre-merge, run for a few blocks", async function () {
console.log("\n\nPre-merge, run for a few blocks\n\n");
const {elClient, tearDownCallBack} = await runEL(
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/sim/mergemock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
});

for (const useProduceBlockV3 of [false, true]) {
// eslint-disable-next-line vitest/expect-expect
it(`Test builder with useProduceBlockV3=${useProduceBlockV3}`, async function () {
console.log("\n\nPost-merge, run for a few blocks\n\n");
const {elClient, tearDownCallBack} = await runEL(
Expand Down
2 changes: 0 additions & 2 deletions packages/beacon-node/test/sim/withdrawal-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
}
});

// eslint-disable-next-line vitest/expect-expect
it("Send stub payloads to EL", async () => {
const {elClient, tearDownCallBack} = await runEL(
{...elSetupConfig, mode: ELStartMode.PostMerge, genesisTemplate: "genesisPostWithdraw.tmpl"},
Expand Down Expand Up @@ -185,7 +184,6 @@ describe("executionEngine / ExecutionEngineHttp", function () {
);
});

// eslint-disable-next-line vitest/expect-expect
it("Post-merge, run for a few blocks", async function () {
console.log("\n\nPost-merge, run for a few blocks\n\n");
const {elClient, tearDownCallBack} = await runEL(
Expand Down
2 changes: 0 additions & 2 deletions packages/beacon-node/test/spec/presets/fork_choice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const forkChoiceTest =
config: createBeaconConfig(config, state.genesisValidatorsRoot),
db: getMockedBeaconDb(),
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
clock,
metrics: null,
Expand Down Expand Up @@ -367,7 +366,6 @@ const forkChoiceTest =
};
},
timeout: 10000,
// eslint-disable-next-line @typescript-eslint/no-empty-function
expectFunc: () => {},
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
// EXCEPTION : this test skipped here because prefix match can't be don't for this particular test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export const sync: TestRunnerFn<SyncTestCase, void> = (fork) => {
} as SyncTestCase;
},
timeout: 10000,
// eslint-disable-next-line @typescript-eslint/no-empty-function
expectFunc: () => {},
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ newUpdate = ${renderUpdate(newUpdate)}
? ssz.allForksLightClient[fork].LightClientUpdate
: ssz.altair.LightClientUpdate,
},
// eslint-disable-next-line @typescript-eslint/no-empty-function
expectFunc: () => {},
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const sszStatic =

for (const testCase of fs.readdirSync(testSuiteDirpath)) {
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
// eslint-disable-next-line vitest/consistent-test-it
it(testCase, function () {
// Mainnet must deal with big full states and hash each one multiple times
if (ACTIVE_PRESET === "mainnet") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import {describe, it, expect, beforeAll} from "vitest";
import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js";
import {getBeaconApi} from "../../../../../src/api/impl/beacon/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {afterEach, beforeEach, describe, expect, it, vi} from "vitest";
import {ForkName} from "@lodestar/params";
import {SignatureSetType} from "@lodestar/state-transition";
import {ssz} from "@lodestar/types";
// eslint-disable-next-line import/no-relative-packages
import {BlsSingleThreadVerifier} from "../../../../../src/chain/bls/singleThread.js";
import {AttestationError, AttestationErrorCode, GossipAction} from "../../../../../src/chain/errors/index.js";
import {IBeaconChain} from "../../../../../src/chain/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js";

describe("Light Client Optimistic Update validation", function () {
const afterEachCallbacks: (() => Promise<void> | void)[] = [];
// eslint-disable-next-line @typescript-eslint/naming-convention
const config = createChainForkConfig({
...defaultChainConfig,
/* eslint-disable @typescript-eslint/naming-convention */
Expand Down
3 changes: 0 additions & 3 deletions packages/beacon-node/test/unit/network/reqresp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ export class MockLibP2pStream implements Stream {
this.resultChunks.push(chunk.subarray());
}
};
// eslint-disable-next-line @typescript-eslint/no-empty-function
close: Stream["close"] = async () => {};
// eslint-disable-next-line @typescript-eslint/no-empty-function
closeRead = async (): Promise<void> => {};
// eslint-disable-next-line @typescript-eslint/no-empty-function
closeWrite = async (): Promise<void> => {};
abort: Stream["abort"] = () => this.close();
}
2 changes: 0 additions & 2 deletions packages/beacon-node/test/unit/sync/range/chain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe("sync / range / chain", () => {
const zeroBlockBody = ssz.phase0.BeaconBlockBody.defaultValue();
const interval: NodeJS.Timeout | null = null;

// eslint-disable-next-line @typescript-eslint/no-empty-function
const reportPeer: SyncChainFns["reportPeer"] = () => {};

afterEach(() => {
Expand Down Expand Up @@ -124,7 +123,6 @@ describe("sync / range / chain", () => {
const targetEpoch = 16;
const peers = [peer];

// eslint-disable-next-line @typescript-eslint/no-empty-function
const processChainSegment: SyncChainFns["processChainSegment"] = async () => {};
const downloadBeaconBlocksByRange: SyncChainFns["downloadBeaconBlocksByRange"] = async (peer, request) => {
const blocks: BlockInput[] = [];
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/utils/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {Mocked} from "vitest";
import {config} from "@lodestar/config/default";
import {ForkChoice} from "@lodestar/fork-choice";
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/utils/networkWithMockDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export async function getNetworkForTest(
config: beaconConfig,
db,
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
// set genesis time so that we are at ALTAIR_FORK_EPOCH
// mock timer does not work on worker thread
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/utils/node/beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export async function getDevBeaconNode(
config: beaconConfig,
db,
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
peerId,
peerStoreDir,
Expand Down
1 change: 0 additions & 1 deletion packages/beacon-node/test/utils/node/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export async function getAndInitDevValidators({
api: useRestApi ? getNodeApiUrl(node) : getApiFromServerHandlers(node.api),
slashingProtection,
logger,
// eslint-disable-next-line @typescript-eslint/no-empty-function
processShutdownCallback: () => {},
abortController,
signers,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/applyPreset.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// MUST import this file first before anything and not import any Lodestar code.

// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
// eslint-disable-next-line no-restricted-imports
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js";
// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
// eslint-disable-next-line no-restricted-imports
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js";

// without setting this first, persistent-merkle-tree will use noble instead
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/util/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export function registerCommandToYargs(yargs: Argv, cliCommand: CliCommand<any,
}
return yargs;
},
// eslint-disable-next-line @typescript-eslint/no-empty-function
handler: cliCommand.handler || function emptyHandler(): void {},
});
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import fs from "node:fs";
import {mkdir, writeFile} from "node:fs/promises";
import path from "node:path";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {writeFile} from "node:fs/promises";
import path from "node:path";
import got, {RequestError} from "got";
Expand Down
1 change: 0 additions & 1 deletion packages/cli/test/utils/simulation/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export interface ExecutionGeneratorOptions<E extends ExecutionClient = Execution

export type LodestarAPI = Api;
export type LighthouseAPI = Omit<Api, "lodestar"> & {
// eslint-disable-next-line @typescript-eslint/naming-convention
lighthouse: {
getPeers(): Promise<{
status: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import {ChildProcess} from "node:child_process";
import {sleep} from "@lodestar/utils";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {writeFile} from "node:fs/promises";
import got, {RequestError} from "got";
Expand Down
1 change: 0 additions & 1 deletion packages/flare/src/util/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function registerCommandToYargs(yargs: Argv, cliCommand: CliCommand<any,
}
return yargs;
},
// eslint-disable-next-line @typescript-eslint/no-empty-function
handler: cliCommand.handler || function emptyHandler(): void {},
});
}
1 change: 0 additions & 1 deletion packages/light-client/src/spec/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export function upgradeLightClientHeader(
`Invalid startUpgradeFromFork=${startUpgradeFromFork} for headerFork=${headerFork} in upgradeLightClientHeader to targetFork=${targetFork}`
);

// eslint-disable-next-line no-fallthrough
case ForkName.altair:
case ForkName.bellatrix:
// Break if no further upgradation is required else fall through
Expand Down
Loading
Loading