Content-Length: 287473 | pFad | http://github.com/typescript-eslint/typescript-eslint/issues/10566

95 Docs: [prefer-nullish-coalescing] streamline code examples · Issue #10566 · typescript-eslint/typescript-eslint · GitHub
Skip to content

Docs: [prefer-nullish-coalescing] streamline code examples  #10566

@kirkwaiblinger

Description

@kirkwaiblinger

Before You File a Documentation Request Please Confirm You Have Done The Following...

Suggested Changes

The code examples

  1. don't use our standard tabs approach to displaying incorrect vs correct code
  2. Repeat the same snippet over and over unnecessarily (the intention was probably to show how the fixer works, but it just isn't great how it's done.)
    const foo: any = 'bar';
    foo ?? 'a string';
    foo ?? 'a string';
    foo ?? 'a string';
    foo ?? 'a string';
    
    const foo: string | undefined = 'bar';
    foo ?? 'a string';
    foo ?? 'a string';
    
    const foo: string | null = 'bar';
    foo ?? 'a string';
    foo ?? 'a string';

Let's use the tabs and streamline the examples a bit. Also let's remove the duplicate identifiers so that the code is valid TS as written.

Affected URL(s)

https://typescript-eslint.io/rules/prefer-nullish-coalescing/

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/typescript-eslint/typescript-eslint/issues/10566

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy