Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.08 KB

chained-semi.md

File metadata and controls

62 lines (46 loc) · 1.08 KB

enforce switch block bracing (chained-semi)

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule Details

We like to enforce the rule that when you use chaining with line breaks, you put the final semicolon on a new line at the same indentation as the first line of the chain.

var a = b
  .c()
  .d
  .e()
;

Examples

👎 Examples of incorrect code for this rule:

// eslint chained-semi: ["error"]
var a = b
  .c()
  .d
  .e();
// eslint chained-semi: ["error"]
var a = b
  .c()
  .d
  .e()
  ;

👍 Examples of correct code for this rule:

// eslint chained-semi: ["error"]
var a = b
  .c()
  .d
  .e()
;
// eslint chained-semi: ["error"]
var a = b.c.d.e;

When Not To Use It

If you don't want to enforce semicolon placement after chained statements.

Resouces