Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.19 KB

brace-style.md

File metadata and controls

64 lines (46 loc) · 1.19 KB

Enforce bracing styles in accordance to the Distributive style guide (@distributive/brace-style)

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

Comes from the brace style section in Distributive's JavaScript Style Guide.

Rule Details

Examples of incorrect code for this rule:

function helloWorld() {
  console.log('hello, world');
}

var foo = function foo()
{
  var a = [1, 2, 3];
};

Examples of correct code for this rule:

function helloWorld()
{
  console.log('hello, world');
}

try
{
  for (let i=0; i < 10; i++)
  {
    console.log(i);
  }
}
catch(error) {}

var foo = function foo() {
  var a = [1, 2, 3];
};

var bar = () => {
  var b = [4, 5, 6];
};

module.exports.foo2 = function foo2() {
  var a = [1, 2, 3];
};

When Not To Use It

If you don't plan on following this brace style.

Further Reading