eslint / config-inspector

A visual tool for inspecting and understanding your ESLint flat configs.
https://www.npmjs.com/package/@eslint/config-inspector
Apache License 2.0
518 stars 15 forks source link

fix: prepend eslint default configs #66

Closed voxpelli closed 1 week ago

voxpelli commented 1 week ago

The default config in ESLint is always prepended to the config before it uses the config, making it so that **/*.js, **/*.mjs, **/*.cjs are always matching file patterns: https://github.com/eslint/eslint/blob/21d3766c3f4efd981d3cc294c2c82c8014815e6e/lib/config/default-config.js#L66-L69

This PR copies those two configs and prepends them here as well, with some added names for them to make sense.

This is somewhat of a blunt fix. UI-wise it can be handled better and ideally one or more of defaultConfig, FlatConfigArray and calculateConfigArray would be exposed by ESLint so that this inspector can make use of the very same logic rather than attempt to reimplement it.

If additionally defaultConfig were to eg. add names, then this inspector could opt to eg. hide all eslint/ prefixed rules and as such get the correct prepended config without having to confuse users with showing a config they never themselves added