Skip to content

Bug: ValidationStrategy.object() accepts arrays #404

@Pixel998

Description

@Pixel998

Which packages are affected?

  • @eslint/compat
  • @eslint/config-array
  • @eslint/config-helpers
  • @eslint/core
  • @eslint/mcp
  • @eslint/migrate-config
  • @eslint/object-schema
  • @eslint/plugin-kit

Environment

Node version: v24.14.0
npm version: v11.9.0
@eslint/object-schema: v3.0.3
Operating System:

What did you do?

import { ValidationStrategy } from "@eslint/object-schema";

ValidationStrategy.object([]);

What did you expect to happen?

I expected ValidationStrategy.object([]) to throw a TypeError.

Because ValidationStrategy exposes object() and array() as separate built-in validators, I expected object() not to treat arrays as valid input.

What actually happened?

No error was thrown.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/node-2s958zgk

Participation

  • I am willing to submit a pull request for this issue.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

If this behavior is intentional, the docs for the built-in object strategy may need to clarify that arrays are considered valid objects.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrepro:yesIssues with a reproducible example

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions