(
props: TInterface['properties'],
propGroups: {[name: string]: (string | RegExp)[]} = GROUPS
)
| 317 | } |
| 318 | |
| 319 | function groupProps( |
| 320 | props: TInterface['properties'], |
| 321 | propGroups: {[name: string]: (string | RegExp)[]} = GROUPS |
| 322 | ): [TInterface['properties'], {[name: string]: TInterface['properties']}] { |
| 323 | props = Object.fromEntries( |
| 324 | Object.entries(props).filter( |
| 325 | ([, prop]) => |
| 326 | prop.type === 'property' && prop.access !== 'private' && prop.access !== 'protected' |
| 327 | ) |
| 328 | ); |
| 329 | let groups = {}; |
| 330 | |
| 331 | // Default groups |
| 332 | for (let group in propGroups) { |
| 333 | let groupProps = {}; |
| 334 | for (let propName of propGroups[group]) { |
| 335 | if (propName instanceof RegExp) { |
| 336 | for (let key in props) { |
| 337 | // eslint-disable-next-line max-depth |
| 338 | if (propName.test(key)) { |
| 339 | groupProps[key] = props[key]; |
| 340 | delete props[key]; |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | continue; |
| 345 | } |
| 346 | |
| 347 | if (props[propName]) { |
| 348 | if (propName === 'id' && props[propName].value.type !== 'string') { |
| 349 | continue; |
| 350 | } |
| 351 | |
| 352 | if ( |
| 353 | propName === 'value' && |
| 354 | ((group === 'Value' && !props.defaultValue) || |
| 355 | (group === 'Forms' && props[propName].value.type !== 'string')) |
| 356 | ) { |
| 357 | continue; |
| 358 | } |
| 359 | |
| 360 | if ( |
| 361 | propName === 'type' && |
| 362 | group === 'Forms' && |
| 363 | !props[propName].description?.includes('form') |
| 364 | ) { |
| 365 | continue; |
| 366 | } |
| 367 | |
| 368 | if (propName === 'children' && group === 'Content' && !props.items && !props.columns) { |
| 369 | continue; |
| 370 | } |
| 371 | |
| 372 | if (propName === 'target' && props[propName].value.type !== 'identifier') { |
| 373 | continue; |
| 374 | } |
| 375 | |
| 376 | if ( |
no test coverage detected