SonarLint "Default export names and file names should match" does flag even when names match

I use the SonarLint plugin for Webstorm (Jetbrains IDE). When I have a default export it always complains that it does not match the file name even when it does. See the example below:

I have the following code:

import React from 'react';

function TestComponent(props) {
  return <div></div>;
}

export default TestComponent;

And the filename “TestComponent.js”

The problematic rule is javascript:S3317

Hello @joshua-lehmann
Welcome to the community and thanks for your detailed feedback.
We will check this and post updates in replies to this post, but it can take time.

1 Like

Hello Joshua,

Thank you for providing a code snippet. Unfortunately, I was not able to reproduce the false-positive you’re encountering using the latest versions of Webstorm (2021.2.2) and SonarLint plugin (5.3).

In order to help me with the investigation, would you mind sharing which versions you are using ?

Thanks,
Yassin

Hi Yassin

I just created a new react app with create-react-app and there I am not able to reproduce the issue. However, in our current project also with the newest version of WebStorm and the most current version of the sonar lint plugin, I still get the rule/error for all the files. It seems that it is caused by something in our toolchain, unfortunately I was not able to find out what…

I’m closing this thread because we are not able to reproduce. If you can successfully provide a reproducer, feel free to open a new thread. (maybe start with your real project, and remove all sensitive content until it can be shared with SonarSource employees)

This topic was automatically closed after 15 hours. New replies are no longer allowed.