Bug: [Flat config] Errors should indicate which config object contains error #18926
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
enhancement
This change enhances an existing feature of ESLint
[My apologies for not using the template to provide an executable MRE. Hopefully this problem is self-evident enough that's not needed]
Environment
Problem
As mentioned in the title, if a
eslint.config.js
file exports an array of configs with more than one item, diagnosing which config object has the error can be problematic.Example
The config: eslint.config.js
The error
NOTE: Log output fails to show which of the four config objects has the bad
plugins
key. This puts the user in the position of having to guess and/or use trial and error to track down which of the four config objects is the problem.This becomes particularly problematic as the size and complexity of the array grows. For example, our (CodePen's) current config setup has a dozen different config objects:
Solution (Proposed)
Option 1: include config index in error
At a minimum, including the index of the config object in the error message would be helpful. For example...
Option 2: support
config#name
property on config objects, and include in errorFor example, with this config...
... the error might read:
The text was updated successfully, but these errors were encountered: