JetBrains IDEs - How To Prevent IDE From Changing "Class" Attribute To "ClassName" In React Projects On Copy And Paste?
Asked Answered
E

1

14

I work on a React project with my JetBrains IDE and most of the elements in my project are React components. I do however use the Ionic Icons library and when I need to insert an icon into my component, I use something like:

<ion-icon class="icon" name="chevron-forward-outline"/>

Since the Ionic elements are not React components, it uses the class attribute as opposed to the className attribute. Every time I copy and paste an Ionic element like the one above, my JetBrains IDE automatically changes the class attribute to className.

How do I prevent the IDE from doing this?

Exterminatory answered 20/1, 2022 at 6:2 Comment(0)
C
29

please try disabling Convert HTML when pasting into JSX files (convert attributes, close single tags) in Settings | Editor | General | Smart Keys | JavaScript

Calamondin answered 20/1, 2022 at 7:16 Comment(3)
I'm editing a normal .js file, how do I say to the editor that is not a JSX one?Meerschaum
If you are using JSX in your code, it's a JSX file regardless of extensionCalamondin
It is now called "Convert HTML when pasting into JSX files (convert attributes, close single tags)"Wall

© 2022 - 2024 — McMap. All rights reserved.