ReSharper 2024.1 Help

EditorConfig properties for JavaScript: Spaces

Preserve existing formatting

Extra spaces inside

Property names:

[resharper_]js_extra_spaces, [resharper_]extra_spaces

Possible values:

  • remove_all: Remove all extra spaces

  • leave_tabs: Leave extra tabs

  • leave_multiple: Leave multiple extra spaces

  • leave_all: Leave all extra spaces and tabs

Examples:

Before formatting

After formatting, remove_all

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5); xx = foo(5 + 6); xxx = foo(5 + 6 + 7); tab = foo(5); tabx = foo(5 + 6); tabxx = foo(5 + 6 + 7);

Before formatting

After formatting, leave_tabs

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5); xx = foo(5 + 6); xxx = foo(5 + 6 + 7); tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;

Before formatting

After formatting, leave_multiple

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5 ); xx = foo(5 + 6 ); xxx = foo(5 + 6 + 7); tab = foo(5); tabx = foo(5 + 6); tabxx = foo(5 + 6 + 7);

Before formatting

After formatting, leave_all

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;

Commas

After comma

Property names:

[resharper_]js_space_after_comma, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true

foo(a, b, c);

false

foo(a,b,c);

Before comma

Property names:

[resharper_]js_space_before_comma, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true

foo(a , b , c);

false

foo(a, b, c);

Semicolons

Before semicolon

Property names:

[resharper_]js_space_before_semicolon, [resharper_]space_before_semicolon

Possible values:

true | false

Examples:

true

foo(a, b, c) ;

false

foo(a, b, c);

Before semicolon in for statement

Property names:

[resharper_]js_space_before_semicolon_in_for_statement, [resharper_]space_before_semicolon_in_for_statement

Possible values:

true | false

Examples:

true

for (var i = 1 ; i < 10 ; i++) { }

false

for (var i = 1; i < 10; i++) { }

After semicolon in for statement

Property names:

[resharper_]js_space_after_semicolon_in_for_statement, [resharper_]space_after_semicolon_in_for_statement

Possible values:

true | false

Examples:

true

for (var i = 1; i < 10; i++) { }

false

for (var i = 1;i < 10;i++) { }

In function invocations

Before parentheses

Property names:

[resharper_]js_space_before_method_call_parentheses, [resharper_]js_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

Possible values:

true | false

Examples:

true

foo (a, b, c);

false

foo(a, b, c);

Before empty parentheses

Property names:

[resharper_]js_space_before_empty_method_call_parentheses, [resharper_]js_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_empty_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

Possible values:

true | false

Examples:

true

foo ();

false

foo();

Within parentheses

Property names:

[resharper_]js_space_between_method_call_parameter_list_parentheses, [resharper_]space_between_method_call_parameter_list_parentheses

Possible values:

true | false

Examples:

true

foo( a, b, c );

false

foo(a, b, c);

Within empty parentheses

Property names:

[resharper_]js_space_between_method_call_empty_parameter_list_parentheses, [resharper_]space_between_method_call_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

true

foo( );

false

foo();

In function declarations

Before parentheses

Property names:

[resharper_]js_space_before_method_parentheses, [resharper_]js_space_between_method_declaration_name_and_open_parenthesis, [resharper_]space_before_method_parentheses, [resharper_]space_between_method_declaration_name_and_open_parenthesis

Possible values:

true | false

Examples:

true

function Foo (a, b) {}

false

function Foo(a, b) {}

Before parentheses of anonymous method

Property names:

[resharper_]js_space_before_method_parentheses_anonymous, [resharper_]js_space_between_method_declaration_name_and_open_parenthesis, [resharper_]space_before_method_parentheses_anonymous, [resharper_]space_between_method_declaration_name_and_open_parenthesis

Possible values:

true | false

Examples:

true

function (a, b) {}

false

function(a, b) {}

Within empty parentheses

Property names:

[resharper_]js_space_between_method_declaration_empty_parameter_list_parentheses, [resharper_]space_between_method_declaration_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

true

function Foo( ) {}

false

function Foo() {}

Within parentheses

Property names:

[resharper_]js_space_between_method_declaration_parameter_list_parentheses, [resharper_]space_between_method_declaration_parameter_list_parentheses

Possible values:

true | false

Examples:

true

function Foo( a, b ) {}

false

function Foo(a, b) {}

In control statements

Before parentheses

Property names:

[resharper_]js_space_after_keywords_in_control_flow_statements, [resharper_]space_after_keywords_in_control_flow_statements

Possible values:

true | false

Examples:

true

while (condition) { }

false

while(condition) { }

Within parentheses

Property names:

[resharper_]js_space_between_parentheses_of_control_flow_statements, [resharper_]space_between_parentheses_of_control_flow_statements

Possible values:

true | false

Examples:

true

do { } while ( condition )

false

do { } while (condition)

In index expressions

Before brackets

Property names:

[resharper_]js_space_before_array_access_brackets, [resharper_]js_space_before_open_square_brackets, [resharper_]space_before_array_access_brackets, [resharper_]space_before_open_square_brackets

Possible values:

true | false

Examples:

true

a [i]

false

a[i]

Within brackets

Property names:

[resharper_]js_space_within_array_access_brackets, [resharper_]js_space_between_square_brackets, [resharper_]space_within_array_access_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true

a[ i ]

false

a[i]

In ternary operators '? :'

In ternary operator '? :'

Property names:

[resharper_]js_space_before_ternary_quest, [resharper_]space_before_ternary_quest

Possible values:

true | false

Examples:

true

a ? b : c

false

a? b : c

After '?'

Property names:

[resharper_]js_space_after_ternary_quest, [resharper_]space_after_ternary_quest

Possible values:

true | false

Examples:

true

a ? b : c

false

a ?b : c

Before ':'

Property names:

[resharper_]js_space_before_ternary_colon, [resharper_]space_before_ternary_colon

Possible values:

true | false

Examples:

true

a ? b : c

false

a ? b: c

After '?'

Property names:

[resharper_]js_space_after_ternary_colon, [resharper_]space_after_ternary_colon

Possible values:

true | false

Examples:

true

a ? b : c

false

a ? b :c

In object expressions

Before ':'

Property names:

[resharper_]js_space_before_property_colon, [resharper_]space_before_property_colon

Possible values:

true | false

Examples:

true

var o = { a : b }

false

var o = { a: b }

After '?'

Property names:

[resharper_]js_space_after_property_colon, [resharper_]space_after_property_colon

Possible values:

true | false

Examples:

true

var o = { a: b }

false

var o = { a:b }

Within braces

Property names:

[resharper_]js_space_within_object_literal_braces, [resharper_]space_within_object_literal_braces

Possible values:

true | false

Examples:

true

var o = { a: b }

false

var o = {a: b}

Within empty braces

Property names:

[resharper_]js_space_within_empty_object_literal_braces, [resharper_]space_within_empty_object_literal_braces

Possible values:

true | false

Examples:

true

var o = { }

false

var o = {}

In import declarations

Within braces

Property names:

[resharper_]js_space_within_import_braces, [resharper_]space_within_import_braces

Possible values:

true | false

Examples:

true

import { Component, EventEmitter, OnInit, Output, Input } from '@angular/core';

false

import {Component, EventEmitter, OnInit, Output, Input} from '@angular/core';

In array literals

Within brackets

Property names:

[resharper_]js_space_within_array_literal_brackets, [resharper_]js_space_between_square_brackets, [resharper_]space_within_array_literal_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true

[ a, b, c ]

false

[a, b, c]

Within empty brackets

Property names:

[resharper_]js_space_within_empty_array_literal_brackets, [resharper_]js_space_between_empty_square_brackets, [resharper_]space_within_empty_array_literal_brackets, [resharper_]space_between_empty_square_brackets

Possible values:

true | false

Examples:

true

[ ]

false

[]

In expressions

Around binary operator

Property names:

[resharper_]js_space_around_binary_operator, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

a + b

false

a+b

Around assignment operator

Property names:

[resharper_]js_space_around_assignment_operator, [resharper_]space_around_assignment_operator

Possible values:

true | false

Examples:

true

a = b;

false

a=b;

Around dot

Property names:

[resharper_]js_space_around_dot, [resharper_]js_space_around_member_access_operator, [resharper_]space_around_dot, [resharper_]space_around_member_access_operator

Possible values:

true | false

Examples:

true

obj . toString()

false

obj.toString()

Within parentheses

Property names:

[resharper_]js_space_within_parentheses, [resharper_]space_within_parentheses

Possible values:

true | false

Examples:

true

( a + b ).toString();

false

(a + b).toString();

Case statements

Before colon

Property names:

[resharper_]js_space_before_colon_in_case, [resharper_]space_before_colon_in_case

Possible values:

true | false

Examples:

true

switch (a) { case b : break; }

false

switch (a) { case b: break; }

Lambdas

Before ':'

Property names:

[resharper_]js_space_before_arrow, [resharper_]space_before_arrow

Possible values:

true | false

Examples:

true

var v = (a, b, c) => a + b + c;

false

var v = (a, b, c)=> a + b + c;

After '=>' in lambda expressions

Property names:

[resharper_]js_space_after_arrow, [resharper_]space_after_arrow

Possible values:

true | false

Examples:

true

var v = (a, b, c) => a + b + c;

false

var v = (a, b, c) =>a + b + c;

Template literals

Within braces around template argument

Property names:

[resharper_]js_space_within_template_argument, [resharper_]space_within_template_argument

Possible values:

true | false

Examples:

true

var v = `${ a } ${ x + y }`

false

var v = `${a} ${x + y}`
Last modified: 26 May 2024