See which variables in a JavaScript object are unused?

Is there a way to easily see which variables in a JavaScript object are not being used? 

If I have a variable which is unused then it's greyed out, which is really helpful:

let foo = 'bar'

However with the following code, neither `one` nor `two` are greyed out, even though `two` is not being used  

let obj = {
one: '1',
two: '2'
}

const thing = obj.one;

 

0
7 comments

Try enabling Report unused properties in Settings | Editor | Inspections, JavaScript and TypeScript | Unused symbols | Unused global symbol

0

Ive tried that but no change. 

0

works fine for me in 2020.1.1:

0

Could it be because Im using a .tsx file? 

0

Works for me in .tsx:

make sure that there are no occurrences of `two` in your project

0

There defiantly arn't in this file, however there might be elsewhere in the project. 

0

Please sign in to leave a comment.