Showing 115 of 115 total issues
Definition for rule 'optimize-regex/optimize-regex' was not found Open
module.exports = {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'sonarjs/cognitive-complexity' was not found Open
test('test', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'compat/compat' was not found Open
test('test', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'no-loops/no-loops' was not found Open
test('test', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
A space is required after '['. Open
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx|)$'],
- Read upRead up
- Exclude checks
Disallow or enforce spaces inside of brackets (array-bracket-spacing)
A number of style guides require or disallow spaces between array brackets and other tokens. This rule applies to both array literals and destructuring assignments (ECMAScript 6).
/*eslint-env es6*/
var arr = [ 'foo', 'bar' ];
var [ x, y ] = z;
var arr = ['foo', 'bar'];
var [x,y] = z;
Rule Details
This rule enforces consistent spacing inside array brackets.
Options
This rule has a string option:
-
"never"
(default) disallows spaces inside array brackets -
"always"
requires one or more spaces or newlines inside array brackets
This rule has an object option for exceptions to the "never"
option:
-
"singleValue": true
requires one or more spaces or newlines inside brackets of array literals that contain a single element -
"objectsInArrays": true
requires one or more spaces or newlines between brackets of array literals and braces of their object literal elements[ {
or} ]
-
"arraysInArrays": true
requires one or more spaces or newlines between brackets of array literals and brackets of their array literal elements[ [
or] ]
This rule has an object option for exceptions to the "always"
option:
-
"singleValue": false
disallows spaces inside brackets of array literals that contain a single element -
"objectsInArrays": false
disallows spaces between brackets of array literals and braces of their object literal elements[{
or}]
-
"arraysInArrays": false
disallows spaces between brackets of array literals and brackets of their array literal elements[[
or]]
This rule has built-in exceptions:
-
"never"
(and also the exceptions to the"always"
option) allows newlines inside array brackets, because this is a common pattern -
"always"
does not require spaces or newlines in empty array literals[]
never
Examples of incorrect code for this rule with the default "never"
option:
/*eslint array-bracket-spacing: ["error", "never"]*/
/*eslint-env es6*/
var arr = [ 'foo', 'bar' ];
var arr = ['foo', 'bar' ];
var arr = [ ['foo'], 'bar'];
var arr = [[ 'foo' ], 'bar'];
var arr = [ 'foo',
'bar'
];
var [ x, y ] = z;
var [ x,y ] = z;
var [ x, ...y ] = z;
var [ ,,x, ] = z;
Examples of correct code for this rule with the default "never"
option:
/*eslint array-bracket-spacing: ["error", "never"]*/
/*eslint-env es6*/
var arr = [];
var arr = ['foo', 'bar', 'baz'];
var arr = [['foo'], 'bar', 'baz'];
var arr = [
'foo',
'bar',
'baz'
];
var arr = ['foo',
'bar'
];
var arr = [
'foo',
'bar'];
var [x, y] = z;
var [x,y] = z;
var [x, ...y] = z;
var [,,x,] = z;
always
Examples of incorrect code for this rule with the "always"
option:
/*eslint array-bracket-spacing: ["error", "always"]*/
/*eslint-env es6*/
var arr = ['foo', 'bar'];
var arr = ['foo', 'bar' ];
var arr = [ ['foo'], 'bar' ];
var arr = ['foo',
'bar'
];
var arr = [
'foo',
'bar'];
var [x, y] = z;
var [x,y] = z;
var [x, ...y] = z;
var [,,x,] = z;
Examples of correct code for this rule with the "always"
option:
/*eslint array-bracket-spacing: ["error", "always"]*/
/*eslint-env es6*/
var arr = [];
var arr = [ 'foo', 'bar', 'baz' ];
var arr = [ [ 'foo' ], 'bar', 'baz' ];
var arr = [ 'foo',
'bar'
];
var arr = [
'foo',
'bar' ];
var arr = [
'foo',
'bar',
'baz'
];
var [ x, y ] = z;
var [ x,y ] = z;
var [ x, ...y ] = z;
var [ ,,x, ] = z;
singleValue
Examples of incorrect code for this rule with the "always", { "singleValue": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "singleValue": false }]*/
var foo = [ 'foo' ];
var foo = [ 'foo'];
var foo = ['foo' ];
var foo = [ 1 ];
var foo = [ 1];
var foo = [1 ];
var foo = [ [ 1, 2 ] ];
var foo = [ { 'foo': 'bar' } ];
Examples of correct code for this rule with the "always", { "singleValue": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "singleValue": false }]*/
var foo = ['foo'];
var foo = [1];
var foo = [[ 1, 1 ]];
var foo = [{ 'foo': 'bar' }];
objectsInArrays
Examples of incorrect code for this rule with the "always", { "objectsInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "objectsInArrays": false }]*/
var arr = [ { 'foo': 'bar' } ];
var arr = [ {
'foo': 'bar'
} ]
Examples of correct code for this rule with the "always", { "objectsInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "objectsInArrays": false }]*/
var arr = [{ 'foo': 'bar' }];
var arr = [{
'foo': 'bar'
}];
arraysInArrays
Examples of incorrect code for this rule with the "always", { "arraysInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "arraysInArrays": false }]*/
var arr = [ [ 1, 2 ], 2, 3, 4 ];
var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];
Examples of correct code for this rule with the "always", { "arraysInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "arraysInArrays": false }]*/
var arr = [[ 1, 2 ], 2, 3, 4 ];
var arr = [[ 1, 2 ], 2, [ 3, 4 ]];
When Not To Use It
You can turn this rule off if you are not concerned with the consistency of spacing between array brackets.
Related Rules
- [space-in-parens](space-in-parens.md)
- [object-curly-spacing](object-curly-spacing.md)
- [computed-property-spacing](computed-property-spacing.md) Source: http://eslint.org/docs/rules/
A space is required after '['. Open
coveragePathIgnorePatterns: ['/node_modules/'],
- Read upRead up
- Exclude checks
Disallow or enforce spaces inside of brackets (array-bracket-spacing)
A number of style guides require or disallow spaces between array brackets and other tokens. This rule applies to both array literals and destructuring assignments (ECMAScript 6).
/*eslint-env es6*/
var arr = [ 'foo', 'bar' ];
var [ x, y ] = z;
var arr = ['foo', 'bar'];
var [x,y] = z;
Rule Details
This rule enforces consistent spacing inside array brackets.
Options
This rule has a string option:
-
"never"
(default) disallows spaces inside array brackets -
"always"
requires one or more spaces or newlines inside array brackets
This rule has an object option for exceptions to the "never"
option:
-
"singleValue": true
requires one or more spaces or newlines inside brackets of array literals that contain a single element -
"objectsInArrays": true
requires one or more spaces or newlines between brackets of array literals and braces of their object literal elements[ {
or} ]
-
"arraysInArrays": true
requires one or more spaces or newlines between brackets of array literals and brackets of their array literal elements[ [
or] ]
This rule has an object option for exceptions to the "always"
option:
-
"singleValue": false
disallows spaces inside brackets of array literals that contain a single element -
"objectsInArrays": false
disallows spaces between brackets of array literals and braces of their object literal elements[{
or}]
-
"arraysInArrays": false
disallows spaces between brackets of array literals and brackets of their array literal elements[[
or]]
This rule has built-in exceptions:
-
"never"
(and also the exceptions to the"always"
option) allows newlines inside array brackets, because this is a common pattern -
"always"
does not require spaces or newlines in empty array literals[]
never
Examples of incorrect code for this rule with the default "never"
option:
/*eslint array-bracket-spacing: ["error", "never"]*/
/*eslint-env es6*/
var arr = [ 'foo', 'bar' ];
var arr = ['foo', 'bar' ];
var arr = [ ['foo'], 'bar'];
var arr = [[ 'foo' ], 'bar'];
var arr = [ 'foo',
'bar'
];
var [ x, y ] = z;
var [ x,y ] = z;
var [ x, ...y ] = z;
var [ ,,x, ] = z;
Examples of correct code for this rule with the default "never"
option:
/*eslint array-bracket-spacing: ["error", "never"]*/
/*eslint-env es6*/
var arr = [];
var arr = ['foo', 'bar', 'baz'];
var arr = [['foo'], 'bar', 'baz'];
var arr = [
'foo',
'bar',
'baz'
];
var arr = ['foo',
'bar'
];
var arr = [
'foo',
'bar'];
var [x, y] = z;
var [x,y] = z;
var [x, ...y] = z;
var [,,x,] = z;
always
Examples of incorrect code for this rule with the "always"
option:
/*eslint array-bracket-spacing: ["error", "always"]*/
/*eslint-env es6*/
var arr = ['foo', 'bar'];
var arr = ['foo', 'bar' ];
var arr = [ ['foo'], 'bar' ];
var arr = ['foo',
'bar'
];
var arr = [
'foo',
'bar'];
var [x, y] = z;
var [x,y] = z;
var [x, ...y] = z;
var [,,x,] = z;
Examples of correct code for this rule with the "always"
option:
/*eslint array-bracket-spacing: ["error", "always"]*/
/*eslint-env es6*/
var arr = [];
var arr = [ 'foo', 'bar', 'baz' ];
var arr = [ [ 'foo' ], 'bar', 'baz' ];
var arr = [ 'foo',
'bar'
];
var arr = [
'foo',
'bar' ];
var arr = [
'foo',
'bar',
'baz'
];
var [ x, y ] = z;
var [ x,y ] = z;
var [ x, ...y ] = z;
var [ ,,x, ] = z;
singleValue
Examples of incorrect code for this rule with the "always", { "singleValue": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "singleValue": false }]*/
var foo = [ 'foo' ];
var foo = [ 'foo'];
var foo = ['foo' ];
var foo = [ 1 ];
var foo = [ 1];
var foo = [1 ];
var foo = [ [ 1, 2 ] ];
var foo = [ { 'foo': 'bar' } ];
Examples of correct code for this rule with the "always", { "singleValue": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "singleValue": false }]*/
var foo = ['foo'];
var foo = [1];
var foo = [[ 1, 1 ]];
var foo = [{ 'foo': 'bar' }];
objectsInArrays
Examples of incorrect code for this rule with the "always", { "objectsInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "objectsInArrays": false }]*/
var arr = [ { 'foo': 'bar' } ];
var arr = [ {
'foo': 'bar'
} ]
Examples of correct code for this rule with the "always", { "objectsInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "objectsInArrays": false }]*/
var arr = [{ 'foo': 'bar' }];
var arr = [{
'foo': 'bar'
}];
arraysInArrays
Examples of incorrect code for this rule with the "always", { "arraysInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "arraysInArrays": false }]*/
var arr = [ [ 1, 2 ], 2, 3, 4 ];
var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];
Examples of correct code for this rule with the "always", { "arraysInArrays": false }
options:
/*eslint array-bracket-spacing: ["error", "always", { "arraysInArrays": false }]*/
var arr = [[ 1, 2 ], 2, 3, 4 ];
var arr = [[ 1, 2 ], 2, [ 3, 4 ]];
When Not To Use It
You can turn this rule off if you are not concerned with the consistency of spacing between array brackets.
Related Rules
- [space-in-parens](space-in-parens.md)
- [object-curly-spacing](object-curly-spacing.md)
- [computed-property-spacing](computed-property-spacing.md) Source: http://eslint.org/docs/rules/
Definition for rule 'no-loops/no-loops' was not found Open
test('App works', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'no-use-extend-native/no-use-extend-native' was not found Open
test('test', () => { })
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'no-loops/no-loops' was not found Open
test('predicts', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'optimize-regex/optimize-regex' was not found Open
test('test', () => { })
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'sonarjs/cognitive-complexity' was not found Open
// import * as React from 'react'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'sonarjs/cognitive-complexity' was not found Open
test('test', () => { })
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'compat/compat' was not found Open
// import {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'compat/compat' was not found Open
test('test', () => {})
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Block must not be padded by blank lines. Open
module.exports = (wallaby) => {
- Read upRead up
- Exclude checks
require or disallow padding within blocks (padded-blocks)
Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.
if (a) {
b();
}
Since it's good to have a consistent code style, you should either always write padded blocks or never do it.
Rule Details
This rule enforces consistent empty line padding within blocks.
Options
This rule has one option, which can be a string option or an object option.
String option:
-
"always"
(default) requires empty lines at the beginning and ending of block statements and classes -
"never"
disallows empty lines at the beginning and ending of block statements and classes
Object option:
-
"blocks"
require or disallow padding within block statements -
"classes"
require or disallow padding within classes -
"switches"
require or disallow padding withinswitch
statements
always
Examples of incorrect code for this rule with the default "always"
option:
/*eslint padded-blocks: ["error", "always"]*/
if (a) {
b();
}
if (a) { b(); }
if (a)
{
b();
}
if (a) {
b();
}
if (a) {
b();
}
if (a) {
// comment
b();
}
Examples of correct code for this rule with the default "always"
option:
/*eslint padded-blocks: ["error", "always"]*/
if (a) {
b();
}
if (a)
{
b();
}
if (a) {
// comment
b();
}
never
Examples of incorrect code for this rule with the "never"
option:
/*eslint padded-blocks: ["error", "never"]*/
if (a) {
b();
}
if (a)
{
b();
}
if (a) {
b();
}
if (a) {
b();
}
Examples of correct code for this rule with the "never"
option:
/*eslint padded-blocks: ["error", "never"]*/
if (a) {
b();
}
if (a)
{
b();
}
blocks
Examples of incorrect code for this rule with the { "blocks": "always" }
option:
/*eslint padded-blocks: ["error", { "blocks": "always" }]*/
if (a) {
b();
}
if (a) { b(); }
if (a)
{
b();
}
if (a) {
b();
}
if (a) {
b();
}
if (a) {
// comment
b();
}
Examples of correct code for this rule with the { "blocks": "always" }
option:
/*eslint padded-blocks: ["error", { "blocks": "always" }]*/
if (a) {
b();
}
if (a)
{
b();
}
if (a) {
// comment
b();
}
Examples of incorrect code for this rule with the { "blocks": "never" }
option:
/*eslint padded-blocks: ["error", { "blocks": "never" }]*/
if (a) {
b();
}
if (a)
{
b();
}
if (a) {
b();
}
if (a) {
b();
}
Examples of correct code for this rule with the { "blocks": "never" }
option:
/*eslint padded-blocks: ["error", { "blocks": "never" }]*/
if (a) {
b();
}
if (a)
{
b();
}
classes
Examples of incorrect code for this rule with the { "classes": "always" }
option:
/*eslint padded-blocks: ["error", { "classes": "always" }]*/
class A {
constructor(){
}
}
Examples of correct code for this rule with the { "classes": "always" }
option:
/*eslint padded-blocks: ["error", { "classes": "always" }]*/
class A {
constructor(){
}
}
Examples of incorrect code for this rule with the { "classes": "never" }
option:
/*eslint padded-blocks: ["error", { "classes": "never" }]*/
class A {
constructor(){
}
}
Examples of correct code for this rule with the { "classes": "never" }
option:
/*eslint padded-blocks: ["error", { "classes": "never" }]*/
class A {
constructor(){
}
}
switches
Examples of incorrect code for this rule with the { "switches": "always" }
option:
/*eslint padded-blocks: ["error", { "switches": "always" }]*/
switch (a) {
case 0: foo();
}
Examples of correct code for this rule with the { "switches": "always" }
option:
/*eslint padded-blocks: ["error", { "switches": "always" }]*/
switch (a) {
case 0: foo();
}
if (a) {
b();
}
Examples of incorrect code for this rule with the { "switches": "never" }
option:
/*eslint padded-blocks: ["error", { "switches": "never" }]*/
switch (a) {
case 0: foo();
}
Examples of correct code for this rule with the { "switches": "never" }
option:
/*eslint padded-blocks: ["error", { "switches": "never" }]*/
switch (a) {
case 0: foo();
}
if (a) {
b();
}
When Not To Use It
You can turn this rule off if you are not concerned with the consistency of padding within blocks.
Related Rules
- [lines-between-class-members](lines-between-class-members.md)
- [padding-line-between-statements](padding-line-between-statements.md) Source: http://eslint.org/docs/rules/