Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • key-spacing
  • padding-line-between-statements

...

  • react/sort-comp
  • react/jsx-one-expression-per-line
  • react/jsx-closing-bracket-location
  • react/jsx-closing-tag-location

  • react/jsx-wrap-multilines

  • react/jsx-curly-spacing 

  • no-array-constructor
  • no-loop-func
  • no-new-func
  • max-lines
  • prefer-destructuring
  • eslint-plugin-filenames
  • max-depth
  • no-constant-condition

key-spacing

currently: "key-spacing": "off"

...

Code Block
/* "react/jsx-curly-spacing": ["error", {"when": "never", "children": true}] */

<Hello name={firstname} />;
<Hello name={{ firstname: 'John', lastname: 'Doe' }} />;
<Hello name={
  firstname
} />;
<Hello>{firstname}</Hello>;
<Hello>{
  firstname
}</Hello>;

no-array-

...

constructor [sonar]

This rule partly covers SonarCloud rule

...

Code Block
/*eslint no-array-constructor: "error"*/ 
Array(500)

no-loop-func [sonar]

This rule covers SonarCloud rule: Functions should not be defined inside loops

no-new-func [sonar]

This rule covers SonarCloud rule:  Functions should not be called both with and without "new" and Function constructors should not be used. Incorrect code:

Code Block
/*eslint no-new-func: "error"*/

function getNum() {
  return 5;
}

var my2ndNum = new getNum();  // Noncompliant. An empty object is returned, NOT 5

max-lines [sonar]

This rule covers SonarCloud rule: Files should not have too many lines

max-lines: ["error", 1000]

prefer-destructuring [sonar]

This rule covers SonarCloud rule: Destructuring syntax should be used for assignments

Code Block
//Examples of incorrect code for this rule:

// With `array` enabled
var foo = array[0];

// With `object` enabled
var foo = object.foo;
var foo = object['foo'];
//Examples of correct code for this rule:

// With `array` enabled
var [ foo ] = array;
var foo = array[someIndex];

// With `object` enabled
var { foo } = object;

var foo = object.bar;

eslint-plugin-filenames [sonar]

This rule covers SonarCloud rule: Default export names and file names should match

"filenames/match-exported": "error"

max-depth [sonar]

This rule covers SonarCloud rule: Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply"filenames/match-exported": "error"

"max-depth": ["error", 3]

no-constant-condition [sonar]

This rule covers SonarCloud rule: Conditionally executed blocks should be reachableConditional expressions which are always true or false can lead to dead code. There shouldn't be expressions like if (false){}

"no-constant-condition": "error"