2019.2 TSLint custom rule not underlining whole node

I've written a custom rule for TSLint to give a warning when you name an @Input() with a reserved name.

I've tested this rule on VSCode where it works fine and underlines the entire section that is triggering this rule. When I use Webstorm it only underlines the first character. I've tried different methods of specifying the part that needs underlining but it still only underlines the first character of the section that I tell it to underline. Other not custom TSLint rules work just fine.

Is there a configuration that I'm missing or am I doing something wrong?

My tslint version is 5.7.0 and I'm currently using Webstorm 2019.2

0
2 comments
Avatar
Permanently deleted user

Thanks for raising this issue!

The IDE sometime intentionally ignores end offsets of errors reported by linters to avoid highlighting large chunks of code (like whole multiline functions / decorators), which would hide other errors. We believe this gives a better experience generally, but in this case it seems like a bug: we should highlight a wider range.

I've created WEB-40463  to track it.

On a related note:

> I've written a custom rule for TSLint to give a warning when you name an @Input() with a reserved name.

We will fix the bug in any case, but if the name of the input is the argument, like

@Input("reservedName")

... then maybe it makes sense to report the error at "reservedName" instead, since it will be easier for users of all editors (not only WS) to determine the part actually causing the error?

1
Avatar
Permanently deleted user

Thank you for your comment!

We still prefer to underline the entire line but like you said that isn't really possible so I tried to emulate this by targeting the individual parts of the line. So when you do your inport like this

@Input() reservedName: string;

, you would target the decorator name, the expression and the type. This highlights 'Input()', 'reservedName' and 'string' and kind of simulates the effect I'd like.

Thanks for getting me to understand this!

0

Please sign in to leave a comment.