pwlmaciejewski / coffeelint-variable-scope

CoffeeLint rule that warns you about overwriting outer scope variable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comment annotations to ignore

yang opened this issue · comments

commented

This has found quite a few issues in my code bases - thanks! It would be awesome to have a way to "bless" certain assignments as intentional, e.g. via a special comment annotation on the preceding line.

@yang Thanks! I had a look at it the other day and it may take me a while. If you have any ideas how to implement it feel free to make a PR.

If this rule sticks with just using the AST, you'll need to use block comments.

# This can't be found

##
# but this can
##

It might be possible to run regex over the code, but then you have to try to match up line numbers and inject these blessings at the right time instead of processing them as you encounter them. I hope this helps.

@AsaAyers Thanks! It helps, I can get the comment through AST.
@yang I've implemented the thing on dev branch using block comment. The drawback is that the comment gets passed to the output js file.