Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ no-constant-condition] should validate 'void' too #5726

Closed
pvamshi opened this issue Mar 29, 2016 · 12 comments
Closed

[ no-constant-condition] should validate 'void' too #5726

pvamshi opened this issue Mar 29, 2016 · 12 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@pvamshi
Copy link
Contributor

pvamshi commented Mar 29, 2016

Request type : Enhancement

Rule : no-constant-condition

What version of ESLint are you using?
2.5.1

What parser (default, Babel-ESLint, etc.) are you using?
default

Please show your full configuration:

{
  "rules": {
    "no-constant-condition": 2   // disallow use of constant expressions in conditions
  }
}

What did you do? Please include the actual source code causing the issue.

if(void x){}
if (void x === void x){}

What did you expect to happen?
Error as it is a constant condition

What actually happened?
No error

As discussed in #5228 & #5696

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Mar 29, 2016
@pvamshi pvamshi changed the title [ no-constant-condition] should validate 'void` too [ no-constant-condition] should validate 'void' too Mar 29, 2016
@ilyavolodin ilyavolodin added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Mar 29, 2016
@ilyavolodin
Copy link
Member

Sounds reasonable to me. Although I think the primary case should be:

if (void) {}

@dead-claudia
Copy link

@ilyavolodin You mean if (void foo) {}? 😉

@ilyavolodin
Copy link
Member

Yes I do:-)

@vitorbal
Copy link
Member

vitorbal commented Apr 1, 2016

I would love to tackle this one if it gets accepted!

@michaelficarra
Copy link
Member

There's also some other missing expression types in the isConstant function. ConditionalExpression stands out to me. I think this issue should be about generally expanding that function as best we can.

@vitorbal
Copy link
Member

vitorbal commented Apr 8, 2016

Should it really be addressed in this issue? I have a PR ready for the void case otherwise.

@alberto
Copy link
Member

alberto commented Aug 1, 2016

Is anyone championing this? @eslint/eslint-team

@platinumazure
Copy link
Member

platinumazure commented Aug 1, 2016

I count one 👍 (@ilyavolodin, maybe a stretch). I will add one more 👍.

@vitorbal, you could champion or add 👍. Then we need whatever you don't do. 😄

@michaelficarra I think we should create a separate issue for the problem you've brought up.

@vitorbal
Copy link
Member

vitorbal commented Aug 1, 2016

@alberto @platinumazure thanks for the ping! I am willing to champion this change and I've already got a PR almost ready, just in need of a rebase.

I agree that we should open a separate issue for the extra checks.

@nzakas
Copy link
Member

nzakas commented Aug 2, 2016

I'll 👍

@vitorbal as the champion, you should secure one more definitive 👍 and then you can mark as accepted.

@alberto
Copy link
Member

alberto commented Aug 2, 2016

👍

@alberto alberto added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 2, 2016
@vitorbal
Copy link
Member

vitorbal commented Aug 3, 2016

Thanks all, I will get around to finishing this by the end of this week!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

9 participants