From d94999387c9cc66a08bdacd765ccf2ffc0257f9c Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 25 Oct 2023 09:44:23 -0700 Subject: [PATCH] chore: make linting consistent across projects in some cases we weren't running prettier, and in some cases we weren't linting - try to make things more consistent across packages --- packages/capabilities/package.json | 2 +- packages/did-mailto/package.json | 2 +- packages/filecoin-api/package.json | 2 +- packages/filecoin-api/src/aggregator/api.ts | 6 +++++- packages/filecoin-api/src/deal-tracker/api.ts | 6 +++++- packages/filecoin-api/src/storefront/api.ts | 6 +++++- packages/filecoin-api/test/aggregator.spec.js | 4 ++-- packages/filecoin-api/test/context/service.js | 2 +- packages/filecoin-api/test/deal-tracker.spec.js | 2 +- packages/filecoin-api/test/dealer.spec.js | 4 ++-- packages/filecoin-api/test/lib.js | 8 ++++---- packages/filecoin-api/test/storefront.spec.js | 4 ++-- packages/filecoin-client/package.json | 2 +- packages/upload-api/package.json | 2 +- packages/upload-api/test/storage/provisions-storage.js | 3 ++- packages/upload-client/package.json | 2 +- 16 files changed, 35 insertions(+), 22 deletions(-) diff --git a/packages/capabilities/package.json b/packages/capabilities/package.json index 056243cf6..96b6483ea 100644 --- a/packages/capabilities/package.json +++ b/packages/capabilities/package.json @@ -13,7 +13,7 @@ "types": "dist/src/index.d.ts", "main": "src/index.js", "scripts": { - "lint": "tsc && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", + "lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "build": "tsc --build", "check": "tsc --build", "test": "pnpm run test:node && pnpm run test:browser", diff --git a/packages/did-mailto/package.json b/packages/did-mailto/package.json index e611bd614..0dc535262 100644 --- a/packages/did-mailto/package.json +++ b/packages/did-mailto/package.json @@ -26,7 +26,7 @@ "scripts": { "build": "tsc --build", "check": "tsc --build", - "lint": "tsc --build", + "lint": "tsc --build && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules -n experimental-fetch test/**/*.spec.js", "test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test" }, diff --git a/packages/filecoin-api/package.json b/packages/filecoin-api/package.json index 9e296080a..cfac7ec12 100644 --- a/packages/filecoin-api/package.json +++ b/packages/filecoin-api/package.json @@ -133,7 +133,7 @@ "scripts": { "build": "tsc --build", "check": "tsc --build", - "lint": "tsc --build", + "lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules -n experimental-fetch test/**/*.spec.js", "test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test" }, diff --git a/packages/filecoin-api/src/aggregator/api.ts b/packages/filecoin-api/src/aggregator/api.ts index dbc3ac5be..0a4576256 100644 --- a/packages/filecoin-api/src/aggregator/api.ts +++ b/packages/filecoin-api/src/aggregator/api.ts @@ -19,7 +19,11 @@ export type BufferQueue = Queue export type BufferStore = Store export type AggregateStore = Store export type PieceAcceptQueue = Queue -export type InclusionStore = QueryableStore +export type InclusionStore = QueryableStore< + InclusionRecordKey, + InclusionRecord, + InclusionRecordQueryByGroup +> export type AggregateOfferQueue = Queue export interface ServiceContext { diff --git a/packages/filecoin-api/src/deal-tracker/api.ts b/packages/filecoin-api/src/deal-tracker/api.ts index 810c72bb4..db7f0495c 100644 --- a/packages/filecoin-api/src/deal-tracker/api.ts +++ b/packages/filecoin-api/src/deal-tracker/api.ts @@ -2,7 +2,11 @@ import type { Signer } from '@ucanto/interface' import { PieceLink } from '@web3-storage/data-segment' import { QueryableStore } from '../types.js' -export type DealStore = QueryableStore +export type DealStore = QueryableStore< + DealRecordKey, + DealRecord, + DealRecordQueryByPiece +> export interface ServiceContext { /** diff --git a/packages/filecoin-api/src/storefront/api.ts b/packages/filecoin-api/src/storefront/api.ts index f8531c65d..9df32828d 100644 --- a/packages/filecoin-api/src/storefront/api.ts +++ b/packages/filecoin-api/src/storefront/api.ts @@ -18,7 +18,11 @@ import { ServiceConfig, } from '../types.js' -export type PieceStore = UpdatableAndQueryableStore> +export type PieceStore = UpdatableAndQueryableStore< + PieceRecordKey, + PieceRecord, + Pick +> export type FilecoinSubmitQueue = Queue export type PieceOfferQueue = Queue export type TaskStore = Store diff --git a/packages/filecoin-api/test/aggregator.spec.js b/packages/filecoin-api/test/aggregator.spec.js index f0125c629..e2804107f 100644 --- a/packages/filecoin-api/test/aggregator.spec.js +++ b/packages/filecoin-api/test/aggregator.spec.js @@ -64,7 +64,7 @@ describe('Aggregator', () => { pieceAcceptQueue, aggregateOfferQueue, queuedMessages, - validateAuthorization + validateAuthorization, } ) }) @@ -147,7 +147,7 @@ describe('Aggregator', () => { minAggregateSize: 2 ** 34, minUtilizationFactor: 4, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/context/service.js b/packages/filecoin-api/test/context/service.js index 5888e0a66..8d7a34f78 100644 --- a/packages/filecoin-api/test/context/service.js +++ b/packages/filecoin-api/test/context/service.js @@ -221,7 +221,7 @@ export function getConnection(id, service) { id: id, service, codec: CAR.inbound, - validateAuthorization + validateAuthorization, }) const connection = Client.connect({ id: id, diff --git a/packages/filecoin-api/test/deal-tracker.spec.js b/packages/filecoin-api/test/deal-tracker.spec.js index 13fec97bf..876be0053 100644 --- a/packages/filecoin-api/test/deal-tracker.spec.js +++ b/packages/filecoin-api/test/deal-tracker.spec.js @@ -44,7 +44,7 @@ describe('deal-tracker', () => { assert.fail(error) }, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/dealer.spec.js b/packages/filecoin-api/test/dealer.spec.js index f40b93fc4..0eec5abe6 100644 --- a/packages/filecoin-api/test/dealer.spec.js +++ b/packages/filecoin-api/test/dealer.spec.js @@ -44,7 +44,7 @@ describe('Dealer', () => { aggregateStore, offerStore, queuedMessages, - validateAuthorization + validateAuthorization, } ) }) @@ -109,7 +109,7 @@ describe('Dealer', () => { }, }, service, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/lib.js b/packages/filecoin-api/test/lib.js index 42b46553f..a7ad52c2f 100644 --- a/packages/filecoin-api/test/lib.js +++ b/packages/filecoin-api/test/lib.js @@ -15,21 +15,21 @@ export const test = { ...StorefrontService.test, }, aggregator: { - ...AggregatorService.test + ...AggregatorService.test, }, dealer: { ...DealerService.test, }, dealTracker: { - ...DealTrackerService.test - } + ...DealTrackerService.test, + }, }, events: { storefront: { ...StorefrontEvents.test, }, aggregator: { - ...AggregatorEvents.test + ...AggregatorEvents.test, }, dealer: { ...DealerEvents.test, diff --git a/packages/filecoin-api/test/storefront.spec.js b/packages/filecoin-api/test/storefront.spec.js index b5a29611b..aeafc89fd 100644 --- a/packages/filecoin-api/test/storefront.spec.js +++ b/packages/filecoin-api/test/storefront.spec.js @@ -66,7 +66,7 @@ describe('storefront', () => { taskStore, receiptStore, queuedMessages, - validateAuthorization + validateAuthorization, } ) }) @@ -135,7 +135,7 @@ describe('storefront', () => { assert.fail(error) }, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-client/package.json b/packages/filecoin-client/package.json index 1b9e62b7f..de7b41125 100644 --- a/packages/filecoin-client/package.json +++ b/packages/filecoin-client/package.json @@ -14,7 +14,7 @@ "types": "dist/src/index.d.ts", "main": "src/index.js", "scripts": { - "lint": "eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", + "lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "build": "tsc --build", "test": "npm run test:all", "test:all": "run-s test:browser test:node", diff --git a/packages/upload-api/package.json b/packages/upload-api/package.json index fb094c222..02abf8733 100644 --- a/packages/upload-api/package.json +++ b/packages/upload-api/package.json @@ -102,7 +102,7 @@ "scripts": { "build": "tsc --build", "check": "tsc --build", - "lint": "tsc --build", + "lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules -n experimental-fetch 'test/**/*.spec.js'", "test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test" }, diff --git a/packages/upload-api/test/storage/provisions-storage.js b/packages/upload-api/test/storage/provisions-storage.js index 143fc8d75..272c44a7a 100644 --- a/packages/upload-api/test/storage/provisions-storage.js +++ b/packages/upload-api/test/storage/provisions-storage.js @@ -5,7 +5,8 @@ import * as Types from '../../src/types.js' * @param {Types.Provision} item * @returns {string} */ -const itemKey = ({customer, consumer, provider}) => `${customer}:${consumer}@${provider}` +const itemKey = ({ customer, consumer, provider }) => + `${customer}:${consumer}@${provider}` /** * @implements {Types.ProvisionsStorage} diff --git a/packages/upload-client/package.json b/packages/upload-client/package.json index 4a4d92a4d..8016e58e9 100644 --- a/packages/upload-client/package.json +++ b/packages/upload-client/package.json @@ -14,7 +14,7 @@ "types": "dist/src/index.d.ts", "main": "src/index.js", "scripts": { - "lint": "eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", + "lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", "build": "tsc --build", "check": "tsc --build", "test": "npm-run-all -p -r mock test:all",