Skip to content

Change Request: defineConfig to freeze config #245

@privatenumber

Description

@privatenumber

Which packages would you like to change?

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

What problem do you want to solve?

With flat configs, users manage extension manually. This makes it easy to accidentally mutate shared config objects, especially in setups with multiple plugins or layered configs.

This can lead to unpredictable behavior, particularly when multiple plugins rely on the same config object. When there's no safeguard against mutation, these side effects can be hard to trace and debug.

ESLint's own config config uses Object.freeze() to prevent this, but many third-party config authors may not always remember to freeze their config objects manually.

What do you think is the correct solution?

Have defineConfig automatically deep freeze the returned config. This would align with ESLint's own internal practice, add a protective seal to the config, and make immutability the default.

Participation

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

Additional comments

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Triaging

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions