how use prettier Ignore block for JSX?

Viewed 18

How can I make prettier ignore some blocks in JSX? For Example:


        <Routes>
          <Route path="/"           element={<Home      />} />
          <Route path="/aboutUs"    element={<AboutUs   />} />
          <Route path="/contact"    element={<Contact   />} />
          <Route path="/infos"      element={<Infos     />} />
          <Route path="/request"    element={<Request   />} />
          <Route path="/impressum"  element={<Impressum />} />
          <Route path="/whatsabu"   element={<WhatsaBu  />} />
          <Route path="/test"       element={<Test      />} />
          <Route path="/compare"    element={<Compare   />} />
          <Route path="/partner"    element={<Partner   />} />
          <Route path="/concept"    element={<Concept   />} />
          <Route path="/blog"       element={<Blog      />} />
          <Route path="/privacy"    element={<Privacy   />} />
          <Route path="/bonus"      element={<Bonus     />} />
        </Routes>

only solution I could find is: {/* prettier-ignore */} but I had to write it on every second line. {/* prettier-ignore-start */} doesn't work

1 Answers

Try placing //prettier-ignore above the block.

        //prettier-ignore
        <Routes>
          <Route path="/"           element={<Home      />} />
          <Route path="/aboutUs"    element={<AboutUs   />} />
          <Route path="/contact"    element={<Contact   />} />
          <Route path="/infos"      element={<Infos     />} />
          <Route path="/request"    element={<Request   />} />
          <Route path="/impressum"  element={<Impressum />} />
          <Route path="/whatsabu"   element={<WhatsaBu  />} />
          <Route path="/test"       element={<Test      />} />
          <Route path="/compare"    element={<Compare   />} />
          <Route path="/partner"    element={<Partner   />} />
          <Route path="/concept"    element={<Concept   />} />
          <Route path="/blog"       element={<Blog      />} />
          <Route path="/privacy"    element={<Privacy   />} />
          <Route path="/bonus"      element={<Bonus     />} />
        </Routes>
Related