Skip to content

Commit ad3d93e

Browse files
committed
feat(sandbox): remove empty string check and mark todo in a duplicate code
1 parent 144dec8 commit ad3d93e

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

packages/field-plugin/helpers/vite/src/manifest.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync, readFileSync } from 'fs'
22
import { resolve } from 'path'
3-
import { isEmpty, isOptionObject, isString } from './validation/manifest.ts'
3+
import { isOptionObject, isString } from './validation/manifest.ts'
44

55
export const MANIFEST_FILE_NAME = 'field-plugin.config.json'
66
export const MANIFEST_FULL_PATH = resolve(process.cwd(), MANIFEST_FILE_NAME)
@@ -70,13 +70,6 @@ const validateOptions = (options: unknown[]): void => {
7070
)
7171
continue
7272
}
73-
74-
if (isEmpty(option.value)) {
75-
incorrectValues.push(
76-
`${JSON.stringify(option)} --> Incorrect value. Must not be empty.`,
77-
)
78-
continue
79-
}
8073
}
8174

8275
if (incorrectValues.length > 0) {

packages/field-plugin/helpers/vite/src/validation/manifest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { ManifestOption } from '../manifest.ts'
22

33
export const isString = (value: unknown) => typeof value === 'string'
44

5-
export const isEmpty = (value: string) => value === ''
6-
75
export const isOptionObject = (option: unknown): option is ManifestOption =>
86
typeof option === 'object' &&
97
option !== null &&

packages/manifest-helper/src/manifest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const validateSchema = (manifest: Manifest): void => {
5252
throw new Error(`The 'options' property should be an array`)
5353
}
5454

55+
//TODO: update this to use the new validation functions
5556
manifest.options?.forEach((option) => {
5657
if (!('name' in option && 'value' in option)) {
5758
throw new Error(

0 commit comments

Comments
 (0)