ReSharper 2023.1 Help

EditorConfig properties for JavaScript: Line Breaks

Blank lines

Max blank lines in code

Property names:

[resharper_]js_keep_blank_lines_in_code, [resharper_]keep_blank_lines_in_code

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

function foo() { bar(); bas(); }
function foo() { bar(); bas(); }

Before formatting

After formatting, value: 1

function foo() { bar(); bas(); }
function foo() { bar(); bas(); }

Before formatting

After formatting, value: 2

function foo() { bar(); bas(); }
function foo() { bar(); bas(); }

Max blank lines between declarations

Property names:

[resharper_]js_keep_blank_lines_between_declarations, [resharper_]keep_blank_lines_between_declarations

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

class Foo { constructor() { // constructor code } Method() { // method code } }
class Foo { constructor() { // constructor code } Method() { // method code } }

Before formatting

After formatting, value: 1

class Foo { constructor() { // constructor code } Method() { // method code } }
class Foo { constructor() { // constructor code } Method() { // method code } }

Before formatting

After formatting, value: 2

class Foo { constructor() { // constructor code } Method() { // method code } }
class Foo { constructor() { // constructor code } Method() { // method code } }

Min blank lines after imports

Property names:

[resharper_]js_min_blank_lines_after_imports, [resharper_]min_blank_lines_after_imports

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

import foo from 'foo'; foo();
import foo from 'foo'; foo();

Before formatting

After formatting, value: 1

import foo from 'foo'; foo();
import foo from 'foo'; foo();

Before formatting

After formatting, value: 2

import foo from 'foo'; foo();
import foo from 'foo'; foo();

Min blank lines around functions

Property names:

[resharper_]js_min_blank_lines_around_functions, [resharper_]min_blank_lines_around_functions

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

function foo() { } function bar() { }
function foo() { } function bar() { }

Before formatting

After formatting, value: 1

function foo() { } function bar() { }
function foo() { } function bar() { }

Before formatting

After formatting, value: 2

function foo() { } function bar() { }
function foo() { } function bar() { }

Line breaks

Simple embedded statement

Property names:

[resharper_]js_simple_embedded_statement_style, [resharper_]simple_embedded_statement_style

Possible values:

  • do_not_change: Do not change

  • on_single_line: Force put on single line

  • line_break: Force line breaks

Examples:

Before formatting

After formatting, do_not_change

if (condition) DoSomething(); if (condition) DoSomething();
if (condition) DoSomething(); if (condition) DoSomething();

Before formatting

After formatting, on_single_line

if (condition) DoSomething(); if (condition) DoSomething();
if (condition) DoSomething(); if (condition) DoSomething();

Before formatting

After formatting, line_break

if (condition) DoSomething(); if (condition) DoSomething();
if (condition) DoSomething(); if (condition) DoSomething();

Single-statement function

Property names:

[resharper_]js_single_statement_function_style, [resharper_]single_statement_function_style

Possible values:

  • do_not_change: Do not change

  • on_single_line: Force put on single line

  • line_break: Force line breaks

Examples:

Before formatting

After formatting, do_not_change

foo(function(){document.writeln();}); foo(function(){ document.writeln(); }); foo(function(){document.writeln(); });
foo(function() { document.writeln(); }); foo(function() { document.writeln(); }); foo(function() { document.writeln(); });

Before formatting

After formatting, on_single_line

foo(function(){document.writeln();}); foo(function(){ document.writeln(); }); foo(function(){document.writeln(); });
foo(function() { document.writeln(); }); foo(function() { document.writeln(); }); foo(function() { document.writeln(); });

Before formatting

After formatting, line_break

foo(function(){document.writeln();}); foo(function(){ document.writeln(); }); foo(function(){document.writeln(); });
foo(function() { document.writeln(); }); foo(function() { document.writeln(); }); foo(function() { document.writeln(); });

Special 'else if' treatment

Property names:

[resharper_]js_special_else_if_treatment, [resharper_]special_else_if_treatment

Possible values:

true | false

Examples:

true

if (condition) { foo(); } else if (condition) { }

false

if (condition) { foo(); } else if (condition) { }

Wrapping and chopping

Hard wrap at

Property names:

max_line_length, [resharper_]js_max_line_length

Possible values:

an integer

Prefer to wrap before comma

Property names:

[resharper_]js_wrap_before_comma, [resharper_]wrap_before_comma

Possible values:

true | false

Examples:

Before formatting

After formatting, true

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method(par1 , par2 , par3 , par4 , par5 , par6 , par7 , par8 , par9 , par10);

Before formatting

After formatting, false

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Wrap chained method calls

Property names:

[resharper_]js_wrap_chained_method_calls, [resharper_]wrap_chained_method_calls

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

obj.m().m().m(); obj.method().method().method().method().method().method().method();
obj.m().m().m(); obj.method().method().method() .method().method() .method().method();

Before formatting

After formatting, chop_if_long

obj.m().m().m(); obj.method().method().method().method().method().method().method();
obj.m().m().m(); obj.method() .method() .method() .method() .method() .method() .method();

Before formatting

After formatting, chop_always

obj.m().m().m(); obj.method().method().method().method().method().method().method();
obj.m() .m() .m(); obj.method() .method() .method() .method() .method() .method() .method();

Prefer to wrap before '.'

Property names:

[resharper_]js_wrap_before_dot, [resharper_]wrap_before_dot

Possible values:

true | false

Examples:

Before formatting

After formatting, true

obj.method().method().method().method().method().method().method();
obj.method().method().method() .method().method() .method().method();

Before formatting

After formatting, false

obj.method().method().method().method().method().method().method();
obj.method().method(). method().method(). method().method(). method();

Wrap chained binary expressions

Property names:

[resharper_]js_wrap_chained_binary_expressions, [resharper_]wrap_chained_binary_expressions

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

Examples:

Before formatting

After formatting, wrap_if_long

var y = a1 + a2 + a3 + a4; var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;
var y = a1 + a2 + a3 + a4; var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;

Before formatting

After formatting, chop_if_long

var y = a1 + a2 + a3 + a4; var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;
var y = a1 + a2 + a3 + a4; var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;

Prefer to wrap before operator in binary expression

Property names:

[resharper_]js_wrap_before_binary_opsign, [resharper_]wrap_before_binary_opsign

Possible values:

true | false

Examples:

Before formatting

After formatting, true

var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;
var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;

Before formatting

After formatting, false

var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;
var x = arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8;

Wrap invocation arguments

Property names:

[resharper_]js_wrap_arguments_style, [resharper_]wrap_arguments_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

m(a,b,c,d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
m(a, b, c, d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Before formatting

After formatting, chop_if_long

m(a,b,c,d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
m(a, b, c, d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Before formatting

After formatting, chop_always

m(a,b,c,d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
m(a, b, c, d); method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Prefer to wrap before '(' in invocation

Property names:

[resharper_]js_wrap_before_invocation_lpar, [resharper_]wrap_before_invocation_lpar

Possible values:

true | false

Examples:

Before formatting

After formatting, true

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method (par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Before formatting

After formatting, false

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Prefer to wrap after '(' in invocation

Property names:

[resharper_]js_wrap_after_invocation_lpar, [resharper_]wrap_after_invocation_lpar

Possible values:

true | false

Examples:

Before formatting

After formatting, true

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method( par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Before formatting

After formatting, false

method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);
method(par1, par2, par3, par4, par5, par6, par7, par8, par9, par10);

Wrap formal parameters

Property names:

[resharper_]js_wrap_parameters_style, [resharper_]wrap_parameters_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

function f(a,b,c) {} function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function f(a, b, c) {} function meth(par1, par2, par3, par4, par5, par6, par7, par8) { }

Before formatting

After formatting, chop_if_long

function f(a,b,c) {} function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function f(a, b, c) {} function meth(par1, par2, par3, par4, par5, par6, par7, par8) { }

Before formatting

After formatting, chop_always

function f(a,b,c) {} function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function f(a, b, c) { } function meth(par1, par2, par3, par4, par5, par6, par7, par8) { }

Prefer to wrap before '(' in declaration

Property names:

[resharper_]js_wrap_before_declaration_lpar, [resharper_]wrap_before_declaration_lpar

Possible values:

true | false

Examples:

Before formatting

After formatting, true

function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function meth (par1, par2, par3, par4, par5, par6, par7, par8) { }

Before formatting

After formatting, false

function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function meth(par1, par2, par3, par4, par5, par6, par7, par8) { }

Prefer to wrap after '(' in declaration

Property names:

[resharper_]js_wrap_after_declaration_lpar, [resharper_]wrap_after_declaration_lpar

Possible values:

true | false

Examples:

Before formatting

After formatting, true

function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function meth( par1, par2, par3, par4, par5, par6, par7, par8) { }

Before formatting

After formatting, false

function meth(par1, par2, par3, par4, par5, par6, par7, par8) {}
function meth(par1, par2, par3, par4, par5, par6, par7, par8) { }

Wrap object literals

Property names:

[resharper_]js_wrap_object_literals, [resharper_]wrap_object_literals

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

var x = { a: 1, b: 1}; var y = { field1: null, field2: null, field3: null, field4: null };
var x = { a: 1, b: 1 }; var y = { field1: null, field2: null, field3: null, field4: null };

Before formatting

After formatting, chop_if_long

var x = { a: 1, b: 1}; var y = { field1: null, field2: null, field3: null, field4: null };
var x = { a: 1, b: 1 }; var y = { field1: null, field2: null, field3: null, field4: null };

Before formatting

After formatting, chop_always

var x = { a: 1, b: 1}; var y = { field1: null, field2: null, field3: null, field4: null };
var x = { a: 1, b: 1 }; var y = { field1: null, field2: null, field3: null, field4: null };

Wrap array literals

Property names:

[resharper_]js_wrap_array_literals, [resharper_]wrap_array_literals

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

var x = [1,2,3,4]; var y = [elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9];
var x = [1, 2, 3, 4]; var y = [elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9];

Before formatting

After formatting, chop_if_long

var x = [1,2,3,4]; var y = [elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9];
var x = [1, 2, 3, 4]; var y = [ elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9 ];

Before formatting

After formatting, chop_always

var x = [1,2,3,4]; var y = [elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9];
var x = [ 1, 2, 3, 4 ]; var y = [ elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8, elem9 ];

Wrap import declaration

Property names:

[resharper_]js_wrap_imports, [resharper_]wrap_imports

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

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

Before formatting

After formatting, chop_if_long

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

Before formatting

After formatting, chop_always

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

Wrap 'for' statement header

Property names:

[resharper_]js_wrap_for_stmt_header_style, [resharper_]wrap_for_stmt_header_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);
for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);

Before formatting

After formatting, chop_if_long

for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);
for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);

Before formatting

After formatting, chop_always

for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);
for (a = 1; a < 5; a ++); for (myVar = 0; myVar < 5; myVar ++);

Wrap ternary expression

Property names:

[resharper_]js_wrap_ternary_expr_style, [resharper_]wrap_ternary_expr_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;
var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;

Before formatting

After formatting, chop_if_long

var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;
var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;

Before formatting

After formatting, chop_always

var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;
var x = a ? b : c; var y = myObj === null ? myObj.getValue() : null;

Prefer to wrap before '?' and ':' in ternary expressions

Property names:

[resharper_]js_wrap_before_ternary_opsigns, [resharper_]wrap_before_ternary_opsigns

Possible values:

true | false

Examples:

Before formatting

After formatting, true

var y = myObj === null ? myObj.getValue() : null;
var y = myObj === null ? myObj.getValue() : null;

Before formatting

After formatting, false

var y = myObj === null ? myObj.getValue() : null;
var y = myObj === null ? myObj.getValue() : null;

Wrap multiple declaration

Property names:

[resharper_]js_wrap_multiple_declaration_style, [resharper_]wrap_multiple_declaration_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

Before formatting

After formatting, wrap_if_long

var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();
var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();

Before formatting

After formatting, chop_if_long

var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();
var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();

Before formatting

After formatting, chop_always

var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();
var a, b, c; var left = 100, top = 100, width = calcWidth(), height = calcHeight();

Place on a new line

Place 'else' on a new line

Property names:

[resharper_]js_new_line_before_else, [resharper_]new_line_before_else

Possible values:

true | false

Examples:

true

if (condition) { foo(); } else { foo(); }

false

if (condition) { foo(); } else { foo(); }

Place 'while' on a new line

Property names:

[resharper_]js_new_line_before_while, [resharper_]new_line_before_while

Possible values:

true | false

Examples:

true

do { foo(); } while (condition);

false

do { foo(); } while (condition);

Place 'catch' on a new line

Property names:

[resharper_]js_new_line_before_catch, [resharper_]new_line_before_catch

Possible values:

true | false

Examples:

true

try { foo(); } catch (e) { foo(); } finally { }

false

try { foo(); } catch (e) { foo(); } finally { }

Place 'finally' on a new line

Property names:

[resharper_]js_new_line_before_finally, [resharper_]new_line_before_finally

Possible values:

true | false

Examples:

true

try { foo(); } catch (e) { foo(); } finally { }

false

try { foo(); } catch (e) { foo(); } finally { }

Place template literal arguments on a new line

Property names:

[resharper_]js_place_template_args_on_new_line, [resharper_]place_template_args_on_new_line

Possible values:

true | false

Examples:

true

var q = `a: ${ a + b }, b: ${ b + a }`;

false

var q = `a: ${a + b}, b: ${b + a}`;
Last modified: 27 March 2023