antfu / eslint-config

Anthony's ESLint config preset

Home Page:https://eslint-config.antfu.me/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The `name` prop in the first argument would be omitted in `eslint-flat-config-viewer`.

lvjiaxuan opened this issue · comments

Describe the bug

Because the name prop is filtered by antfu(), the eslint-flat-config-viewer could not display it when I named my plugin. Should add it into fusedConfig?

// User can optionally pass a flat config item to the first argument
// We pick the known keys as ESLint would do schema validation
const fusedConfig = flatConfigProps.reduce((acc, key) => {
if (key in options)
acc[key] = options[key] as any
return acc
}, {} as FlatConfigItem)
if (Object.keys(fusedConfig).length)
configs.push([fusedConfig])
const merged = combine(
...configs,
...userConfigs,
)
return merged
}

I find that the name prop belongs to the base schema that ESLint uses, which menas it can pass the schema validation.
https://github.com/humanwhocodes/config-array/blob/26afaaa125f42abc4f9e6d88a9873a61ea66909d/src/base-schema.js#L27

Reproduction

https://github.com/lvjiaxuan/repro-antfu-eslint-config-1

System Info

System:
    OS: Windows 10 10.0.17763
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 6.25 GB / 15.81 GB
  Binaries:
    Node: 18.18.2 - d:\nvm\nodejs\node.EXE
    Yarn: 1.22.19 - d:\nvm\nodejs\yarn.CMD
    npm: 9.8.1 - d:\nvm\nodejs\npm.CMD
    pnpm: 8.14.0 - d:\nvm\nodejs\pnpm.CMD
  Browsers:
    Chrome: 120.0.6099.225
    Internet Explorer: 11.0.17763.2989

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Sure, PR welcome :)