Skip to content

Commit 4ddda0b

Browse files
committed
chore(linter): enable no-unused-vars error
This makes it so that the linter will error out when there are unused variables. This is more important than it looks because unused imports can contribute a lot of overhead to the build artifact sizes. Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 8854039 commit 4ddda0b

File tree

44 files changed

+86
-222
lines changed

Some content is hidden

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

44 files changed

+86
-222
lines changed

.eslintrc.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ module.exports = {
1515
"no-prototype-builtins": "error",
1616
"@typescript-eslint/no-var-requires": "warn",
1717
"no-dupe-class-members": "off",
18-
"no-unused-vars": [
19-
"warn",
20-
{
21-
vars: "all",
22-
args: "after-used",
23-
ignoreRestSiblings: false,
24-
},
18+
"no-unused-vars": "off",
19+
"@typescript-eslint/no-unused-vars": [
20+
"error",
21+
{ ignoreRestSiblings: true },
2522
],
2623
indent: ["off"],
2724
semi: ["error", "always"],

examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
PluginLedgerConnectorQuorum,
3333
Web3SigningCredentialType,
3434
DefaultApi as QuorumApi,
35-
EthContractInvocationType,
3635
} from "@hyperledger/cactus-plugin-ledger-connector-quorum";
3736

3837
import {
@@ -41,10 +40,7 @@ import {
4140
} from "@hyperledger/cactus-plugin-ledger-connector-besu";
4241

4342
import { SupplyChainAppDummyInfrastructure } from "./infrastructure/supply-chain-app-dummy-infrastructure";
44-
import {
45-
BambooHarvest,
46-
SupplyChainCactusPlugin,
47-
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
43+
import { SupplyChainCactusPlugin } from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
4844

4945
export interface ISupplyChainAppOptions {
5046
logLevel?: LogLevelDesc;

examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/web-services/insert-bamboo-harvest-endpoint.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Express, Request, Response, NextFunction } from "express";
1+
import { Express, Request, Response } from "express";
22

33
import {
44
Logger,
@@ -39,7 +39,7 @@ export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {
3939

4040
private readonly log: Logger;
4141

42-
public get className() {
42+
public get className(): string {
4343
return InsertBambooHarvestEndpoint.CLASS_NAME;
4444
}
4545

@@ -76,11 +76,7 @@ export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {
7676
return this.handleRequest.bind(this);
7777
}
7878

79-
async handleRequest(
80-
req: Request,
81-
res: Response,
82-
next: NextFunction,
83-
): Promise<void> {
79+
async handleRequest(req: Request, res: Response): Promise<void> {
8480
const tag = `${this.getVerbLowerCase().toUpperCase()} ${this.getPath()}`;
8581
try {
8682
const { bambooHarvest } = req.body as InsertBambooHarvestRequest;

examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/web-services/insert-bookshelf-endpoint.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Express, Request, Response, NextFunction } from "express";
1+
import { Express, Request, Response } from "express";
22

33
import {
44
Logger,
@@ -39,7 +39,7 @@ export class InsertBookshelfEndpoint implements IWebServiceEndpoint {
3939

4040
private readonly log: Logger;
4141

42-
public get className() {
42+
public get className(): string {
4343
return InsertBookshelfEndpoint.CLASS_NAME;
4444
}
4545

@@ -76,11 +76,7 @@ export class InsertBookshelfEndpoint implements IWebServiceEndpoint {
7676
return this.handleRequest.bind(this);
7777
}
7878

79-
async handleRequest(
80-
req: Request,
81-
res: Response,
82-
next: NextFunction,
83-
): Promise<void> {
79+
async handleRequest(req: Request, res: Response): Promise<void> {
8480
const tag = `${this.getVerbLowerCase().toUpperCase()} ${this.getPath()}`;
8581
try {
8682
const { bookshelf } = req.body as InsertBookshelfRequest;

examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/web-services/list-bamboo-harvest-endpoint.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Express, Request, Response, NextFunction } from "express";
1+
import { Express, Request, Response } from "express";
22

33
import {
44
Logger,
@@ -75,11 +75,7 @@ export class ListBambooHarvestEndpoint implements IWebServiceEndpoint {
7575
return this.handleRequest.bind(this);
7676
}
7777

78-
async handleRequest(
79-
req: Request,
80-
res: Response,
81-
next: NextFunction,
82-
): Promise<void> {
78+
async handleRequest(req: Request, res: Response): Promise<void> {
8379
const tag = `${this.getVerbLowerCase().toUpperCase()} ${this.getPath()}`;
8480
try {
8581
this.log.debug(`${tag}`);

examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/web-services/list-bookshelf-endpoint.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Express, Request, Response, NextFunction } from "express";
1+
import { Express, Request, Response } from "express";
22

33
import {
44
Logger,
@@ -38,7 +38,7 @@ export class ListBookshelfEndpoint implements IWebServiceEndpoint {
3838

3939
private readonly log: Logger;
4040

41-
public get className() {
41+
public get className(): string {
4242
return ListBookshelfEndpoint.CLASS_NAME;
4343
}
4444

@@ -75,11 +75,7 @@ export class ListBookshelfEndpoint implements IWebServiceEndpoint {
7575
return this.handleRequest.bind(this);
7676
}
7777

78-
async handleRequest(
79-
req: Request,
80-
res: Response,
81-
next: NextFunction,
82-
): Promise<void> {
78+
async handleRequest(req: Request, res: Response): Promise<void> {
8379
const tag = `${this.getVerbLowerCase().toUpperCase()} ${this.getPath()}`;
8480
try {
8581
this.log.debug(`${tag}`);

examples/cactus-example-supply-chain-frontend/src/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from "@angular/core";
1+
import { Component } from "@angular/core";
22

33
import { Platform } from "@ionic/angular";
44
import { SplashScreen } from "@ionic-native/splash-screen/ngx";

examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-detail/bamboo-harvest-detail.page.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import { FormGroup, FormBuilder, Validators } from "@angular/forms";
55
import { ModalController } from "@ionic/angular";
66

77
import { ApiClient } from "@hyperledger/cactus-api-client";
8-
import {
9-
BambooHarvest,
10-
DefaultApi as SupplyChainApi,
11-
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
8+
import { BambooHarvest } from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
129

1310
import { QUORUM_DEMO_LEDGER_ID } from "../../../constants";
1411
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
@@ -55,13 +52,13 @@ export class BambooHarvestDetailPage implements OnInit {
5552
});
5653
}
5754

58-
onClickFormSubmit(value: any) {
55+
public onClickFormSubmit(value: any): void {
5956
this.log.debug("form submitted", value);
6057
this.bambooHarvest = value;
6158
this.modalController.dismiss(this.bambooHarvest);
6259
}
6360

64-
onClickBtnCancel() {
61+
public onClickBtnCancel(): void {
6562
this.log.debug("form submission cancelled by user");
6663
this.modalController.dismiss();
6764
}

examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-list/bamboo-harvest-list.page.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Component, Inject, OnInit } from "@angular/core";
22

3-
import { v4 as uuidv4 } from "uuid";
4-
53
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
64
import { ApiClient } from "@hyperledger/cactus-api-client";
75
import {

packages/cactus-cmd-api-server/src/main/typescript/cmd/cactus-api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const main = async () => {
2727
}
2828
};
2929

30-
export async function launchApp(cliOpts?: any): Promise<void> {
30+
export async function launchApp(): Promise<void> {
3131
try {
3232
await main();
3333
log.info(`Cactus API server launched OK `);

packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import test, { Test } from "tape-promise/tape";
22
import { v4 as uuidv4 } from "uuid";
33

4-
import { LogLevelDesc } from "@hyperledger/cactus-common";
5-
64
import { ApiServer, ConfigService } from "../../../main/typescript/public-api";
75

86
import {

packages/cactus-cmd-api-server/src/test/typescript/unit/config/self-signed-certificate-generator/certificates-work-for-mutual-tls-test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ tap.test("works with HTTPS NodeJS module", async (assert: any) => {
7979
),
8080
);
8181

82+
aServer.once("tlsClientError", (err: Error) => reject(err));
8283
aServer.once("listening", () => resolve(aServer));
8384
aServer.listen(0, "localhost");
8485
assert.tearDown(() => aServer.close());

packages/cactus-cockpit/src/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, Inject } from "@angular/core";
1+
import { Component, Inject } from "@angular/core";
22

33
import { Platform } from "@ionic/angular";
44
import { SplashScreen } from "@ionic-native/splash-screen/ngx";

packages/cactus-cockpit/src/app/app.module.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import "@angular/compiler";
2-
import { NgModule, APP_INITIALIZER, InjectionToken } from "@angular/core";
2+
import { NgModule } from "@angular/core";
33

4-
import { HttpClientModule } from "@angular/common/http";
54
import { BrowserModule } from "@angular/platform-browser";
65
import { RouteReuseStrategy } from "@angular/router";
76

packages/cactus-common/src/main/typescript/logging/logger.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import libLogLevel, {
2-
Logger as LogLevelLogger,
3-
levels,
4-
LogLevelDesc,
5-
} from "loglevel";
1+
import libLogLevel, { Logger as LogLevelLogger, LogLevelDesc } from "loglevel";
62
import prefix from "loglevel-plugin-prefix";
73

84
prefix.reg(libLogLevel);
@@ -46,7 +42,7 @@ export class Logger {
4642
this.backend.setLevel(logLevel);
4743
}
4844

49-
public async shutdown(gracePeriodMillis = 60000): Promise<void> {
45+
public async shutdown(): Promise<void> {
5046
this.backend.info("Shut down logger OK.");
5147
}
5248

packages/cactus-common/src/test/typescript/unit/js-object-signer.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ test("Circular JSON Test", async (assert: Test) => {
117117
};
118118
const jsObjectSigner = new JsObjectSigner(jsObjectSignerOptions);
119119

120-
const date: Date = new Date();
121-
122120
const obj: any = { a: "foo" };
123121
obj.b = obj;
124122

@@ -209,8 +207,7 @@ test("Test missing required constructor field", async (assert: Test) => {
209207
const jsObjectSignerOptions: IJsObjectSignerOptions = {
210208
privateKey: undefined,
211209
};
212-
213-
const jsObjectSigner = new JsObjectSigner(jsObjectSignerOptions);
210+
new JsObjectSigner(jsObjectSignerOptions);
214211
} catch (e) {
215212
assert.equal(e.message, "JsObjectSigner#ctor options.privateKey falsy.");
216213
}

packages/cactus-core-api/src/main/typescript/plugin/keychain/i-plugin-keychain.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ export interface IPluginKeychain extends ICactusPlugin {
1919
has(key: string): Promise<boolean>;
2020
get<T>(key: string): Promise<T>;
2121
set<T>(key: string, value: T): Promise<void>;
22-
delete<T>(key: string): Promise<void>;
22+
delete(key: string): Promise<void>;
2323
}

packages/cactus-plugin-consortium-manual/src/main/typescript/consortium/get-consortium-jws-endpoint-v1.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Express, Request, Response, NextFunction } from "express";
2-
import { AxiosResponse } from "axios";
1+
import { Express, Request, Response } from "express";
32

43
import {
54
IWebServiceEndpoint,
@@ -11,7 +10,6 @@ import {
1110
import {
1211
Configuration,
1312
DefaultApi,
14-
GetNodeJwsResponse,
1513
} from "../generated/openapi/typescript-axios";
1614

1715
import {
@@ -80,11 +78,7 @@ export class GetConsortiumEndpointV1 implements IWebServiceEndpoint {
8078
return this;
8179
}
8280

83-
async handleRequest(
84-
req: Request,
85-
res: Response,
86-
next: NextFunction,
87-
): Promise<void> {
81+
async handleRequest(req: Request, res: Response): Promise<void> {
8882
const fnTag = "GetConsortiumJwsEndpointV1#handleRequest()";
8983
this.log.debug(`GET ${this.getPath()}`);
9084

packages/cactus-plugin-consortium-manual/src/main/typescript/consortium/get-node-jws-endpoint-v1.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import uuid from "uuid";
2-
import { Express, Request, Response, NextFunction } from "express";
2+
import { Express, Request, Response } from "express";
33
import { JWS, JWK } from "jose";
44
import jsonStableStringify from "json-stable-stringify";
55

@@ -77,11 +77,7 @@ export class GetNodeJwsEndpoint implements IWebServiceEndpoint {
7777
return this;
7878
}
7979

80-
async handleRequest(
81-
req: Request,
82-
res: Response,
83-
next: NextFunction,
84-
): Promise<void> {
80+
async handleRequest(req: Request, res: Response): Promise<void> {
8581
try {
8682
this.log.debug(`GET ${this.getPath()}`);
8783

packages/cactus-plugin-consortium-manual/src/main/typescript/plugin-consortium-manual.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import {
1414
ICactusPluginOptions,
1515
} from "@hyperledger/cactus-core-api";
1616

17-
import {
18-
PluginRegistry,
19-
IConsortiumRepositoryOptions,
20-
ConsortiumRepository,
21-
} from "@hyperledger/cactus-core";
17+
import { PluginRegistry, ConsortiumRepository } from "@hyperledger/cactus-core";
2218

2319
import {
2420
Checks,
@@ -82,7 +78,7 @@ export class PluginConsortiumManual
8278
}
8379

8480
public async installWebServices(
85-
expressApp: any,
81+
expressApp: Express,
8682
): Promise<IWebServiceEndpoint[]> {
8783
const { log } = this;
8884

@@ -113,7 +109,6 @@ export class PluginConsortiumManual
113109
}
114110

115111
const { consortiumDatabase, keyPairPem } = this.options;
116-
const packageName = this.getPackageName();
117112
const consortiumRepo = new ConsortiumRepository({
118113
db: consortiumDatabase,
119114
});

0 commit comments

Comments
 (0)