Coder Social home page Coder Social logo

Comments (2)

ericmorand-sonarsource avatar ericmorand-sonarsource commented on June 12, 2024

Can we re-discuss this issue just to make sure that it is legit to add an exception?

  • With types, if strictNullChecks is disabled, the rule never triggers because T is analogous to T | null | undefined in this case
  • With types, if strictNullChecks is enabled, the rule never triggers because the compiler would not accept a variable of type T to be assigned null or undefined rendering the comparison body not reachable anyway
  • Without types and without JSDoc annotations, the rule is never triggered because T is analogous to T | null | undefined in this case
  • With JSDoc annotations, the rule is triggered when the JSDoc-declared type does not intersect with null, when compared to null, or undefined when compared to undefined. Hence, in this case, the issue comes from an incorrect JSDoc annotation instead of a rule false positive (for example, about https://peach.aws-prd.sonarsource.com/issues?resolved=false&rules=javascript%3AS3403&open=AYpEPL6JA8vuoRjT2MwJ, see https://github.com/WordPress/gutenberg/blob/trunk/packages/rich-text/src/types.ts)
  • With pure JavaScript - no tsconfig.json file, the rule is never triggered.

from sonarjs.

Wohops avatar Wohops commented on June 12, 2024

Migrated to Jira. New ticket number: JS-36

from sonarjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.