Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expiring-todo-comments: Add date option #1683

Merged
merged 4 commits into from Jan 13, 2022
Merged

Conversation

mmkal
Copy link
Contributor

@mmkal mmkal commented Jan 6, 2022

This could be useful a few ways:

  1. Testing lint configs
  2. Finding todos that expire soon but not yet
  3. Testing the rule itself
  4. Finding very out of date todos, e.g. by setting the date one year in the past

@fisker @sindresorhus I'll add tests and docs once we've established the feature is something that would be considered Docs and tests added. I was going to make an issue but it was about the same amount of effort to make the (runtime) code change as PR. I did it in the GitHub UI 🙃

👇 something like what I'll add to the docs

date

Type: string (date format)
Default: <today>

For TODOs with date deadlines, this option makes them trigger only if the deadline is later than the specified date. You could set this to a date in the future to find TODOs that expire soon, or set it far in the past if you want to ignore recently-expired TODOs.

The format must match json-schema's date.

examples

Find tech debt that has grown up and gone to college by triggering the rule for TODOs with old dates:

"unicorn/expiring-todo-comments": [
	"error",
	{
		"date": "2000-01-01"
	}
]

Prepare for the future by triggering the rule for TODOs with dates from the next millennium:

"unicorn/expiring-todo-comments": [
	"error",
	{
		"date": "3000-01-01"
	}
]

This could be useful a few ways:

1. Testing lint configs, finding todos that expire _soon_ but not yet
2. Testing the rule itself
3. Finding _very_ out of date todos, e.g. by setting the date one year in the past
@sindresorhus
Copy link
Owner

Makes sense to me.


I use something similar when I make macOS apps where I can pass a flag to see APIs that will be deprecated in the future.

@sindresorhus sindresorhus changed the title expiring-todo-comments: date option expiring-todo-comments: date option Jan 12, 2022
@sindresorhus sindresorhus changed the title expiring-todo-comments: date option expiring-todo-comments: Add date option Jan 12, 2022
@sindresorhus
Copy link
Owner

Tests are failing

@mmkal mmkal marked this pull request as draft January 12, 2022 20:58
@mmkal
Copy link
Contributor Author

mmkal commented Jan 12, 2022

Not sure why it's failing on CI but not locally. Will debug.

@fisker
Copy link
Collaborator

fisker commented Jan 13, 2022

const shouldIgnore = options.ignoreDatesOnPullRequests && ci.isPR;
caused by this line?

@mmkal
Copy link
Contributor Author

mmkal commented Jan 13, 2022

@fisker that was it - thanks!

@mmkal mmkal marked this pull request as ready for review January 13, 2022 04:23
@sindresorhus sindresorhus merged commit 16bc33a into sindresorhus:main Jan 13, 2022
@mmkal mmkal deleted the patch-1 branch January 13, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants