Page MenuHomePhabricator

[token-server] Fix ts lint and add to arc lint
ClosedPublic

Authored by bytesofman on Wed, Nov 20, 22:42.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC129c036f5ae1: [token-server] Fix ts lint and add to arc lint
Summary

As I learn more about how to properly implement typescript, figuring out some initial implementations were not great. For token-server, the linter was not properly configured.

Properly configure the linter. Fix existing lint issues.

Because "properly configured" also means "works well with arclint" for ABC monorepo apps -- set that up to confirm this also works.

Test Plan

npm test, arc lint -- apps/token-server/**/*

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fix newline, back out unrelated change

Tail of the build log:

3 vulnerabilities (1 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
Test depends on ecash-lib. Building TypeScript...
/work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/token-server-tests

added 363 packages, and audited 366 packages in 2s

60 packages are looking for funding
  run `npm fund` for details

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-lib@0.2.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Test does not depend on ecash-agora
Test does not depend on ecash-script, skipping ecash-script dependencies...
Test does not depend on ecash-coinselect, skipping ecash-coinselect dependencies...
/work/apps/token-server /work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/token-server-tests
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 647 packages, and audited 652 packages in 6s

126 packages are looking for funding
  run `npm fund` for details

12 vulnerabilities (3 low, 5 moderate, 4 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
CI configured to test build. Building...

> token-server@0.0.0 prebuild
> ts-node scripts/prepSecrets.ts

secrets.ts does not exist, copying secrets.sample.ts...

> token-server@0.0.0 build
> tsc -p ./tsconfig.build.json

index.ts(42,21): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
  'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Build token-server-tests failed with exit code 2

Tail of the build log:

3 vulnerabilities (1 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
Test depends on ecash-lib. Building TypeScript...
/work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/token-server-tests

added 363 packages, and audited 366 packages in 2s

60 packages are looking for funding
  run `npm fund` for details

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-lib@0.2.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Test does not depend on ecash-agora
Test does not depend on ecash-script, skipping ecash-script dependencies...
Test does not depend on ecash-coinselect, skipping ecash-coinselect dependencies...
/work/apps/token-server /work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/token-server-tests
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 647 packages, and audited 652 packages in 6s

126 packages are looking for funding
  run `npm fund` for details

12 vulnerabilities (3 low, 5 moderate, 4 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
CI configured to test build. Building...

> token-server@0.0.0 prebuild
> ts-node scripts/prepSecrets.ts

secrets.ts does not exist, copying secrets.sample.ts...

> token-server@0.0.0 build
> tsc -p ./tsconfig.build.json

index.ts(42,21): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
  'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Build token-server-tests failed with exit code 2
This revision is now accepted and ready to land.Thu, Nov 21, 04:37