sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules
MIT License
3.98k stars 361 forks source link

`expiring-todo-comments`: Allow all no-warning-comments options when allowWarningComments is false #2393

Open shawnmcknight opened 1 week ago

shawnmcknight commented 1 week ago

The expiring-todo-comments rule will proxy the unhandled comments to eslint/no-warning-comments when allowWarningComments is false. From what I can see, it passes the rule context from expiring-todo-comments to eslint/no-warning-comments but the only overlap on options between the two rules is the terms option.

This prohibits making use of the other options in eslint/no-warning-comments for location and decoration. The behavior of eslint/no-warning-comments is different from that of expiring-todo-comments for its detection of a warning comment. For instance, a multi-line comment in the format of:

/*
 * todo
 */

will not trigger the eslint/no-warning-comments rule because the decoration option must be set to ['*']. However, if that multi-line comment has a condition and is processed by expiring-todo-comments it will be handled with the appropriate warning level.

Adding decoration: ['*'] to the expiring-todo-comments option does not work because it violates the options schema of expiring-todo-comments. This request is to extend the options schema of expiring-todo-comments to include the schema properties from eslint/no-warning-comments which would allow the additional options to be specified and passed on to that rule.