Fix no-inline-named-types to match required members only
Ignore optional members instead of skipping the entire type.
{ x: number; y: number; label?: string } now correctly flags as
Vector, while { x?: number; y?: number } is still ignored.
This commit is contained in:
parent
5ef7111998
commit
df0ccbca48
|
|
@ -28,9 +28,10 @@ const noInlineNamedTypes = {
|
|||
)
|
||||
if (!props || props.length < 2) return
|
||||
|
||||
if (props.some((m) => m.optional)) return
|
||||
const required = props.filter((m) => !m.optional)
|
||||
if (required.length < 2) return
|
||||
|
||||
const shape = props
|
||||
const shape = required
|
||||
.map((m) => {
|
||||
const typeNode = m.typeAnnotation?.typeAnnotation
|
||||
let typeName = 'unknown'
|
||||
|
|
|
|||
Loading…
Reference in a new issue