#noUnusedLocals

31 messages · Page 1 of 1 (latest)

teal creek
#

Greetings all. I have noUnusedLocals set to true, and it flags an error when inside a class method. However, is just flagging a warning when it is an unused class property directly inside my class. I would like typescript to flag a error, instead of just a warning. Is this possible?

blazing sun
#

Hover over it? TS doesn't normally give warnings, so could be eslint interferring?

worthy pollen
#

a class property isn't a local variable, so this'll be under something else, if such a rule exists

#

oh yeah ts doesn't have that, that warning is from something else.

teal creek
#

@blazing sun @worthy pollen thanks both.

#

This error comes from StencilJs... We are using @stencil-community rules, like the following:

#

"@stencil-community/no-unused-watch": "error", // This rule catches Stencil Watchs with non existing Props or States

#

I have had a look at the stencil-eslint documentation, but there doesn't seems to be a rule for unused properties:

blazing sun
#

this works for JS private members (#)

teal creek
blazing sun
#

Oh I see, that is typescript

teal creek
#

I am trying your suggestion now

blazing sun
#

so tested it, and TS shows that message, but doesn't give yellows squigglies for me

#

So I'm not sure what's causing that

blazing sun
teal creek
#

Why is this?

blazing sun
#

#foo is javascript, private foo is typescript

teal creek
#

I see

#

javacript doesn't has the concept of private, right ?

blazing sun
#

yes #foo is private

#

private foo is fake private. TS will prevent you from accessing it, but it is still there and can be accessed with JS or @surreal shore

teal creek
#

isn't some sort of eslint for typescript ?

blazing sun
#

the real private with # is probably better IMO

#

Yes, but I couldn't see a rule for it

#

Consider just using # instead

#

typescript eslint is @cold edge-eslint/xxxx

#

You could suggest it i guess

teal creek
#

Thanks!