One note is that inside the solution the project where JS and jsx code live is not defined
e.g.:
sln make reference to: code1, code2 and code3 BUT my js code is inside code4 folder.
There are some notes on Analyzing languages other than C# on this page.
If the JS code is in a separate project then what type of project is this? If it’s within a folder within your C# project then it should be picked up ok as long as your project file is the modern SDK type
I don’t know C# or JS but I read on the internet that scanning both projects from the same Root Folder [in this scenario RootProject] it is possible with a single sonar scan.
Unfortunately, I don’t know how as by default it is not working, and I don’t want to add Folder4 to the sln file as well [as there is nothing related to C#]
Do Folders 1-4 contain .csproj files? I’m presuming 1-3 do? To scan folder 4 it will also need to have a csproj referenced by the solution too, it can’t just be a floating folder I’m afraid.
Folder 1-3 have. Folder4 doesn’t.
Is it there a way to add csproj to the folder without the need of Visual Studio?
What is the best approach of doing that?
Can this be done via Linux or MacOS/Windows is mandatory?
You can use the cross-platform dotnet cli and the new command to create a project outside of Visual Studio. The project templates will create more than just the .csproj file though, the web template is probably your best bet. We are planning to support the new .NET 6 .esproj format soon, which should be more suitable for this but this should work ok in the meantime.
An alternative option would be to place folder 4 insider one of the other folders (whichever is more relevant) and then the scanner should pick it up.