Skip to content

Conversation

jakebailey
Copy link
Member

Follow-up to #54693.

This is probably more for discussion; these extra !! are redundant and not obviously wrong, but, it's probably a fine cleanup.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jul 24, 2023
@jakebailey
Copy link
Member Author

Aha, well, clearly I expected --fix to not cause any new errors, and yet here we are; seems like this lint rule isn't always accurate.

@jakebailey jakebailey marked this pull request as draft July 24, 2023 19:10
@fatcerberus
Copy link

Looking at the diff I see a few places where it does stuff like !!foo.bar ? foo.bar() : defVal - I like the !! there because it makes it clear you’re checking for method existence and didn’t just accidentally forget the parens on a method call.

Also I thought TS itself had a check that flags stuff like if (obj.method) {} as an error (”Did you mean to call this function?”), likewise for promises without an await, so these might not always be redundant in a way that a linter can detect.

@jakebailey
Copy link
Member Author

I don't disagree; I'll probably just disable this rule instead.

We do have those checks, though they only apply in certain circumstances.

@jakebailey
Copy link
Member Author

I'm opting to disable this in #55136.

@jakebailey jakebailey closed this Jul 24, 2023
@jakebailey jakebailey deleted the eslint-no-extra-boolean-cast branch July 24, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants