Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sindresorhus/eslint-plugin-unicorn/llms.txt

Use this file to discover all available pages before exploring further.

TODO and FIXME comments are easy to forget. This rule lets you attach a structured condition directly to the comment — a date, a package version, a dependency — so ESLint reports the comment automatically when the condition is met.
Recommendedrecommended · ☑️ unopinionated
Fixable
Suggestions
TODOs without any condition are ignored by default. Set allowWarningComments: false to also flag bare TODOs (equivalent to eslint/no-warning-comments).

Conditions

Conditions are written in square brackets directly after the TODO/FIXME/XXX keyword and separated by commas for combinations.
SyntaxTriggers when
[YYYY-MM-DD]The UTC date has passed
[>=1.0.0] or [>1.0.0]package.json version meets the comparison
[+package-name]The package is present in dependencies
[-package-name]The package has been removed from dependencies
[package@>=2.0.0]A dependency reaches that version
[engine:node@>=18]package.json engines.node meets the comparison

Examples

// Past due date — triggers immediately
// TODO [2000-01-01]: I'll fix this next week.

// Multiple dates on one TODO — not valid
// TODO [2000-01-01, 2001-01-01]: Multiple dates won't work.

// Package already installed — triggers
// TODO [+already-have-pkg]: Since we already have it, this reports.

// Package already removed — triggers
// TODO [-we-dont-have-this-package]: Since we don't have it, this reports.

// Package version already exceeded — triggers
// TODO [read-pkg@>=1.0.0]: Update when read-pkg hits 1.0.0.

// Node engine version already met — triggers
// TODO [engine:node@>=8]: Whoops, we are already supporting it!

Configuration

eslint.config.js
export default [
  {
    rules: {
      'unicorn/expiring-todo-comments': [
        'error',
        {
          terms: ['todo', 'fixme', 'xxx'],
          ignore: [],
          ignoreDates: false,
          ignoreDatesOnPullRequests: true,
          allowWarningComments: true,
        },
      ],
    },
  },
];

terms

Type: string[] — Default: ['todo', 'fixme', 'xxx'] The comment keywords to check. When adding a custom term, include the defaults explicitly or they will be dropped.
eslint.config.js
{ terms: ['todo', 'fixme', 'xxx', 'hack'] }

ignoreDates

Type: boolean — Default: false Skip expiry-date checks entirely. Date argument validation (for example, detecting multiple dates on one TODO) still applies.

ignoreDatesOnPullRequests

Type: boolean — Default: true Skip expiry-date checks when running inside a pull request. This avoids false positives when a contributor opens a PR after a TODO deadline has passed — the fix should be the maintainer’s responsibility.

allowWarningComments

Type: boolean — Default: true When false, TODOs without any valid condition are also reported (falling back to eslint/no-warning-comments behavior). Useful if you want a single rule to cover both expiring and plain TODOs.

ignore

Type: Array<string | RegExp> — Default: [] Patterns to skip entirely. Only useful when allowWarningComments is false. Strings are interpreted as regular expressions.
eslint.config.js
{
  allowWarningComments: false,
  ignore: ['#\\d+', /issue-\d+/i],
}

date

Type: string (ISO 8601 date) — Default: today’s date Override the reference date used for expiry-date comparisons. Set to a past date to find very old TODOs, or a future date to preview which TODOs will expire soon.
eslint.config.js
// Only flag TODOs older than the year 2000
{ date: '2000-01-01' }
You can combine multiple conditions on a single TODO by separating them with commas: TODO [2200-12-25, +react, lodash@>10]: Combo. Each condition triggers an independent report.

Build docs developers (and LLMs) love