Skip to content

[javascript] UnnecessaryBlock - false positives with destructuring assignments #2305

@bkdotcom

Description

@bkdotcom

Rule: UnnecessaryBlock

Description:
Unfortunately I do not know what version of PMD is being used..
PMD is one of the test suites that codacy.com uses..

Code Sample demonstrating the issue:

import { foo } from './someScript.js' // missing semicolon
const { isLoggedIn } = useAuth();  // <--- violation here: unnecessary block

throws "Unnecessary block."

However, the brackets are quite necessary and designate a named import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions