Closed alecmev closed 1 month ago
Can you help me understand what this is doing?
Sure! README instructs to use the config like so:
But that actually won't work, gotta spread it:
export default config = [...nounsanitized.configs.recommended];
But I propose that instead recommended
is turned into an object, rather than an array with a single object in it. That makes it easier to "patch" the config, e.g.:
export default config = [{ ...nounsanitized.configs.recommended, files: ['**/foo/*.js'] }];
With the array you instead need to do this:
export default config = [...nounsanitized.configs.recommended.map((x) => ({ ...x, files: ['**/foo/*.js'] }))];
OK, thanks for explaning. I'd like @Standard8 to take a second look. Might just be there's a reason why this is written the way it is and I don't want to break anything accidentally. :)
Thanks! 😉
The usage example in README is incorrect. Could fix README, but this approach is easier to deal with (e.g., when you want to just add
files: [...]
to it). This is a breaking change, unfortunately.