Skip to content

expiring-todo-comments: should not flag "eslint disable" comments #2745

@cdavie-artium

Description

@cdavie-artium

I like the expiring-todo-comments rule, but it is annoying to try to disable it for a single line when allowWarningComments: false is set.

I expected this to work:

// eslint-disable-next-line unicorn/expiring-todo-comments
// TODO without a date

But the lint rule then flags the eslint-disable-next-line line itself as problematic!

The cumbersome workaround I've found is to use block disable comments instead (plus an extra next-line comment is required):

/* eslint-disable unicorn/expiring-todo-comments */
// TODO without a date
// eslint-disable-next-line unicorn/expiring-todo-comments
/* eslint-enable unicorn/expiring-todo-comments */

I think there are two bugs here:

  1. It should ignore eslint-disable lines entirely.
  2. It should not match substrings that happen to have "todo" within them (eg, "Mastodon" or "-todo-").

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions