Open charlie-abbott-deltatre opened 1 year ago
I like this one! It should be fairly easy to implement. There are two AST nodes, CommentStatement
and CommentExpression
that you'd look for in the walker, then we'd just need to define how you configure this in the bslint.json.
Some other things to consider with this change would be to define other allowed comments, like:
'bs:disable-line '#region and '#endregion
etc
How would you handle comments like this?
sub main()
' get from the registry
username = getFromRegistry()
' print it
print username
end sub
For devs that would like to use this feature, they would need to update those comments to work with the todo-pattern
.
Also with use of todo-pattern
comments like this, over multiple lines:
'NOTE: some comment
' over 2
' or more lines
Maybe fun.
eslint has an alternative approach, where they actually try to parse the comments, and only show errors for code that will parse without error.
https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-commented-out-code.md
It's worth at least considering. The eslint approach would cause some unparseable commented-out-code to get missed, but might be way nicer for devs to not have to rewrite every single one of their comments to prefix with 'NOTE:'
There is currently no rule for catching commented out code, single or multiple line that is not a
todo-pattern
ornoop
comment.