Skip to content

Commit

Permalink
build: fix dependencies as detected by eslint import/no-extraneous-de…
Browse files Browse the repository at this point in the history
…pendencies

This rule, with the configuration to specify test files, ensures packages used in `src` are listed
in the package.json `dependencies`. It will fail if missing or if the dependency is included with
`devDependencies`. Development dependencies are checked against the test directories.

There's a single disable as it's complaining about transitive dependency on `@types/pg` missing
from `dependencies`. We can see if the feature added in
import-js/eslint-plugin-import#2543 handles this scenario once released.
  • Loading branch information
rhyslbw committed Nov 7, 2022
1 parent 529b8fe commit 341b8f0
Show file tree
Hide file tree
Showing 15 changed files with 667 additions and 631 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
'consistent-return': 0,
// eslint compains about TS enums hence disable here and enable @typescript-eslint/no-shadow
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/test/**/*.ts'] }],
'jsdoc/require-param': 0,
'jsdoc/require-param-type': 0,
'jsdoc/require-returns': 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/cardano-services-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"@cardano-sdk/util": "^0.6.0",
"axios": "^0.27.2",
"class-validator": "^0.13.1",
"json-bigint": "~1.0.0"
"json-bigint": "~1.0.0",
"ts-log": "^2.2.4"
},
"files": [
"dist/*",
Expand Down
4 changes: 3 additions & 1 deletion packages/cardano-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"tscNoEmit": "shx echo typescript --noEmit command not implemented yet"
},
"devDependencies": {
"@cardano-ogmios/client": "5.5.5",
"@cardano-sdk/cardano-services-client": "^0.6.0",
"@cardano-sdk/util-dev": "^0.5.0",
"@types/amqplib": "^0.8.2",
Expand All @@ -73,7 +74,6 @@
"@types/lodash": "^4.14.182",
"@types/pg": "^8.6.5",
"@types/wait-on": "^5.3.1",
"axios": "^0.27.2",
"cbor": "^8.1.0",
"dockerode": "^3.3.1",
"dockerode-utils": "^0.0.7",
Expand All @@ -95,6 +95,8 @@
"@cardano-sdk/ogmios": "^0.6.0",
"@cardano-sdk/util": "^0.6.0",
"amqplib": "^0.10.0",
"axios": "^0.27.2",
"bignumber.js": "^9.1.0",
"body-parser": "^1.19.2",
"bunyan": "^1.8.15",
"clear": "^0.1.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,19 @@
"npm-run-all": "^4.1.5",
"shx": "^0.3.3",
"ts-jest": "^28.0.7",
"ts-log": "2.2.4",
"typescript": "^4.7.4"
},
"dependencies": {
"@cardano-ogmios/client": "5.5.5",
"@cardano-ogmios/schema": "5.5.5",
"@cardano-sdk/util": "^0.6.0",
"@dcspark/cardano-multiplatform-lib-browser": "^3.1.0",
"@dcspark/cardano-multiplatform-lib-nodejs": "^3.1.0",
"@emurgo/cip14-js": "^3.0.1",
"bech32": "^2.0.0",
"lodash": "^4.17.21",
"ts-custom-error": "^3.2.0"
"ts-custom-error": "^3.2.0",
"ts-log": "^2.2.4"
},
"files": [
"dist/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"dependencies": {
"@cardano-sdk/core": "^0.6.0",
"ts-custom-error": "^3.2.0",
"ts-log": "^2.2.3",
"ts-log": "^2.2.4",
"webextension-polyfill": "^0.8.0"
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"cardano-wallet-js": "^1.4.0",
"dotenv": "^16.0.1",
"envalid": "^7.3.1",
"get-port-please": "^2.5.0",
"lodash": "^4.17.21",
"optionator": "^0.9.1",
"rxjs": "^7.4.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/e2e/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
{
"path": "../../cardano-services/src"
},
{
"path": "../../cardano-services-client/src"
},
{
"path": "../../core/src"
},
{
"path": "../../key-management/src"
},
{
"path": "../../ogmios/src"
},
{
"path": "../../util-dev/src"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/e2e/src/util/is-local-network-ready.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-floating-promises */
import * as Process from 'process';
// This disable may not be require once https://github.com/import-js/eslint-plugin-import/pull/2543 is released.
// eslint-disable-next-line import/no-extraneous-dependencies
import { Pool, QueryResult } from 'pg';

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
Expand Down
3 changes: 3 additions & 0 deletions packages/golden-test-generator/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
{
"path": "../../core/src"
},
{
"path": "../../ogmios/src"
},
{
"path": "../../util/src"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/key-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@
"@ledgerhq/hw-transport": "^6.27.2",
"@ledgerhq/hw-transport-node-hid-noevents": "^6.27.2",
"@ledgerhq/hw-transport-webhid": "^6.27.2",
"bip39": "^3.0.4",
"chacha": "^2.1.0",
"get-random-values": "^2.0.0",
"lodash": "^4.17.21",
"pbkdf2": "^3.1.2",
"rxjs": "^7.4.0",
"trezor-connect": "8.2.11-extended"
"trezor-connect": "8.2.11-extended",
"ts-custom-error": "^3.2.0"
},
"files": [
"dist/*",
Expand Down
6 changes: 3 additions & 3 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
"jest": "^28.1.3",
"npm-run-all": "^4.1.5",
"shx": "^0.3.3",
"ts-custom-error": "^3.2.0",
"ts-jest": "^28.0.7",
"type-fest": "^2.19.0",
"typescript": "^4.7.4"
},
"dependencies": {
"lodash": "^4.17.21",
"serialize-error": "^8",
"ts-log": "^2.2.4"
"ts-custom-error": "^3.2.0",
"ts-log": "^2.2.4",
"type-fest": "^2.19.0"
},
"files": [
"dist/*",
Expand Down
1 change: 1 addition & 0 deletions packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"test:e2e": "shx echo 'test:e2e' command not implemented yet"
},
"devDependencies": {
"@cardano-foundation/ledgerjs-hw-app-cardano": "^5.0.0",
"@cardano-ogmios/client": "5.5.5",
"@cardano-sdk/ogmios": "^0.6.0",
"@cardano-sdk/util-dev": "^0.5.0",
Expand Down
1 change: 1 addition & 0 deletions packages/web-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@cardano-sdk/util-rxjs": "^0.4.2",
"lodash": "^4.17.21",
"rxjs": "^7.4.0",
"ts-custom-error": "^3.2.0",
"ts-log": "^2.2.3",
"uuid": "^8.3.2",
"webextension-polyfill": "^0.8.0"
Expand Down
Loading

0 comments on commit 341b8f0

Please sign in to comment.