Reformatting doesn't follow code style

I'm working on a react-native project. I've changed some of the settings under Editor > Code Style > [both Javascript and Typescript]. I've first set these rules for Scheme: Default and then clicked “Copy to Project…”. When I Reformat Code, it doesn't follow the rules that I've set. One example, ES6 import/export braces under Spaces tab (for both javascript and typescript) are ticked and enabled. However, even if I put the spaces myself, after Reformat Code, it removed the space. 

The file extensions are `.tsx` and no syntax errors on the files that I am trying this on. 

Build #WS-242.20224.342, built on August 9, 2024

Runtime version: 21.0.3+13-b509.4 aarch64 (JCEF 122.1.9)

VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

0
3 comments

Do you use Prettier or .editorconfig in your project? They can override the IDE own code style preferences.

Also, please could you share your code style preferences (<IDE config dir>/codestyles/<scheme name>.xml if you are using IDE-level scheme, or .idea\codeStyles\Project.xml when using a project scheme) plus a screenshot of Settings | Languages & Frameworks | JavaScript | Prettier page?

0

Well, this is embarrassing. Yes, there is .prettierrc.js file. It must have come bundled with the `@react-native-community/cli@latest`. I can't believe I haven't thought of that or checked. Anyway, thank you!

0

Please sign in to leave a comment.