Skip to content

Commit

Permalink
refactor: lint-fix
Browse files Browse the repository at this point in the history
BREAKING CHANGE: prepare major version
  • Loading branch information
dereekb committed Aug 13, 2022
1 parent fd9eb02 commit 50b09dc
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ export function guestbookEntryUpdateEntryFactory({ firebaseServerActionTransform
await guestbookCollection.firestoreContext.runTransaction(async (transaction) => {
const parentGuestbook = guestbookCollection.documentAccessorForTransaction(transaction).loadDocument(document.parent);
const guestbookEntryDocument = guestbookEntryCollectionFactory(parentGuestbook).documentAccessorForTransaction(transaction).loadDocument(documentRef);
const [guestbookSnapshot, guestbookEntry] = await Promise.all([parentGuestbook.snapshot(), guestbookEntryDocument.snapshot()]);
const guestbookData = guestbookSnapshot.data();
const [guestbook, guestbookEntry] = await Promise.all([parentGuestbook.snapshotData(), guestbookEntryDocument.snapshotData()]);

if (!guestbookData) {
if (!guestbook) {
throw new Error('The guestbook could not be found.');
} else if (guestbookData.locked) {
} else if (guestbook.locked) {
throw new Error('The guestbook has been locked.');
} else {
const set: Partial<GuestbookEntry> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnInit, Component } from '@angular/core';
import { Component } from '@angular/core';
import { AbstractDbxWidgetComponent } from '@dereekb/dbx-web';

export const DOC_EXTENSION_WIDGET_EXAMPLE_TYPE = 'widgetExample';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnInit, Component } from '@angular/core';
import { Component } from '@angular/core';
import { AbstractDbxWidgetComponent } from '@dereekb/dbx-web';

export const DOC_EXTENSION_WIDGET_ICON_EXAMPLE_TYPE = 'widgetIconExample';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnInit, Component } from '@angular/core';
import { Component } from '@angular/core';
import { DbxWidgetDataPair } from '@dereekb/dbx-web';
import { ListLoadingState, successResult } from '@dereekb/rxjs';
import { map, Observable, of } from 'rxjs';
Expand Down
2 changes: 1 addition & 1 deletion lint-fix-all.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
npx nx affected --target=lint --all --fix
npx nx run-many --exclude=util-test,firebase-test,firebase-server-test --target=lint --fix
4 changes: 2 additions & 2 deletions packages/date/src/lib/date/date.block.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expectFail, itShouldFail } from '@dereekb/util/test';
import { DateRange, DateRangeInput } from './date.range';
import { addDays, addHours, addMinutes, setHours, setMinutes, startOfDay, endOfDay, addSeconds, addMilliseconds, millisecondsToHours, minutesToHours } from 'date-fns';
import { DateBlock, dateBlockDayOfWeekFactory, DateBlockIndex, dateBlockIndexRange, DateBlockRange, dateBlockRange, DateBlockRangeWithRange, dateBlocksExpansionFactory, dateBlocksInDateBlockRange, dateBlockTiming, DateBlockTiming, expandDateBlockRange, expandUniqueDateBlocksFunction, getCurrentDateBlockTimingOffset, getCurrentDateBlockTimingStartDate, groupToDateBlockRanges, groupUniqueDateBlocks, isValidDateBlockTiming, sortDateBlockRanges, UniqueDateBlockRange } from './date.block';
import { MS_IN_DAY, MINUTES_IN_DAY, range, RangeInput, Hours, Day, expandIndexSet } from '@dereekb/util';
import { DateBlock, dateBlockDayOfWeekFactory, DateBlockIndex, dateBlockIndexRange, dateBlockRange, DateBlockRangeWithRange, dateBlocksExpansionFactory, dateBlocksInDateBlockRange, dateBlockTiming, DateBlockTiming, expandDateBlockRange, expandUniqueDateBlocksFunction, getCurrentDateBlockTimingOffset, getCurrentDateBlockTimingStartDate, groupToDateBlockRanges, groupUniqueDateBlocks, isValidDateBlockTiming, sortDateBlockRanges, UniqueDateBlockRange } from './date.block';
import { MS_IN_DAY, MINUTES_IN_DAY, range, RangeInput, Hours, Day } from '@dereekb/util';
import { removeMinutesAndSeconds } from './date';

describe('getCurrentDateBlockTimingOffset()', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/date/src/lib/date/date.calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ISO8601DayString } from '@dereekb/util';
import { Expose } from 'class-transformer';
import { daysToMinutes } from './date';
import { DateDurationSpan } from './date.duration';
import { dateStringToDate, dateStringToUTCDate } from './date.format';
import { dateStringToUTCDate } from './date.format';
import { dateTimezoneUtcNormal } from './date.timezone';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/date/src/lib/date/date.range.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Expose, Type } from 'class-transformer';
import { IsEnum, IsOptional, IsDate, IsNumber } from 'class-validator';
import { addDays, addHours, endOfDay, endOfMonth, endOfWeek, isBefore, isDate, isPast, startOfDay, startOfMinute, startOfMonth, startOfWeek } from 'date-fns';
import { addDays, addHours, endOfDay, endOfMonth, endOfWeek, isDate, isPast, startOfDay, startOfMinute, startOfMonth, startOfWeek } from 'date-fns';

/**
* Represents a start and end date.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Injectable, Optional, Type } from '@angular/core';
import { Injectable, Type } from '@angular/core';
import { Maybe, filterMaybeValues, mapIterable } from '@dereekb/util';
import { DbxWidgetType } from './widget';

Expand Down
2 changes: 1 addition & 1 deletion packages/dbx-web/src/lib/extension/widget/widget.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModelTypeDataPair, TypedModel, MapFunction, ReadKeyFunction } from '@dereekb/util';
import { ModelTypeDataPair, MapFunction } from '@dereekb/util';

/**
* Widget type identifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { itShouldFail } from '@dereekb/util/test';
import { DocumentSnapshot } from '@google-cloud/firestore';
import { first } from 'rxjs';
import { FirestoreDocumentAccessor } from '@dereekb/firebase';
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-server/src/lib/function/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorMessageOrPartialServerError, Maybe, partialServerError, ReadableDataError, ServerError } from '@dereekb/util';
import { ErrorMessageOrPartialServerError, partialServerError } from '@dereekb/util';
import * as functions from 'firebase-functions';

export function unauthenticatedContextHasNoAuthData() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { objectHasNoKeys } from '@dereekb/util';
import { DocumentReference, WriteBatch as FirebaseFirestoreWriteBatch, UpdateData as FirestoreUpdateData } from '@firebase/firestore';
import { FirestoreDocumentContext, UpdateData, WithFieldValue, FirestoreDocumentContextType, FirestoreDocumentDataAccessor, FirestoreDocumentDataAccessorFactory, SetOptions, assertFirestoreUpdateHasData } from '../../common/firestore';
import { DefaultFirestoreDocumentDataAccessor } from './driver.accessor.default';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DocumentReference, DocumentSnapshot, Transaction as FirebaseFirestoreTransaction, UpdateData, WithFieldValue } from '@firebase/firestore';
import { from, Observable } from 'rxjs';
import { FirestoreDocumentDataAccessor, FirestoreDocumentDataAccessorFactory, FirestoreDocumentContext, FirestoreDocumentContextType, SetOptions, DocumentData, FirestoreDataConverter, assertFirestoreUpdateHasData, AddPrefixToKeys, FirestoreDocumentUpdateParams, WriteResult, FirestoreAccessorIncrementUpdate } from '../../common/firestore';
import { FirestoreDocumentDataAccessor, FirestoreDocumentDataAccessorFactory, FirestoreDocumentContext, FirestoreDocumentContextType, SetOptions, DocumentData, FirestoreDataConverter, assertFirestoreUpdateHasData, WriteResult, FirestoreAccessorIncrementUpdate } from '../../common/firestore';
import { createWithAccessor } from './driver.accessor.create';
import { firestoreClientIncrementUpdateToUpdateData } from './increment';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrayOrValue, asArray, mergeModifiers, ModifierFunction, cachedGetter, Maybe } from '@dereekb/util';
import { ArrayOrValue, asArray, mergeModifiers, ModifierFunction, cachedGetter } from '@dereekb/util';
import { UserRelated } from '../../../model/user';
import { DocumentReferenceRef } from '../reference';
import { SetOptionsMerge, SetOptionsMergeFields, DocumentData, PartialWithFieldValue, SetOptions, WithFieldValue } from '../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DateRange, dateRange, DateRangeInput } from '@dereekb/date';
import { Maybe, StringKeyPropertyKeys, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START } from '@dereekb/util';
import { DocumentReference, FieldPath, FieldPathOrStringPath, FieldPathOrStringPathOf } from '../types';
import { StringKeyPropertyKeys, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START } from '@dereekb/util';
import { DocumentReference, FieldPathOrStringPath, FieldPathOrStringPathOf } from '../types';
import { endAtValue, FirestoreQueryConstraint, orderByDocumentId, startAtValue, orderBy, OrderByDirection, where } from './constraint';

// MARK: Parents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
LatLngString,
asObjectCopyFactory,
modelFieldMapFunctions,
UTC_TIMEZONE_STRING,
TimezoneString,
assignValuesToPOJOFunction
} from '@dereekb/util';
Expand Down Expand Up @@ -535,7 +534,7 @@ export function firestoreLatLngString(config?: FirestoreLatLngStringConfig) {
});
}

export interface FirestoreTimezoneStringConfig extends DefaultMapConfiguredFirestoreFieldConfig<TimezoneString, TimezoneString> {}
export type FirestoreTimezoneStringConfig = DefaultMapConfiguredFirestoreFieldConfig<TimezoneString, TimezoneString>;

/**
* Default configuration for a TimezoneString.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { itShouldFail, expectFail } from '@dereekb/util/test';
import { firstValueFrom, first } from 'rxjs';
import { firstValueFrom } from 'rxjs';
import { SubscriptionObject } from '@dereekb/rxjs';
import { Transaction, DocumentReference, WriteBatch, FirestoreDocumentAccessor, makeDocuments, FirestoreDocumentDataAccessor, FirestoreContext, FirestoreDocument, RunTransaction, FirebaseAuthUserId, DocumentSnapshot, FirestoreDataConverter, getDocumentSnapshotPairs, useDocumentSnapshot, useDocumentSnapshotData, AbstractFirestoreDocument } from '@dereekb/firebase';
import { MockItemCollectionFixture, MockItemDocument, MockItem, MockItemPrivateDocument, MockItemPrivateFirestoreCollection, MockItemPrivate, MockItemSubItem, MockItemSubItemDocument, MockItemSubItemFirestoreCollection, MockItemSubItemFirestoreCollectionGroup, MockItemUserFirestoreCollection, MockItemUserDocument, MockItemUser, mockItemConverter } from '../mock';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { startOfDay, addDays, addHours, endOfDay } from 'date-fns';
import { startOfDay, addDays, addHours } from 'date-fns';
import { expectFail, itShouldFail } from '@dereekb/util/test';
import { SubscriptionObject } from '@dereekb/rxjs';
import { filter, first, from, skip } from 'rxjs';
import { firestoreIdBatchVerifierFactory, limit, orderBy, startAfter, startAt, where, limitToLast, endAt, endBefore, makeDocuments, FirestoreQueryFactoryFunction, startAtValue, endAtValue, whereDocumentId, FirebaseAuthUserId, getDocumentSnapshotsData, whereDateIsBetween, whereDateIsInRange, whereDateIsBefore, whereDateIsOnOrAfter } from '@dereekb/firebase';
import { firestoreIdBatchVerifierFactory, limit, orderBy, startAfter, startAt, where, limitToLast, endAt, endBefore, makeDocuments, FirestoreQueryFactoryFunction, startAtValue, endAtValue, whereDocumentId, FirebaseAuthUserId, whereDateIsBetween, whereDateIsInRange, whereDateIsBefore, whereDateIsOnOrAfter } from '@dereekb/firebase';
import { MockItemCollectionFixture, allChildMockItemSubItemDeepsWithinMockItem, MockItemDocument, MockItem, MockItemSubItemDocument, MockItemSubItem, MockItemSubItemDeepDocument, MockItemSubItemDeep, MockItemUserDocument } from '../mock';
import { arrayFactory, idBatchFactory, isEvenNumber, mapGetter, randomFromArrayFactory, randomNumberFactory, unique, waitForMs } from '@dereekb/util';
import { DateRangeType } from '@dereekb/date';
Expand Down
4 changes: 2 additions & 2 deletions packages/model/src/lib/data/website/link.website.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addPrefix, E164PhoneNumber, EmailAddress, hasWebsiteDomain, IsolateWebsitePathFunction, isolateWebsitePathFunction, ModelKey, PhoneNumber, removeHttpFromUrl, toAbsoluteSlashPathStartType, toRelativeSlashPathStartType, WebsiteUrl } from '@dereekb/util';
import { WebsiteLink, WebsiteLinkEncodedData, WebsiteLinkType } from './link';
import { addPrefix, E164PhoneNumber, EmailAddress, hasWebsiteDomain, IsolateWebsitePathFunction, isolateWebsitePathFunction, ModelKey, removeHttpFromUrl, toAbsoluteSlashPathStartType, toRelativeSlashPathStartType, WebsiteUrl } from '@dereekb/util';
import { WebsiteLink, WebsiteLinkType } from './link';

/**
* Used for isolating a username from a website that has the username as the base url.
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/lib/array/array.index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IndexRange, IndexNumber, IndexRef, IndexRangeInput, indexRange } from '../value/indexed';
import { IndexNumber, IndexRef, IndexRangeInput, indexRange } from '../value/indexed';
import { Maybe } from '../value/maybe.type';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/lib/path/path.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chainMapSameFunctions, MapSameFunction } from '../value/map';
import { asArray, ArrayOrValue, mergeArrayOrValueIntoArray } from '../array/array';
import { firstAndLastCharacterOccurrence, replaceCharacterAtIndexWith, replaceStringsFunction, splitStringAtIndex } from '../string';
import { chainMapFunction, IndexNumber, indexRange, IndexRange, IndexRangeInput, mapIdentityFunction, Maybe } from '../value';
import { chainMapFunction, indexRange, IndexRangeInput, mapIdentityFunction, Maybe } from '../value';
import { FactoryWithRequiredInput } from '../getter/getter';
import { sliceIndexRangeFunction } from '../array/array.index';

Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/lib/type.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StringKeyPropertyKeys } from '@dereekb/util';
import { AllCommaSeparatedKeysOfObject, CommaSeparatedKeyCombinationsOfObject, CommaSeparatedKeysOfObject, HasThreeCharacters, HasThreeOrMoreCharacters, IsSingleCharacter, KeyAsString, KeyCanBeString, MergeReplace, OrderedCommaSeparatedKeysOfObject, PopUnion, Replace, ReplaceType, StringConcatenation, StringKeyProperties } from './type';
import { AllCommaSeparatedKeysOfObject, CommaSeparatedKeyCombinationsOfObject, HasThreeCharacters, HasThreeOrMoreCharacters, IsSingleCharacter, KeyAsString, KeyCanBeString, MergeReplace, OrderedCommaSeparatedKeysOfObject, Replace, ReplaceType, StringConcatenation, StringKeyProperties } from './type';

type TYPE_A = {
aOnly: boolean;
Expand Down
7 changes: 7 additions & 0 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
"color": true
}
},
"lint-fix-all": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"description": "",
"command": "npx nx run-many --exclude=util-test,firebase-test,firebase-server-test --target=lint --fix"
}
},
"start-release": {
"executor": "@nrwl/workspace:run-commands",
"options": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const exampleConverter = snapshotConverterFunctions<Example>({
});

export function exampleCollectionReference(context: FirestoreContext): CollectionReference<Example> {
return context.collection(exampleIdentity.collection);
return context.collection(exampleIdentity.collectionName);
}

export type ExampleFirestoreCollection = FirestoreCollection<Example, ExampleDocument>;
Expand Down

0 comments on commit 50b09dc

Please sign in to comment.