Multiline JS expressions inside JSX are forbidden
Asked Answered
B

1

0

I use tslint to check my react typescript app. I created this and it works but i get this message from tslint: "Multiline JS expressions inside JSX are forbidden". I wonder how I should change the code so I don't get tslint message. The code where it occurs is:

<MDBCol size="12">
              {pubItem ? (
                <table className="pubDetails w-100">
                  <tbody>
                    <tr>
                      <th className="pubHead w-25">Publicatie ID:</th>
                      <td className="pubItems w-25">
                        {pubItem.publicationId ? pubItem.publicationId : "Geen"}
                      </td>
                    </tr>
                    <tr>
                      <th className="pubHead">Publicatie Naam:</th>
                      <td className="pubItems">
                        {pubItem.publicationName
                          ? pubItem.publicationName
                          : "Geen"}
                      </td>
                    </tr>
                </tbody>
              </table>
            ) : null}
         </MDBCol>

Ball answered 17/12, 2019 at 13:34 Comment(3)
So what's your question? Either turn off tslint, change rules so they match your requirements or force it to ignore this. palantir.github.io/tslint/usage/rule-flagsTrouvaille
I wonder how I should change the code so I don't get tslint message.Ball
Doesn't TSLint point exactly on the expression it's telling about?Dominus
T
1

{pubItem.publicationName ? pubItem.publicationName : "Geen"} Maybe it's assignment problem of ts.

You could try create tslint.json in your project tslint.json.You can configure it in this file. For Example:

Thrifty answered 30/12, 2019 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.