We have started using SolidJS for frontend development, and SonarQube gives us a lot of React-specific warnings (e.g. typescript:S6478 and typescript:S6481), but we are not using React at all.
How do I set up our code, so SonarQube knows that I am not using React, so it can stop telling me to change my SolidJS components into React components?
Here is an example:
import { type JSXElement, createSignal } from "solid-js";
export function Component1(props: { something: (count: number) => JSXElement }) {
const [count, setCount] = createSignal(0);
return <div>
{props.something(count())}
<button onClick={() => setCount(prev => prev + 1)}>Increment</button>
</div>
}
export function Component2() {
return <Component1 something={count => <h1>{count}</h1>}></Component1>
}
SonarQube and SonarLint gives this warning on the example:
“Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state. Instead, move this component definition out of the parent component “Component2” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true.sonarlint(typescript:S6478)”
Using SonarQube 9.x and SonarLint v3.17.0 for VS Code. We cannot use Connected Mode, so please don’t suggest solutions that require Connected Mode.