‘Format code’ and ‘sort using’ on save in Visual Studio 2022

Starting from VS2022-Preview2, there is no need to additional extension to “format on-save”, you just run a customized code cleanup that contains “Format document” action on-save: Customize your cleanup profile to perform “Format document” action (if not already there), in Analyze > Code Cleanup > Configure Code Cleanup Enable “Run code cleanup profile on save” … Read more

EditorConfig control File-scoped namespace declaration

To control the code style in editorconfig use this line : To enforce this style namespace SampleCode { public class MyClass { } } Add this line in .editorconfig # IDE0160: Convert to block-scoped namespace csharp_style_namespace_declarations = block_scoped:warning To enforce this style namespace SampleCode; public class MyClass { } Add this line in .editorconfig # … Read more

How to export all my Intellij code styles to a .editorconfig file?

Go to “File->Settings (Preferences in OS X)->Editor->Code Style”. At the bottom of the right pane there is a section for Editor Config options, which now includes an “Export” button. This will only export formatting options that are available in the Editor Config specification. To include advanced options from IDEA you will have to save IntelliJ … Read more

EditorConfig vs. Eslint vs. Prettier: Is it worthwhile to use them all?

In my experience, the best combination is all 3, and here’s why: EditorConfig: This helps your editor produce code that looks like your style guide as you go. While this isn’t strictly necessary in order to achieve your goals, it’s nice if you’re always looking at code that follows the same coding styles. Otherwise if … Read more