Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented formatting check in CI #178

Merged
merged 14 commits into from
Mar 25, 2025
4 changes: 3 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
# Install all dependencies at the root
- name: Install dependencies (pnpm)
run: pnpm install

- name: Check formatting
run: pnpm format:ci
- name: Start Firebase Emulator Suite
uses: invertase/[email protected]
with:
Expand All @@ -42,6 +43,7 @@ jobs:
run: |
curl --silent http://localhost:4400/emulators | jq 'keys[]'


# Determine which packages have changed
- name: Determine changed packages
id: changes
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"serve:coverage": "npx serve coverage",
"emulator": "firebase emulators:start --project test-project",
"emulator:kill": "lsof -t -i:4001 -i:8080 -i:9000 -i:9099 -i:9199 -i:8085 | xargs kill -9",
"check": "pnpm biome check --write ./packages/react/src ./packages/angular/src"
"format:ci": "pnpm biome ci ./packages/react/src ./packages/angular/src",
"format": "pnpm biome check --write ./packages/react/src ./packages/angular/src"
},
"devDependencies": {
"@angular/core": "^19.1.8",
Expand Down
40 changes: 19 additions & 21 deletions packages/angular/src/data-connect/index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import {
type CreateMutationOptions,
type CreateQueryOptions,
injectMutation,
injectQuery,
QueryClient,
type QueryKey,
injectMutation,
injectQuery,
} from "@tanstack/angular-query-experimental";

import type { FirebaseError } from "firebase/app";

import {
EnvironmentInjector,
inject,
type Injector,
inject,
signal,
} from "@angular/core";
import {
type CallerSdkType,
CallerSdkTypeEnum,
DataConnect,
executeMutation,
executeQuery,
type MutationRef,
type MutationResult,
type QueryRef,
type QueryResult,
executeMutation,
executeQuery,
} from "@angular/fire/data-connect";
import type {
CreateDataConnectMutationResult,
Expand Down Expand Up @@ -56,7 +56,7 @@ export function injectDataConnectQuery<Data, Variables>(
| QueryRef<Data, Variables>
| (() => CreateDataConnectQueryOptions<Data, Variables>),
injector?: Injector,
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackAngularCore
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackAngularCore,
): CreateDataConnectQueryResult<Data, Variables> {
const dataConnectResult = signal<
Partial<QueryResult<Data, Variables>> | undefined
Expand Down Expand Up @@ -98,7 +98,7 @@ export function injectDataConnectQuery<Data, Variables>(

export type GeneratedSignature<Data, Variables> = (
dc: DataConnect,
vars: Variables
vars: Variables,
) => MutationRef<Data, Variables>;
export type DataConnectMutationOptionsFn<Data, Error, Variables, Arguments> =
() => Omit<CreateMutationOptions<Data, Error, Arguments>, "mutationFn"> & {
Expand All @@ -109,7 +109,7 @@ export type DataConnectMutationOptionsFn<Data, Error, Variables, Arguments> =
export type DataConnectMutationOptionsUndefinedMutationFn<
Data,
Error,
Variables
Variables,
> = () => Omit<
ReturnType<DataConnectMutationOptionsFn<Data, Error, Variables, Variables>>,
"mutationFn"
Expand All @@ -123,56 +123,56 @@ export function injectDataConnectMutation<Data, Variables, Arguments>(
FirebaseError,
Variables,
Arguments
>
>,
): CreateDataConnectMutationResult<Data, FirebaseError, Arguments>;
export function injectDataConnectMutation<
Data,
Variables,
Arguments = void | undefined
Arguments = void | undefined,
>(
factoryFn: EmptyFactoryFn<Data, Variables>,
options?: DataConnectMutationOptionsUndefinedMutationFn<
Data,
FirebaseError,
Variables
>
>,
): CreateDataConnectMutationResult<Data, FirebaseError, Arguments>;

export function injectDataConnectMutation<
Data,
Variables extends undefined,
Arguments = void | undefined
Arguments = void | undefined,
>(
factoryFn: EmptyFactoryFn<Data, Variables>,
options?: DataConnectMutationOptionsUndefinedMutationFn<
Data,
FirebaseError,
Variables
>
>,
): CreateDataConnectMutationResult<Data, FirebaseError, Arguments>;
export function injectDataConnectMutation<
Data,
Variables extends undefined,
Arguments = Variables
Arguments = Variables,
>(
factoryFn: GeneratedSignature<Data, Variables>,
optionsFn?: DataConnectMutationOptionsUndefinedMutationFn<
Data,
FirebaseError,
Arguments
>
>,
): CreateDataConnectMutationResult<Data, FirebaseError, Arguments>;
export function injectDataConnectMutation<
Data,
Variables,
Arguments extends Variables
Arguments extends Variables,
>(
factoryFn: GeneratedSignature<Data, Variables>,
optionsFn?: DataConnectMutationOptionsUndefinedMutationFn<
Data,
FirebaseError,
Arguments
>
>,
): CreateDataConnectMutationResult<Data, FirebaseError, Arguments>;
/**
* injectDataConnectMutation takes a mutation ref factory function and returns a tanstack wrapper around `injectMutation`
Expand All @@ -184,7 +184,7 @@ export function injectDataConnectMutation<
export function injectDataConnectMutation<
Data,
Variables,
Arguments extends Variables
Arguments extends Variables,
>(
factoryFn:
| GeneratedSignature<Data, Variables>
Expand All @@ -199,7 +199,7 @@ export function injectDataConnectMutation<
Variables
>,
injector?: Injector,
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackAngularCore
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackAngularCore,
): CreateDataConnectMutationResult<Data, Variables, Arguments> {
const finalInjector = injector || inject(EnvironmentInjector);
const dataConnect = finalInjector.get(DataConnect);
Expand Down Expand Up @@ -256,5 +256,3 @@ export function injectDataConnectMutation<
dataConnectResult,
};
}

export type { CreateDataConnectMutationResult, CreateDataConnectQueryResult } from './types';
Loading