8000 Rule Proposal: no unnecessary non-null assertion · Issue #252 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Rule Proposal: no unnecessary non-null assertion #252

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

Closed
bradzacher opened this issue Feb 11, 2019 · 1 comment · Fixed by #253
Closed

Rule Proposal: no unnecessary non-null assertion #252

bradzacher opened this issue Feb 11, 2019 · 1 comment · Fixed by #253
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look

Comments

@bradzacher
Copy link
Member
bradzacher commented Feb 11, 2019

We have no-non-null-assertion, but I would like to allow non-null assertions, but warn against using the non-null operator when there is no nullability. i.e.

function foo (a : number, b : number | undefined) {
  return (
    // should report
    a!.toString() +
    // is fine
    b!.toString()
  );
}

Would require renaming the rule.

@bradzacher bradzacher added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Feb 11, 2019
@bradzacher
Copy link
Member Author

Covered by no-unnecessary-type-assertion

We should update the docs to include an example so that it's clear that it supports it

kaicataldo pushed a commit to kaicataldo/typescript-eslint that referenced this issue Aug 27, 2019
…t-eslint#252)

When user has `git core.autocrlf` set to crlf on windows machines there are collisions between `eslint-docs` and `prettier` due to inconsistent line endings in md files.

fixes: typescript-eslint#249
@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look
Projects
None yet
1 participant
0