Skip to content

Commit

Permalink
chore: ts linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevee committed Apr 27, 2024
1 parent b7e825d commit 871c9d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion frontend/components/form/generate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const GenerateRecords: React.FC<Props> = ({
const generateRecords = async () => {
for (let i = 0; i < numberOfRecords; i++) {
const recordData = {}
for (const fieldConfiguration of fieldConfigurations) {
for (const fieldConfiguration of fieldConfigurations.filter(
(fieldConfiguration) => fieldConfiguration.generator
)) {
recordData[fieldConfiguration.field.id] = await generate({
id: fieldConfiguration.generator,
base,
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const RandomRecordForm: React.FC = () => {
FieldConfiguration[]
>([])
const globalConfig = useGlobalConfig()
const savedSettings: SavedSettings[] = globalConfig.get('savedSettings') || []
const savedSettings: any = globalConfig.get('savedSettings') || []

/**
* Save the current form state to the global config. This will allow the user
Expand Down Expand Up @@ -92,7 +92,7 @@ const RandomRecordForm: React.FC = () => {
return (
<>
{isGenerating && (
<Dialog>
<Dialog onClose={() => {}}>
<GenerateRecords
table={table}
numberOfRecords={numberOfRecords}
Expand Down
6 changes: 4 additions & 2 deletions frontend/components/hook/random-generator/generators/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const getLinkedRecordIds = async ({
base,
multiple,
}: LinkedRecordOptions): Promise<Record[] | null> => {
const fieldTable = base.getTableByIdIfExists(field.options.linkedTableId)
const fieldTable = base.getTableByIdIfExists(
field.options.linkedTableId as string
)
if (!fieldTable) {
return
}
Expand Down Expand Up @@ -65,7 +67,7 @@ const link: RandomGenerator = {
optionsForm: ({ field, options, setOptions }) => (
<Switch
value={options.multiple}
disabled={field?.options?.prefersSingleRecordLink}
disabled={field?.options?.prefersSingleRecordLink ? true : false}
onChange={(newValue) => setOptions({ multiple: newValue })}
label="Allow multiple links"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const currency: RandomGenerator = {
types: [FieldType.CURRENCY],
preview: ({ field }) =>
faker.finance.amount({ symbol: field.options.symbol }),
generate: () => parseFloat(faker.finance.amount(), 10),
generate: () => parseFloat(faker.finance.amount()),
}

export default [number, currency]

0 comments on commit 871c9d0

Please sign in to comment.