Skip to content

Bug: overrideConfig requires overrideConfigFile #19279

Open
@abrahamguo

Description

Environment

Environment Info:

Node version: v22.12.0
npm version: v11.0.0
Local ESLint version: v9.17.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 24.1.0

What parser are you using?

Default (Espree)

What did you do?

eslint.config.js:

import { ESLint } from "eslint";

new ESLint({ overrideConfig: [] })
  .calculateConfigForFile(import.meta.filename)
  .then(({ rules }) => console.log(rules));

export default [{ rules: { semi: "error" } }];

What did you expect to happen?

I would have expected that the overrideConfig would take effect, and therefore that undefined would be logged as the rules.

What actually happened?

{ semi: 2 } is logged, until you add overrideConfigFile: true to the options.

Link to Minimal Reproducible Example

https://github.com/abrahamguo/repro/tree/override-config

Participation

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

Additional comments

It's unclear to me whether this is an issue with ESLint, or whether this is intended behavior and an issue with ESLint's docs.

The docs state this:

options.overrideConfig (ConfigData | ConfigData[] | null)
Default is null. Configuration object, overrides all configurations used with this instance. You can use this option to define the settings that will be used even if your configuration files configure it.
options.overrideConfigFile (string | boolean)
Default is false. The path to a configuration file, overrides all configurations used with this instance. The options.overrideConfig option is applied after this option is applied.

This makes it sound like you should use either one or the other, not both together.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    documentationRelates to ESLint's documentationevaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusionrepro:yesIssues with a reproducible example

    Type

    No type

    Projects

    • Status

      Triaging

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions