-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
idea: for expiring-todo-comments
: warn when GitHub issue is closed
#1858
Comments
I don't think it's a good idea to have this built-in. However, you could instead propose an option to the rule which could enable users to implement it themselves. Like some kind of hook. To solve the asyncness, we could say that users would have to use https://github.com/sindresorhus/make-synchronous |
I like the idea of a hook - although to be clear, what I was proposing would not be accessing anything over the network, it would probably just use |
It's true hitting up the Github API would be inappropriate, although this would be phenomenal if it could do that. Is there any "at your own risk" version of this? Often, it's not a specific version of a package that I'm concerned about, but whether or not a specific fix will be in the version. |
I wonder if it could be possible to make a way to add third party "expiration providers" to extend this module, eg. leaving GitHub resolution out of this repository but allowing for someone else to add support for it. That same mechanism could work for eg. Linear, Jira etc without this project itself having to deal with it. Enabling a plugin to add support for eg: Top level addition would be nicer, prefixing with something like |
I like that idea - or potentially even simpler, let users define a Config could look like: 'unicorn/expiring-todo-comments': [
'warn',
{
getExpiryMessage: (input, defaultExpiry) => {
const github = input.match(/#(\d+)/)
if (github) {
const changelogEntry = findGithubIssueInChangelog(github[1])
return changelogEntry ? github[1] + ' has been closed' : null
}
if (new Date().getDay() === 0) {
// skip the default behaviour on Sundays
return null
}
return defaultExpiry
}
}
] The advantage being it's fully explicit and flexible - the above implementation will still work even if this library starts parsing Edit: my phone collapsed the full conversation - this is basically @sindresorhus's hook idea. Thread is old enough I forgot it had already been suggested! |
I like having an option for determining what the default is, ie |
Don't want to be the "ping" guy, but I'm having more and more comments that look like |
I'm fine with adding a hook like |
I think this idea has been raised before, but I'm not sure it has with this specific restriction:
For a todo written like
Previously (I think) this idea has been rejected because hitting the GitHub API is an inappropriate thing to do from a lint rule, which is true. But there are many projects which keep a
changelog.md
file using a format like the one suggested by https://keepachangelog.com. If that changelog.md happens to include the wordsFixes #1234
orResolves #1234
orCloses #1234
, then this plugin could assume that that issue is closed, and turn this todo into an "expired" one.It wouldn't be 100% accurate, or work with 100% of projects, but might be better than not having it?
The text was updated successfully, but these errors were encountered: