Skip to content

Does not support destructuring in function arguments if the key in a destructured object is a string #598

@michalczaplinski

Description

@michalczaplinski

Expected behavior

The parser should be able to handle destructuring with renaming in function parameters when the key is a string.

Actual behavior

Eslint throws the Unsupported function signature format error and stops linting:

[Error - 11:50:20 AM] ESLint stack trace:
[Error - 11:50:20 AM] Error: Unsupported function signature format.
Occurred while linting /Users/czapla/Testing/frontity/packages/components/link.tsx:71
    at getParamName (/Users/czapla/Testing/frontity/node_modules/eslint-plugin-jsdoc/dist/jsdocUtils.js:178:11)

The offending code

const someFunction = ({ 
  "value": renamedValue,
  otherArg,
}) => {
  console.log("not important");
}

If I comment out the line with "value": renamedValue, the parser continues to work. This is a rare use case, because normally you can omit the quotes, but becomes necessary if the key includes a hyphen like { "renamed-value": renamedValue }

Environment

  • Node version: v14.2.0
  • ESLint version eslint@6.8.0
  • eslint-plugin-jsdoc version: 27.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions