Skip to content

Commit

Permalink
Merge pull request #2303 from Chia-Network/EL.prettier
Browse files Browse the repository at this point in the history
Update to prettier 3.1.0
  • Loading branch information
emlowe authored Mar 15, 2024
2 parents 8051aa4 + ce2a9ce commit 4c429af
Show file tree
Hide file tree
Showing 253 changed files with 605 additions and 602 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"lerna-audit": "^1.3.3",
"lint-staged": "14.0.1",
"nyc": "15.1.0",
"prettier": "2.8.8",
"prettier": "3.1.0",
"typescript": "^5.1.6"
},
"version": "1.2.10-dev132"
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/@types/MethodFirstParameter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type MethodFirstParameter<
TClass extends new (...args: any) => any,
Method extends keyof InstanceType<TClass> & string
Method extends keyof InstanceType<TClass> & string,
> = Parameters<InstanceType<TClass>[Method]>[0];

export default MethodFirstParameter;
2 changes: 1 addition & 1 deletion packages/api-react/src/@types/MethodReturnType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type MethodReturnType<
TClass extends new (...args: any) => any,
Method extends keyof InstanceType<TClass> & string
Method extends keyof InstanceType<TClass> & string,
> = Awaited<ReturnType<InstanceType<TClass>[Method]>>;

export default MethodReturnType;
6 changes: 3 additions & 3 deletions packages/api-react/src/chiaLazyBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const instances = new Map<ServiceConstructor, InstanceType<ServiceConstructor>>(

async function getInstance<TService extends ServiceConstructor>(
service: TService,
api: any
api: any,
): Promise<InstanceType<TService>> {
if (!instances.has(service)) {
if (service.isClient) {
Expand Down Expand Up @@ -40,7 +40,7 @@ const chiaLazyBaseQuery = async <
TService extends ServiceConstructor,
TMethod extends keyof InstanceType<TService> & string,
// TParameter extends Parameters<InstanceType<TService>[TMethod]>[0],
TResult extends ReturnType<InstanceType<TService>[TMethod]>
TResult extends ReturnType<InstanceType<TService>[TMethod]>,
>(
options: {
service: TService;
Expand All @@ -49,7 +49,7 @@ const chiaLazyBaseQuery = async <
args?: any;
mockResponse?: any;
},
api: any
api: any,
) => {
const { service, command, args = [], mockResponse } = options;

Expand Down
4 changes: 2 additions & 2 deletions packages/api-react/src/hooks/useCurrentFingerprintSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { type Serializable } from './usePrefs';

export default function useCurrentFingerprintSettings<Type extends Serializable>(
key: string,
defaultValue?: Type
defaultValue?: Type,
): [
Type | undefined,
(value: Type | ((prevValue: Type) => Type)) => void,
{
fingerprint: number | undefined;
isLoading: boolean;
error?: Error;
}
},
] {
const { data: fingerprint, isLoading, error } = useGetLoggedInFingerprintQuery();
const [data, setData] = useFingerprintSettings<Type>(fingerprint, key, defaultValue);
Expand Down
4 changes: 2 additions & 2 deletions packages/api-react/src/hooks/useFingerprintSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import usePrefs, { type Serializable } from './usePrefs';
export default function useFingerprintSettings<Type extends Serializable>(
fingerprint: number | undefined,
key: string,
defaultValue?: Type
defaultValue?: Type,
): [Type | undefined, (value: Type | ((preValue: Type) => Type)) => void] {
type LocalStorageType = Record<string, Record<string, Serializable>>;
const [settings, setSettings] = usePrefs<LocalStorageType>('fingerprintSettings', {});
Expand Down Expand Up @@ -40,7 +40,7 @@ export default function useFingerprintSettings<Type extends Serializable>(
};
});
},
[key, setSettings, fingerprint]
[key, setSettings, fingerprint],
);

if (!fingerprint) {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/hooks/useGetHarvesterQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function useGetHarvesterQuery({ nodeId }: { nodeId: string }) {

const harvester = useMemo(
() => data?.find((harvesterItem) => harvesterItem.connection.nodeId === nodeId),
[data, nodeId]
[data, nodeId],
);

const isLoading = isLoadingHarvesterSummary;
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/hooks/useGetHarvesterStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function useGetHarvesterStats(nodeId: string) {

const harvester = useMemo(
() => data?.find((harvesterItem) => harvesterItem.connection.nodeId === nodeId),
[data, nodeId]
[data, nodeId],
);

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/hooks/useGetLatestBlocksQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function useGetLatestBlocksQuery(count = 10) {
},
{
skip: !peakHeight,
}
},
);

const isLoading = isLoadingBlockchainState || isLoadingBlocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function useGetLatestPeakTimestampQuery() {

const newPeakTimestamp = useMemo(
() => getLatestTimestamp(blocks, latestPeakTimestamp.current),
[blocks, latestPeakTimestamp]
[blocks, latestPeakTimestamp],
);

latestPeakTimestamp.current = newPeakTimestamp;
Expand Down
6 changes: 3 additions & 3 deletions packages/api-react/src/hooks/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getValueFromLocalStorage<T>(key: string): T | undefined {

export default function useLocalStorage<T extends keyof (string | undefined)>(
key: string,
defaultValue?: T
defaultValue?: T,
): [T | undefined, (value: T | ((value: T | undefined) => T)) => void] {
const [storedValue, setStoredValue] = useState<T | undefined>(getValueFromLocalStorage(key));
const defaultValueRef = useRef(defaultValue);
Expand Down Expand Up @@ -57,7 +57,7 @@ export default function useLocalStorage<T extends keyof (string | undefined)>(
return newValue;
});
},
[key]
[key],
);

const changeHandler = useCallback(
Expand All @@ -67,7 +67,7 @@ export default function useLocalStorage<T extends keyof (string | undefined)>(
setStoredValue(newValue);
}
},
[key]
[key],
);

// Listen changes
Expand Down
6 changes: 3 additions & 3 deletions packages/api-react/src/hooks/usePrefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function isEqual(a: Serializable, b: Serializable) {

export default function usePrefs<T extends Serializable>(
key: string,
defaultValue: T
defaultValue: T,
): [T, (value: T | ((value: T) => T)) => void] {
const [value, setValue] = useState<T>(getPreferences(key));
const valueRef = useRef(value);
Expand Down Expand Up @@ -65,7 +65,7 @@ export default function usePrefs<T extends Serializable>(
// notify other hooks
eventEmitter.emit('prefs', { key, newValue });
},
[key]
[key],
);

const handleOnChange = useCallback(
Expand All @@ -74,7 +74,7 @@ export default function usePrefs<T extends Serializable>(
setValue(e.newValue);
}
},
[key]
[key],
);

// The reason to use EventEmitter for updating prefs state:
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/hooks/useService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Options = {

export default function useService(
service: ServiceNameValue,
options: Options = {}
options: Options = {},
): {
isLoading: boolean;
isRunning: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-react/src/hooks/useServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getServiceOptions(service: ServiceNameValue, services: ServiceNameValue

export default function useMonitorServices(
services: ServiceNameValue[],
options: Options = {}
options: Options = {},
): {
isLoading: boolean;
error?: Error | unknown;
Expand All @@ -67,7 +67,7 @@ export default function useMonitorServices(

const introducerState = useService(
ServiceName.INTRODUCER,
getServiceOptions(ServiceName.INTRODUCER, services, options)
getServiceOptions(ServiceName.INTRODUCER, services, options),
);

const datalayerState = useService(ServiceName.DATALAYER, getServiceOptions(ServiceName.DATALAYER, services, options));
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/hooks/useSubscribeToEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function subscribe(event: string, service: ServiceConstructor, cb: Function) {
service,
args: [cb],
},
api
api,
);

return unsubscribe;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-react/src/hooks/useThrottleQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function useThrottleQuery(
wait?: number;
leading?: boolean;
trailing?: boolean;
} = {}
} = {},
) {
const { leading = true, trailing = true, wait = 0 } = throttleOptions;

Expand All @@ -30,7 +30,7 @@ export default function useThrottleQuery(
leading,
trailing,
}),
[wait, leading, trailing, forceUpdate]
[wait, leading, trailing, forceUpdate],
);

queryHook(variables, {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/services/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const clientApi = apiWithTag.injectEndpoints({
},
],
},
apiLocal
apiLocal,
);

unsubscribe = response.data;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-react/src/services/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const daemonApi = apiWithTag.injectEndpoints({
providesTags: (keys) =>
keys
? [
...keys.map((key) => ({ type: 'DaemonKey', id: key.fingerprint } as const)),
...keys.map((key) => ({ type: 'DaemonKey', id: key.fingerprint }) as const),
{ type: 'DaemonKey', id: 'LIST' },
]
: [{ type: 'DaemonKey', id: 'LIST' }],
Expand All @@ -44,7 +44,7 @@ export const daemonApi = apiWithTag.injectEndpoints({
walletAddresses[fingerprint].map((address) => ({
type: 'WalletAddress',
id: `${fingerprint}:${address.hdPath}`,
}))
})),
),
{ type: 'WalletAddress', id: 'LIST' },
]
Expand Down
14 changes: 7 additions & 7 deletions packages/api-react/src/services/farmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (plots) =>
plots
? [
...plots.map(({ plotId }) => ({ type: 'HarvesterPlots', plotId } as const)),
...plots.map(({ plotId }) => ({ type: 'HarvesterPlots', plotId }) as const),
{ type: 'HarvesterPlots', id: 'LIST' },
]
: [{ type: 'HarvesterPlots', id: 'LIST' }],
Expand All @@ -106,7 +106,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (plots) =>
plots
? [
...plots.map((filename) => ({ type: 'HarvesterPlotsInvalid', filename } as const)),
...plots.map((filename) => ({ type: 'HarvesterPlotsInvalid', filename }) as const),
{ type: 'HarvesterPlotsInvalid', id: 'LIST' },
]
: [{ type: 'HarvesterPlotsInvalid', id: 'LIST' }],
Expand All @@ -125,7 +125,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (plots) =>
plots
? [
...plots.map((filename) => ({ type: 'HarvesterPlotsKeysMissing', filename } as const)),
...plots.map((filename) => ({ type: 'HarvesterPlotsKeysMissing', filename }) as const),
{ type: 'HarvesterPlotsKeysMissing', id: 'LIST' },
]
: [{ type: 'HarvesterPlotsKeysMissing', id: 'LIST' }],
Expand All @@ -144,7 +144,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (plots) =>
plots
? [
...plots.map((filename) => ({ type: 'HarvesterPlotsDuplicates', filename } as const)),
...plots.map((filename) => ({ type: 'HarvesterPlotsDuplicates', filename }) as const),
{ type: 'HarvesterPlotsDuplicates', id: 'LIST' },
]
: [{ type: 'HarvesterPlotsDuplicates', id: 'LIST' }],
Expand All @@ -171,7 +171,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (connections) =>
connections
? [
...connections.map(({ nodeId }) => ({ type: 'FarmerConnections', id: nodeId } as const)),
...connections.map(({ nodeId }) => ({ type: 'FarmerConnections', id: nodeId }) as const),
{ type: 'FarmerConnections', id: 'LIST' },
]
: [{ type: 'FarmerConnections', id: 'LIST' }],
Expand Down Expand Up @@ -212,7 +212,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (signagePoints) =>
signagePoints
? [
...signagePoints.map(({ challengeHash }) => ({ type: 'SignagePoints', id: challengeHash } as const)),
...signagePoints.map(({ challengeHash }) => ({ type: 'SignagePoints', id: challengeHash }) as const),
{ type: 'SignagePoints', id: 'LIST' },
]
: [{ type: 'SignagePoints', id: 'LIST' }],
Expand All @@ -235,7 +235,7 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: (poolsList) =>
poolsList
? [
...poolsList.map(({ p2SingletonPuzzleHash }) => ({ type: 'Pools', id: p2SingletonPuzzleHash } as const)),
...poolsList.map(({ p2SingletonPuzzleHash }) => ({ type: 'Pools', id: p2SingletonPuzzleHash }) as const),
{ type: 'Pools', id: 'LIST' },
]
: [{ type: 'Pools', id: 'LIST' }],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/services/fullNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const fullNodeApi = apiWithTag.injectEndpoints({
providesTags: (connections) =>
connections
? [
...connections.map(({ nodeId }) => ({ type: 'FullNodeConnections', id: nodeId } as const)),
...connections.map(({ nodeId }) => ({ type: 'FullNodeConnections', id: nodeId }) as const),
{ type: 'FullNodeConnections', id: 'LIST' },
]
: [{ type: 'FullNodeConnections', id: 'LIST' }],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-react/src/services/harvester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const harvesterApi = apiWithTag2.injectEndpoints({
providesTags: (directories) =>
directories
? [
...directories.map((directory) => ({ type: 'PlotDirectories', id: directory } as const)),
...directories.map((directory) => ({ type: 'PlotDirectories', id: directory }) as const),
{ type: 'PlotDirectories', id: 'LIST' },
]
: [{ type: 'PlotDirectories', id: 'LIST' }],
Expand Down
Loading

0 comments on commit 4c429af

Please sign in to comment.