Skip to content

[check-param-names] Support disabling destructuring #616

@brawaru

Description

@brawaru

Motivation

When using TypeScript and React it's really simple to write your components and their props like that:

/**
 * Properties for the Greeting component
 */
interface IGreetingProps {
  /**
   * Who is greeting to
  */
  target: string;
}

/**
 * @returns Greeting component
 */
function Greeting({ target }: IGreetingProps) {
  return <>Hello, {target}!</>;
}

/**
 * @returns App component
 */
export default function App() {
  return (
    <div>
      <Greeting target='world' />
    </div>
  );
}

Current behavior

Unfortunately, in some of recent (not that I missed about five months of releases) versions defaults now ask you:

  • To document root1 (param1 according to TypeScript) parameter (that's okay, I can do that even that it is never displayed anywhere?)
  • To document all properties of that root1, so in our case param1.target (that's not okay and is useless duplication for TypeScript)

Desired behavior

Be able to either (or both):

  • Disable name checks for destructured parameters (require only root1/param1 to be documented)
  • Disable root1 parameters entirely (require only named parameters to be documented and skip automatic ones)

Alternatives considered

Someone seemed to reported something the same (#530) and it was marked as fixed. It was related to require-param and fix added checkDestructured option, but this rule does not affect check-param-names.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions