Code Style Assistance in HTML
ReSharper provides the following code style assistance features in HTML:
Managing and applying code formatting rules
An important aspect of code style is how to format the code, that is, how to use whitespaces and blank lines to arrange and separate code blocks, whether and how to use tabs for indents, whether and how to wrap long lines, and so on.
The extensive set of ReSharper code formatting rules has a default configuration that takes into account default Visual Studio formatting options as well as numerous best practices. You can configure every detail of formatting rules and enforce the rules in your code. These rules are applied when ReSharper produces new code with code completion and code generation features, applies code templates and performs refactorings. The formatting rules can also be applied to the existing code in the current selection, current file, or in a larger scope up to the entire solution.
ReSharper stores formatting preferences using the mechanism of shared settings. You can configure formatting rules in options pages under the group. You can also store and share formatting settings in the EditorConfig files.
Normalizing quotes around attribute values
HTML specification allows you to use both dingle (') and double (") quotes for attribute values. It is a good idea to stick to the same quote style within your project or solution. To do so, you can configure your preference on the page of ReSharper options. To enforce this preference in the existing codebase, either run code cleanup with one of the default profiles Full Cleanup or Reformat & Apply Code Style, or create and run a custom profile where the corresponding option selected.
- Naming Style
- Managing and Applying Code Formatting Rules
- File and Type Layout
- File Header Style
- Code Syntax Style: Namespace Imports
- Code Syntax Style: Implicit/Explicit Typing ('var' Keyword)
- Using Auto-Properties
- Making Fields Readonly
- Code Syntax Style: Multiple Attributes
- Code Syntax Style: Modifiers
- Code Syntax Style: Optional Member Qualifiers
- Reformatting XML Doc Comments
- Removing Code Redundancies