Sonarqube strange code smell - JSX props should not use functions

I have encountered a very strange code smell,please help!

  • Sonarqube version is ‘Community Edition Version 9.8 (build 63668)’ and deploy in docker
  • Coding Rule: typescript:S6480
  • Issue Detail:
    My project report code smell “JSX props should not use arrow functions” after sonar scan
      <Modal
        title={`${formMode} Authority Setting`}
        visible={formVisible}
        destroyOnClose
        onCancel={() => setFormVisible(false)} //code smell
      >

I follow recommend method and change to use method reference in props, but the code smell change to “JSX props should not use functions”.

      function onOperationCancel() {
        setFormVisible(false);
      }

      <Modal
        title={`${formMode} Authority Setting`}
        visible={formVisible}
        destroyOnClose
        onCancel={onOperationCancel}
      >

It’s very strange that these two code smells use the same rule typescript:S6480. May I know if this is a bug?

Hello,

This rule is indeed controversial and we removed it from the default profile in the newer version of SQ. You could update to SQ >=9.9 to get the rule deactivated.