Skip to content

[Suggestion]: Flag statements of the form: x == y; as "statement yields unused boolean" #58484

@jonmountjoy

Description

@jonmountjoy

I just found a bug after a hard search, and I had written this:

itemState.learningAspect == LearningAspect.learnContext;

instead of

itemState.learningAspect = LearningAspect.learnContext;

Is it possible for a lint rule to have caught this? (A better font would have helped me too)

ie. this should be flagged:

var x = 1;
x == 2;  // <===. would love this to be a lint error: "statement yields an unused boolean"

It's probably a warning, rather than an error - though I honestly can't imagine anyone really wanting to write a line like that, no matter how complex, but appreciate there may be a reason I can't think of.

There are probably some complexities around function calls. For example, if f() returns a boolean:

f();

In this case, I'm less certain that I want it flagged.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions