lancetw/react-isomorphic-bundle

View on GitHub
src/shared/components/wall/PostCards.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const cards = this.props.posts

    const scrollClass = classNames(
      'ui',
Severity: Minor
Found in src/shared/components/wall/PostCards.js - About 1 hr to fix

    Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      render () {
        const cards = this.props.posts
    
        const scrollClass = classNames(
          'ui',
    Severity: Minor
    Found in src/shared/components/wall/PostCards.js - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Unexpected require().
    Open

      require('css/ui/spinkit')

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    There should be no spaces inside this paren.
    Open

          const id = window.setTimeout(function () { callback( currTime + timeToCall ); }, timeToCall)

    Disallow or enforce spaces inside of parentheses (space-in-parens)

    Some style guides require or disallow spaces inside of parentheses:

    foo( 'bar' );
    var x = ( 1 + 2 ) * 3;
    
    foo('bar');
    var x = (1 + 2) * 3;

    Rule Details

    This rule will enforce consistency of spacing directly inside of parentheses, by disallowing or requiring one or more spaces to the right of ( and to the left of ). In either case, () will still be allowed.

    Options

    There are two options for this rule:

    • "never" (default) enforces zero spaces inside of parentheses
    • "always" enforces a space inside of parentheses

    Depending on your coding conventions, you can choose either option by specifying it in your configuration:

    "space-in-parens": ["error", "always"]

    "never"

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo( 'bar');
    foo('bar' );
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Examples of correct code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo();
    
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    "always"

    Examples of incorrect code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo( 'bar');
    foo('bar' );
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    Examples of correct code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo();
    
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Exceptions

    An object literal may be used as a third array item to specify exceptions, with the key "exceptions" and an array as the value. These exceptions work in the context of the first option. That is, if "always" is set to enforce spacing, then any "exception" will disallow spacing. Conversely, if "never" is set to disallow spacing, then any "exception" will enforce spacing.

    The following exceptions are available: ["{}", "[]", "()", "empty"].

    Examples of incorrect code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo(1, {bar: 'baz'});

    Examples of correct code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo(1, {bar: 'baz'} );

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo( 1, {bar: 'baz'} );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo( 1, {bar: 'baz'});

    Examples of incorrect code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1 );

    Examples of incorrect code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo((1 + 2));
    foo((1 + 2), 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo( (1 + 2) );
    foo( (1 + 2), 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo( ( 1 + 2 ) );
    foo( ( 1 + 2 ), 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo(( 1 + 2 ));
    foo(( 1 + 2 ), 1 );

    The "empty" exception concerns empty parentheses, and works the same way as the other exceptions, inverting the first option.

    Example of incorrect code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo();

    Example of correct code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of incorrect code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of correct code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo();

    You can include multiple entries in the "exceptions" array.

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar( {bar:'baz'} );
    baz( 1, [1,2] );
    foo( {bar: 'baz'}, [1, 2] );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar({bar:'baz'});
    baz( 1, [1,2]);
    foo({bar: 'baz'}, [1, 2]);

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between parentheses.

    Related Rules

    Unexpected require().
    Open

      ReactList = require('react-list')

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    Unexpected require().
    Open

      $ = require('jquery')

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

          const id = window.setTimeout(function () { callback( currTime + timeToCall ); }, timeToCall)

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    There should be no spaces inside this paren.
    Open

          const id = window.setTimeout(function () { callback( currTime + timeToCall ); }, timeToCall)

    Disallow or enforce spaces inside of parentheses (space-in-parens)

    Some style guides require or disallow spaces inside of parentheses:

    foo( 'bar' );
    var x = ( 1 + 2 ) * 3;
    
    foo('bar');
    var x = (1 + 2) * 3;

    Rule Details

    This rule will enforce consistency of spacing directly inside of parentheses, by disallowing or requiring one or more spaces to the right of ( and to the left of ). In either case, () will still be allowed.

    Options

    There are two options for this rule:

    • "never" (default) enforces zero spaces inside of parentheses
    • "always" enforces a space inside of parentheses

    Depending on your coding conventions, you can choose either option by specifying it in your configuration:

    "space-in-parens": ["error", "always"]

    "never"

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo( 'bar');
    foo('bar' );
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Examples of correct code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo();
    
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    "always"

    Examples of incorrect code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo( 'bar');
    foo('bar' );
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    Examples of correct code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo();
    
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Exceptions

    An object literal may be used as a third array item to specify exceptions, with the key "exceptions" and an array as the value. These exceptions work in the context of the first option. That is, if "always" is set to enforce spacing, then any "exception" will disallow spacing. Conversely, if "never" is set to disallow spacing, then any "exception" will enforce spacing.

    The following exceptions are available: ["{}", "[]", "()", "empty"].

    Examples of incorrect code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo(1, {bar: 'baz'});

    Examples of correct code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo(1, {bar: 'baz'} );

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo( 1, {bar: 'baz'} );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo( 1, {bar: 'baz'});

    Examples of incorrect code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1 );

    Examples of incorrect code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo((1 + 2));
    foo((1 + 2), 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo( (1 + 2) );
    foo( (1 + 2), 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo( ( 1 + 2 ) );
    foo( ( 1 + 2 ), 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo(( 1 + 2 ));
    foo(( 1 + 2 ), 1 );

    The "empty" exception concerns empty parentheses, and works the same way as the other exceptions, inverting the first option.

    Example of incorrect code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo();

    Example of correct code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of incorrect code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of correct code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo();

    You can include multiple entries in the "exceptions" array.

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar( {bar:'baz'} );
    baz( 1, [1,2] );
    foo( {bar: 'baz'}, [1, 2] );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar({bar:'baz'});
    baz( 1, [1,2]);
    foo({bar: 'baz'}, [1, 2]);

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between parentheses.

    Related Rules

    Unexpected function expression.
    Open

              {!isEmpty(cards) && cards.map(function (card) {

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected string concatenation.
    Open

        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Unexpected string concatenation.
    Open

        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Unexpected string concatenation.
    Open

        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Unexpected block statement surrounding arrow body.
    Open

      renderScrollList = (type, useTranslate3d) => {

    Require braces in arrow function body (arrow-body-style)

    Arrow functions have two syntactic forms for their function bodies. They may be defined with a block body (denoted by curly braces) () => { ... } or with a single expression () => ..., whose value is implicitly returned.

    Rule Details

    This rule can enforce or disallow the use of braces around arrow function body.

    Options

    The rule takes one or two options. The first is a string, which can be:

    • "always" enforces braces around the function body
    • "as-needed" enforces no braces where they can be omitted (default)
    • "never" enforces no braces around the function body (constrains arrow functions to the role of returning an expression)

    The second one is an object for more fine-grained configuration when the first option is "as-needed". Currently, the only available option is requireReturnForObjectLiteral, a boolean property. It's false by default. If set to true, it requires braces and an explicit return for object literals.

    "arrow-body-style": ["error", "always"]

    always

    Examples of incorrect code for this rule with the "always" option:

    /*eslint arrow-body-style: ["error", "always"]*/
    /*eslint-env es6*/
    let foo = () => 0;

    Examples of correct code for this rule with the "always" option:

    let foo = () => {
        return 0;
    };
    let foo = (retv, name) => {
        retv[name] = true;
        return retv;
    };

    as-needed

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint arrow-body-style: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    let foo = () => {
        return 0;
    };
    let foo = () => {
        return {
           bar: {
                foo: 1,
                bar: 2,
            }
        };
    };

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint arrow-body-style: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    let foo = () => 0;
    let foo = (retv, name) => {
        retv[name] = true;
        return retv;
    };
    let foo = () => ({
        bar: {
            foo: 1,
            bar: 2,
        }
    });
    let foo = () => { bar(); };
    let foo = () => {};
    let foo = () => { /* do nothing */ };
    let foo = () => {
        // do nothing.
    };
    let foo = () => ({ bar: 0 });

    requireReturnForObjectLiteral

    This option is only applicable when used in conjunction with the "as-needed" option.

    Examples of incorrect code for this rule with the { "requireReturnForObjectLiteral": true } option:

    /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
    /*eslint-env es6*/
    let foo = () => ({});
    let foo = () => ({ bar: 0 });

    Examples of correct code for this rule with the { "requireReturnForObjectLiteral": true } option:

    /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
    /*eslint-env es6*/
    
    let foo = () => {};
    let foo = () => { return { bar: 0 }; };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint arrow-body-style: ["error", "never"]*/
    /*eslint-env es6*/
    
    let foo = () => {
        return 0;
    };
    let foo = (retv, name) => {
        retv[name] = true;
        return retv;
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint arrow-body-style: ["error", "never"]*/
    /*eslint-env es6*/
    
    let foo = () => 0;
    let foo = () => ({ foo: 0 });

    Source: http://eslint.org/docs/rules/

    Redundant double negation.
    Open

          if (!!this.props.hasMore) {

    disallow unnecessary boolean casts (no-extra-boolean-cast)

    In contexts such as an if statement's test where the result of the expression will already be coerced to a Boolean, casting to a Boolean via double negation (!!) or a Boolean call is unnecessary. For example, these if statements are equivalent:

    if (!!foo) {
        // ...
    }
    
    if (Boolean(foo)) {
        // ...
    }
    
    if (foo) {
        // ...
    }

    Rule Details

    This rule disallows unnecessary boolean casts.

    Examples of incorrect code for this rule:

    /*eslint no-extra-boolean-cast: "error"*/
    
    var foo = !!!bar;
    
    var foo = !!bar ? baz : bat;
    
    var foo = Boolean(!!bar);
    
    var foo = new Boolean(!!bar);
    
    if (!!foo) {
        // ...
    }
    
    if (Boolean(foo)) {
        // ...
    }
    
    while (!!foo) {
        // ...
    }
    
    do {
        // ...
    } while (Boolean(foo));
    
    for (; !!foo; ) {
        // ...
    }

    Examples of correct code for this rule:

    /*eslint no-extra-boolean-cast: "error"*/
    
    var foo = !!bar;
    var foo = Boolean(bar);
    
    function foo() {
        return !!bar;
    }
    
    var foo = bar ? !!baz : !!bat;

    Source: http://eslint.org/docs/rules/

    Unary operator '++' used.
    Open

      for (let x = 0, limit = vendors.length; x < limit && !window.requestAnimationFrame; ++x) {

    disallow the unary operators ++ and -- (no-plusplus)

    Because the unary ++ and -- operators are subject to automatic semicolon insertion, differences in whitespace can change semantics of source code.

    var i = 10;
    var j = 20;
    
    i ++
    j
    // i = 11, j = 20
    var i = 10;
    var j = 20;
    
    i
    ++
    j
    // i = 10, j = 21

    Rule Details

    This rule disallows the unary operators ++ and --.

    Examples of incorrect code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo++;
    
    var bar = 42;
    bar--;
    
    for (i = 0; i < l; i++) {
        return;
    }

    Examples of correct code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo += 1;
    
    var bar = 42;
    bar -= 1;
    
    for (i = 0; i < l; i += 1) {
        return;
    }

    Options

    This rule has an object option.

    • "allowForLoopAfterthoughts": true allows unary operators ++ and -- in the afterthought (final expression) of a for loop.

    allowForLoopAfterthoughts

    Examples of correct code for this rule with the { "allowForLoopAfterthoughts": true } option:

    /*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
    
    for (i = 0; i < l; i++) {
        return;
    }
    
    for (i = 0; i < l; i--) {
        return;
    }

    Source: http://eslint.org/docs/rules/

    Redundant double negation.
    Open

        if (!!this.props.hasMore) {

    disallow unnecessary boolean casts (no-extra-boolean-cast)

    In contexts such as an if statement's test where the result of the expression will already be coerced to a Boolean, casting to a Boolean via double negation (!!) or a Boolean call is unnecessary. For example, these if statements are equivalent:

    if (!!foo) {
        // ...
    }
    
    if (Boolean(foo)) {
        // ...
    }
    
    if (foo) {
        // ...
    }

    Rule Details

    This rule disallows unnecessary boolean casts.

    Examples of incorrect code for this rule:

    /*eslint no-extra-boolean-cast: "error"*/
    
    var foo = !!!bar;
    
    var foo = !!bar ? baz : bat;
    
    var foo = Boolean(!!bar);
    
    var foo = new Boolean(!!bar);
    
    if (!!foo) {
        // ...
    }
    
    if (Boolean(foo)) {
        // ...
    }
    
    while (!!foo) {
        // ...
    }
    
    do {
        // ...
    } while (Boolean(foo));
    
    for (; !!foo; ) {
        // ...
    }

    Examples of correct code for this rule:

    /*eslint no-extra-boolean-cast: "error"*/
    
    var foo = !!bar;
    var foo = Boolean(bar);
    
    function foo() {
        return !!bar;
    }
    
    var foo = bar ? !!baz : !!bat;

    Source: http://eslint.org/docs/rules/

    Expected to return a value at the end of arrow function.
    Open

      fastScrollLoop = () => {

    require return statements to either always or never specify values (consistent-return)

    Unlike statically-typed languages which enforce that a function returns a specified type of value, JavaScript allows different code paths in a function to return different types of values.

    A confusing aspect of JavaScript is that a function returns undefined if any of the following are true:

    • it does not execute a return statement before it exits
    • it executes return which does not specify a value explicitly
    • it executes return undefined
    • it executes return void followed by an expression (for example, a function call)
    • it executes return followed by any other expression which evaluates to undefined

    If any code paths in a function return a value explicitly but some code path do not return a value explicitly, it might be a typing mistake, especially in a large function. In the following example:

    • a code path through the function returns a Boolean value true
    • another code path does not return a value explicitly, therefore returns undefined implicitly
    function doSomething(condition) {
        if (condition) {
            return true;
        } else {
            return;
        }
    }

    Rule Details

    This rule requires return statements to either always or never specify values. This rule ignores function definitions where the name begins with an uppercase letter, because constructors (when invoked with the new operator) return the instantiated object implicitly if they do not return another object explicitly.

    Examples of incorrect code for this rule:

    /*eslint consistent-return: "error"*/
    
    function doSomething(condition) {
        if (condition) {
            return true;
        } else {
            return;
        }
    }
    
    function doSomething(condition) {
        if (condition) {
            return true;
        }
    }

    Examples of correct code for this rule:

    /*eslint consistent-return: "error"*/
    
    function doSomething(condition) {
        if (condition) {
            return true;
        } else {
            return false;
        }
    }
    
    function Foo() {
        if (!(this instanceof Foo)) {
            return new Foo();
        }
    
        this.a = 0;
    }

    Options

    This rule has an object option:

    • "treatUndefinedAsUnspecified": false (default) always either specify values or return undefined implicitly only.
    • "treatUndefinedAsUnspecified": true always either specify values or return undefined explicitly or implicitly.

    treatUndefinedAsUnspecified

    Examples of incorrect code for this rule with the default { "treatUndefinedAsUnspecified": false } option:

    /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": false }]*/
    
    function foo(callback) {
        if (callback) {
            return void callback();
        }
        // no return statement
    }
    
    function bar(condition) {
        if (condition) {
            return undefined;
        }
        // no return statement
    }

    Examples of incorrect code for this rule with the { "treatUndefinedAsUnspecified": true } option:

    /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": true }]*/
    
    function foo(callback) {
        if (callback) {
            return void callback();
        }
        return true;
    }
    
    function bar(condition) {
        if (condition) {
            return undefined;
        }
        return true;
    }

    Examples of correct code for this rule with the { "treatUndefinedAsUnspecified": true } option:

    /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": true }]*/
    
    function foo(callback) {
        if (callback) {
            return void callback();
        }
        // no return statement
    }
    
    function bar(condition) {
        if (condition) {
            return undefined;
        }
        // no return statement
    }

    When Not To Use It

    If you want to allow functions to have different return behavior depending on code branching, then it is safe to disable this rule. Source: http://eslint.org/docs/rules/

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          if (!isIE || isIE > 11) {
            const useTranslate3d = true
            return (
              <div
                className={scrollClass}
    Severity: Major
    Found in src/shared/components/wall/PostCards.js and 1 other location - About 1 hr to fix
    src/shared/components/wall/PostCards.js on lines 196..208

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          } else {
            const useTranslate3d = false
            return (
              <div
                className={scrollClass}
    Severity: Major
    Found in src/shared/components/wall/PostCards.js and 1 other location - About 1 hr to fix
    src/shared/components/wall/PostCards.js on lines 184..196

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    The closing bracket must be aligned with the line containing the opening tag (expected column 11 on the next line)
    Open

                }}>

    For more information visit Source: http://eslint.org/docs/rules/

    Using this.refs is deprecated.
    Open

        const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    Using string literals in ref attributes is deprecated.
    Open

            <div className="ui cards" ref="scrollable">

    For more information visit Source: http://eslint.org/docs/rules/

    Using string literals in ref attributes is deprecated.
    Open

                ref="scroll"

    For more information visit Source: http://eslint.org/docs/rules/

    JSX not allowed in files with extension '.js'
    Open

          <Card

    For more information visit Source: http://eslint.org/docs/rules/

    The closing bracket must be aligned with the line containing the opening tag (expected column 7 on the next line)
    Open

            useTranslate3d={useTranslate3d} />

    For more information visit Source: http://eslint.org/docs/rules/

    Using string literals in ref attributes is deprecated.
    Open

            ref="scrollList"

    For more information visit Source: http://eslint.org/docs/rules/

    Using string literals in ref attributes is deprecated.
    Open

                ref="scroll"

    For more information visit Source: http://eslint.org/docs/rules/

    Do not use findDOMNode
    Open

        const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    The closing bracket must be aligned with the line containing the opening tag (expected column 11 on the next line)
    Open

                }}>

    For more information visit Source: http://eslint.org/docs/rules/

    Do not use findDOMNode
    Open

          const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    Do not use findDOMNode
    Open

        const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    Prop type array is forbidden
    Open

        posts: PropTypes.array.isRequired,

    For more information visit Source: http://eslint.org/docs/rules/

    Using this.refs is deprecated.
    Open

        const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    Using this.refs is deprecated.
    Open

          const nodeScroll = ReactDOM.findDOMNode(this.refs.scroll)

    For more information visit Source: http://eslint.org/docs/rules/

    Do not use findDOMNode
    Open

        const nodeList = ReactDOM.findDOMNode(this.refs.scrollList)

    For more information visit Source: http://eslint.org/docs/rules/

    Using this.refs is deprecated.
    Open

        const nodeList = ReactDOM.findDOMNode(this.refs.scrollList)

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status