eslint-community / eslint-plugin-eslint-comments

Additional ESLint rules for directive comments of ESLint.
https://eslint-community.github.io/eslint-plugin-eslint-comments
MIT License
51 stars 7 forks source link

feat: add `name` to flat config (for tooling) #243

Closed brettz9 closed 1 month ago

brettz9 commented 2 months ago

ESLint recommends a name for flat configs.

Tools like https://github.com/eslint/config-inspector can use this to indicate the source of rules.

I did not add it to the older, non-flat configs because it will err there.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.87%. Comparing base (e0f326f) to head (332c5cd). Report is 10 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #243 +/- ## ======================================= Coverage 97.87% 97.87% ======================================= Files 17 17 Lines 282 282 ======================================= Hits 276 276 Misses 6 6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

brettz9 commented 1 month ago

@voxpelli : Could you take a look?

voxpelli commented 1 month ago

The one thing I'm thinking is whether we should include the @eslint-community/ prefix or not – do we do that elsewhere already?

From https://eslint.org/docs/latest/use/configure/configuration-files#configuration-naming-conventions :

The name should be descriptive of the configuration object’s purpose and scoped with the configuration name or plugin name using / as a separator.

Eg. the config-inspector will color the @eslint-community and eslint-comments differently, making it kind of look like @eslint-community is the name of the module 🤔

Skärmavbild 2024-08-15 kl  09 53 25

I guess we can do this and open an issue in the config inspector to handle @-prefixes.

ESLint itself is also doing something funny with @ itself, the default plugin being named "@": https://github.com/eslint/eslint/blob/21d3766c3f4efd981d3cc294c2c82c8014815e6e/lib/config/default-config.js#L20-L44

voxpelli commented 1 month ago

Actually tried out "fixing" this in config-inspector, but I think its actually better as is.

When scope and module name is treated as one:

Skärmavbild 2024-08-15 kl  11 19 12

When its split like today:

Skärmavbild 2024-08-15 kl  11 20 11

The latter look better I think