Docs: undocumented (and surprising) behavior of files
accepting nested arrays of string #18966
Description
Docs page(s)
https://eslint.org/docs/latest/use/configure/configuration-files
What documentation issue do you want to solve?
Hello!
Recently I discovered seemingly undocumented and quite unintuitive behavior or files
config parameter. As per types, files
are accepting a nested array of strings:
Line 1260 in cb69ab3
And without any doubt I assumed the files array will be flattened into string[]
and thus the reason for such a type is developer convenience.
But I proved to be wrong. If another array of strings is passed to the top level array, only files matched all the patterns from that array will be matched, i.e. intersection operation is taking place.
Here is a small repo demonstrating that behavior: https://stackblitz.com/edit/vitejs-vite-ujdzec
Run pnpm test
to lint. I've left a note in the eslint config file what should be changed to confirm this behavior.
What do you think is the correct solution?
I would like to see this documented in the main documentation on the site and ideally in JSDoc for files
property. Sorry if I've missed it.
Participation
- I am willing to submit a pull request for this change.
Additional comments
No response
Metadata
Assignees
Labels
Type
Projects
Status
Feedback Needed
Activity