Skip to content

Commit 0ee5ac8

Browse files
author
Deepak kudi
committed
style: format build config definition changes
1 parent 0073e39 commit 0ee5ac8

2 files changed

Lines changed: 11 additions & 18 deletions

File tree

resources/buildConfigDefinitions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ function mapperFor(elt, t) {
168168
return wrap(t.identifier('objectParser'));
169169
} else if (t.isUnionTypeAnnotation(elt)) {
170170
const unionTypes = elt.typeAnnotation?.types || elt.types;
171-
if (unionTypes?.some(type => t.isBooleanTypeAnnotation(type)) && unionTypes?.some(type => t.isFunctionTypeAnnotation(type))) {
171+
if (
172+
unionTypes?.some(type => t.isBooleanTypeAnnotation(type)) &&
173+
unionTypes?.some(type => t.isFunctionTypeAnnotation(type))
174+
) {
172175
return wrap(t.identifier('booleanOrFunctionParser'));
173176
}
174177
} else if (t.isGenericTypeAnnotation(elt)) {
@@ -180,7 +183,9 @@ function mapperFor(elt, t) {
180183
return wrap(t.identifier('numberOrBoolParser'));
181184
}
182185
if (type == 'NumberOrString') {
183-
return t.callExpression(wrap(t.identifier('numberOrStringParser')), [t.stringLiteral(elt.name)]);
186+
return t.callExpression(wrap(t.identifier('numberOrStringParser')), [
187+
t.stringLiteral(elt.name),
188+
]);
184189
}
185190
if (type === 'StringOrStringArray') {
186191
return wrap(t.identifier('arrayParser'));

spec/buildConfigDefinitions.spec.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ describe('buildConfigDefinitions', () => {
137137
const mockElement = {
138138
type: 'UnionTypeAnnotation',
139139
typeAnnotation: {
140-
types: [
141-
{ type: 'BooleanTypeAnnotation' },
142-
{ type: 'FunctionTypeAnnotation' },
143-
],
140+
types: [{ type: 'BooleanTypeAnnotation' }, { type: 'FunctionTypeAnnotation' }],
144141
},
145142
};
146143

@@ -154,10 +151,7 @@ describe('buildConfigDefinitions', () => {
154151
it('should return booleanOrFunctionParser for UnionTypeAnnotation containing boolean (non-nullable)', () => {
155152
const mockElement = {
156153
type: 'UnionTypeAnnotation',
157-
types: [
158-
{ type: 'BooleanTypeAnnotation' },
159-
{ type: 'FunctionTypeAnnotation' },
160-
],
154+
types: [{ type: 'BooleanTypeAnnotation' }, { type: 'FunctionTypeAnnotation' }],
161155
};
162156

163157
const result = mapperFor(mockElement, t);
@@ -171,10 +165,7 @@ describe('buildConfigDefinitions', () => {
171165
const mockElement = {
172166
type: 'UnionTypeAnnotation',
173167
typeAnnotation: {
174-
types: [
175-
{ type: 'StringTypeAnnotation' },
176-
{ type: 'NumberTypeAnnotation' },
177-
],
168+
types: [{ type: 'StringTypeAnnotation' }, { type: 'NumberTypeAnnotation' }],
178169
},
179170
};
180171

@@ -187,10 +178,7 @@ describe('buildConfigDefinitions', () => {
187178
const mockElement = {
188179
type: 'UnionTypeAnnotation',
189180
typeAnnotation: {
190-
types: [
191-
{ type: 'BooleanTypeAnnotation' },
192-
{ type: 'VoidTypeAnnotation' },
193-
],
181+
types: [{ type: 'BooleanTypeAnnotation' }, { type: 'VoidTypeAnnotation' }],
194182
},
195183
};
196184

0 commit comments

Comments
 (0)