Skip to content

Commit 2ef05b7

Browse files
committed
fixed prettier formatting
1 parent 41d4941 commit 2ef05b7

2 files changed

Lines changed: 136 additions & 11 deletions

File tree

packages/core/src/components/fields/SchemaField.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
136136
const disabled = Boolean(uiOptions.disabled ?? props.disabled);
137137
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
138138
const effectiveRequired = uiOptions.required !== undefined ? Boolean(uiOptions.required) : required;
139-
if (uiOptions.required === false && required && uiOptions.initialValue === undefined && uiOptions.emptyValue === undefined) {
139+
if (
140+
uiOptions.required === false &&
141+
required &&
142+
uiOptions.initialValue === undefined &&
143+
uiOptions.emptyValue === undefined
144+
) {
140145
console.warn(
141146
`ui:required is false for a schema-required field "${name}" but no ui:initialValue or ui:emptyValue is set. ` +
142147
'The UI will show this field as optional but schema validation will still fail if left empty.',

packages/utils/test/schema/getDefaultFormStateTest.ts

Lines changed: 130 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,7 +5703,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57035703
const uiSchema = {
57045704
name: { 'ui:emptyValue': '' },
57055705
};
5706-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5706+
expect(
5707+
getDefaultFormState(
5708+
testValidator,
5709+
schema,
5710+
undefined,
5711+
schema,
5712+
false,
5713+
undefined,
5714+
undefined,
5715+
undefined,
5716+
uiSchema,
5717+
),
5718+
).toEqual({
57075719
name: '',
57085720
});
57095721
});
@@ -5717,7 +5729,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57175729
const uiSchema = {
57185730
name: { 'ui:emptyValue': '' },
57195731
};
5720-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5732+
expect(
5733+
getDefaultFormState(
5734+
testValidator,
5735+
schema,
5736+
undefined,
5737+
schema,
5738+
false,
5739+
undefined,
5740+
undefined,
5741+
undefined,
5742+
uiSchema,
5743+
),
5744+
).toEqual({
57215745
name: 'hello',
57225746
});
57235747
});
@@ -5731,7 +5755,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57315755
const uiSchema = {
57325756
name: { 'ui:emptyValue': '' },
57335757
};
5734-
expect(getDefaultFormState(testValidator, schema, { name: 'world' }, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5758+
expect(
5759+
getDefaultFormState(
5760+
testValidator,
5761+
schema,
5762+
{ name: 'world' },
5763+
schema,
5764+
false,
5765+
undefined,
5766+
undefined,
5767+
undefined,
5768+
uiSchema,
5769+
),
5770+
).toEqual({
57355771
name: 'world',
57365772
});
57375773
});
@@ -5752,7 +5788,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57525788
city: { 'ui:emptyValue': '' },
57535789
},
57545790
};
5755-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5791+
expect(
5792+
getDefaultFormState(
5793+
testValidator,
5794+
schema,
5795+
undefined,
5796+
schema,
5797+
false,
5798+
undefined,
5799+
undefined,
5800+
undefined,
5801+
uiSchema,
5802+
),
5803+
).toEqual({
57565804
address: { city: '' },
57575805
});
57585806
});
@@ -5778,7 +5826,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57785826
const uiSchema = {
57795827
country: { 'ui:initialValue': 'US' },
57805828
};
5781-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5829+
expect(
5830+
getDefaultFormState(
5831+
testValidator,
5832+
schema,
5833+
undefined,
5834+
schema,
5835+
false,
5836+
undefined,
5837+
undefined,
5838+
undefined,
5839+
uiSchema,
5840+
),
5841+
).toEqual({
57825842
country: 'US',
57835843
});
57845844
});
@@ -5792,7 +5852,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
57925852
const uiSchema = {
57935853
country: { 'ui:initialValue': 'US' },
57945854
};
5795-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5855+
expect(
5856+
getDefaultFormState(
5857+
testValidator,
5858+
schema,
5859+
undefined,
5860+
schema,
5861+
false,
5862+
undefined,
5863+
undefined,
5864+
undefined,
5865+
uiSchema,
5866+
),
5867+
).toEqual({
57965868
country: 'US',
57975869
});
57985870
});
@@ -5806,7 +5878,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
58065878
const uiSchema = {
58075879
country: { 'ui:initialValue': 'US' },
58085880
};
5809-
expect(getDefaultFormState(testValidator, schema, { country: 'FR' }, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5881+
expect(
5882+
getDefaultFormState(
5883+
testValidator,
5884+
schema,
5885+
{ country: 'FR' },
5886+
schema,
5887+
false,
5888+
undefined,
5889+
undefined,
5890+
undefined,
5891+
uiSchema,
5892+
),
5893+
).toEqual({
58105894
country: 'FR',
58115895
});
58125896
});
@@ -5820,7 +5904,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
58205904
const uiSchema = {
58215905
country: { 'ui:initialValue': 'US', 'ui:emptyValue': '' },
58225906
};
5823-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5907+
expect(
5908+
getDefaultFormState(
5909+
testValidator,
5910+
schema,
5911+
undefined,
5912+
schema,
5913+
false,
5914+
undefined,
5915+
undefined,
5916+
undefined,
5917+
uiSchema,
5918+
),
5919+
).toEqual({
58245920
country: 'US',
58255921
});
58265922
});
@@ -5842,7 +5938,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
58425938
country: { 'ui:initialValue': 'US' },
58435939
},
58445940
};
5845-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5941+
expect(
5942+
getDefaultFormState(
5943+
testValidator,
5944+
schema,
5945+
undefined,
5946+
schema,
5947+
false,
5948+
undefined,
5949+
undefined,
5950+
undefined,
5951+
uiSchema,
5952+
),
5953+
).toEqual({
58465954
address: { country: 'US' },
58475955
});
58485956
});
@@ -5856,7 +5964,19 @@ export default function getDefaultFormStateTest(testValidator: TestValidatorType
58565964
const uiSchema = {
58575965
name: { 'ui:initialValue': 'default name' },
58585966
};
5859-
expect(getDefaultFormState(testValidator, schema, undefined, schema, false, undefined, undefined, undefined, uiSchema)).toEqual({
5967+
expect(
5968+
getDefaultFormState(
5969+
testValidator,
5970+
schema,
5971+
undefined,
5972+
schema,
5973+
false,
5974+
undefined,
5975+
undefined,
5976+
undefined,
5977+
uiSchema,
5978+
),
5979+
).toEqual({
58605980
name: 'default name',
58615981
});
58625982
});

0 commit comments

Comments
 (0)