typescript:S100 is reporting react functional components (arrow functions)

  • Operating system:
    Windows 11

  • IDE name and flavor/env:
    VS Code 1.68.1
    SonarLint 3.6.0

SonarLint is reporting a false positive for react functional components declared as arrow functions (typescript:S100).

The rule already has an exception for functional components but it reports for arrow functions declaration style.

const Welcome = () => {
  const greeting = 'Hello, World!';

  // ...

  return (
    <div className="Welcome">
      <p>{greeting}</p>
    </div>
  );
}

From my perspective, this example should be compliant too.

Hello @victorseara

Thank you for reporting this. Indeed it seems a FP. I created a ticket to add arrow functions as an exception.

Cheers