typescriptjsxsonarlinttsx

How do I use // NOSONAR on JSX?


In Typescript I can use // NOSONAR to disable a problem in the a particular line in TypeScript

e.g.

var x = 1; // NOSONAR

How would I do the same with JSX/TSX? I tried a few combinations but I could not get it to work the most recent one I did was

    <Animated.ScrollView
      refreshControl={refreshControl}
      contentInsetAdjustmentBehavior="automatic">
      {lastAuthEvents.map(
        ({ key, on, authState, type, reason }: LoggedAuthEvent, index) => (
          <View key={`.${index}`} borderBottomColor="silver" borderBottomWidth={1} paddingTop={index === 0 ? 0 : 16} paddingBottom={16}>{/* // NOSONAR */}
            <View flexDirection="row">
              <Text fontSize={16}>{format(on, "HH:mm:ss")}</Text>
              <Text fontSize={16}>{AuthState[authState]}</Text>
              <FontAwesome name="arrow-circle-right" color="#ffffff" />
              <Text fontSize={16}>{type}</Text>
            </View>
            <Text>{reason}</Text>
          </View>
        )
      )}
    </Animated.ScrollView>

I tried

{/* NOSONAR */}
{// NOSONAR} this is an error

Solution

  • Actually it was just slow but the one that did work was

    {/* NOSONAR */}