question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show unused public properties and methods

See original GitHub issue

It would be nice to have unused detection expanded, capable of detecting unused methods, exports, etc.

Code Example

Shape.js

class Shape {
    constructor() {
        this.color = 'red';
    }

    colorLog() {
        console.log(this.color);
    }
}

export default Shape;

Circle.js

import Shape from "./Shape";

class Circle extends Shape {
  constructor() {
    super();

    // FIXME: description should show as unused in VSCode, as it does in WebStorm.
    this.description = 'A circle shape';
  }

  // FIXME: circleLog should show as unused in VSCode, as it does in WebStorm.
  circleLog() {
    // NOTE: both VSCode and WebStorm have detected an unused variable.
    const num = 2;

    // NOTE: colorLog is being used, so no unused code errors in Shape.js file.
    super.colorLog();
  }
}

// FIXME: export should show as unused in VSCode, as it does in WebStorm.
export default Circle;

VSCode Screen

screen shot 2019-01-04 at 9 23 48 pm

WebStorm Screen

screen shot 2019-01-04 at 9 23 07 pm

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:79
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
SigmaOutdoorscommented, May 12, 2020

Another vote for this feature, first priority IMO would be some kind of indication for unused variables - grey/red squiggles, don’t care much.

12reactions
fatihturgutcommented, Sep 18, 2019

is there any news about this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove unused classes, properties, and functions
To find unused members with a Code Analysis Ruleset, from the Visual Studio menu select File -> New -> File… -> General ->...
Read more >
Eliminating unused methods, properties and classes - MSDN
You can find it the option on the "build" tab. This will show unused properties, variables, methods etc. as errors. Thanks, but that...
Read more >
How to easyily find unused public methods/properties
My task is to identify methods and properties which are not used, but exist in the projects. Well, I can find private methods...
Read more >
Detecting Unused Private Properties, Methods, and Constants
Detecting Unused Private Properties, Methods, and Constants ; class Foo ; { private ; Bar $bar ; // only written - never read!...
Read more >
Find unused private and public methods with Resharper
Find unused private and public methods with Resharper ... There are times when you find dependencies of some legacy code in a method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found