lancetw/react-isomorphic-bundle

View on GitHub
src/shared/components/addon/maps/gmap.js

Summary

Maintainability
C
7 hrs
Test Coverage

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

  render () {
    const Translate = require('react-translate-component')

    const directionsClasses = classNames(
      'column',
Severity: Major
Found in src/shared/components/addon/maps/gmap.js - About 2 hrs to fix

    Redundant double negation.
    Open

        if (!!this.props.loading) {

    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 'this' to be used by class method 'createMapOptions'.
    Open

      createMapOptions (maps) {

    Enforce that class methods utilize this (class-methods-use-this)

    If a class method does not use this, it can safely be made a static function.

    It's possible to have a class method which doesn't use this, such as:

    class A {
        constructor() {
            this.a = "hi";
        }
    
        print() {
            console.log(this.a);
        }
    
        sayHi() {
            console.log("hi");
        }
    }
    
    let a = new A();
    a.sayHi(); // => "hi"

    In the example above, the sayHi method doesn't use this, so we can make it a static method:

    class A {
        constructor() {
            this.a = "hi";
        }
    
        print() {
            console.log(this.a);
        }
    
        static sayHi() {
            console.log("hi");
        }
    }
    
    A.sayHi(); // => "hi"

    Also note in the above examples that the code calling the function on an instance of the class (let a = new A(); a.sayHi();) changes to calling it on the class itself (A.sayHi();).

    Rule Details

    This rule is aimed to flag class methods that do not use this.

    Examples of incorrect code for this rule:

    /*eslint class-methods-use-this: "error"*/
    /*eslint-env es6*/
    
    class A {
        foo() {
            console.log("Hello World");     /*error Expected 'this' to be used by class method 'foo'.*/
        }
    }

    Examples of correct code for this rule:

    /*eslint class-methods-use-this: "error"*/
    /*eslint-env es6*/
    class A {
        foo() {
            this.bar = "Hello World"; // OK, this is used
        }
    }
    
    class A {
        constructor() {
            // OK. constructor is exempt
        }
    }
    
    class A {
        static foo() {
            // OK. static methods aren't expected to use this.
        }
    }

    Options

    Exceptions

    "class-methods-use-this": [<enabled>, { "exceptMethods": [&lt;...exceptions&gt;] }]</enabled>

    The exceptMethods option allows you to pass an array of method names for which you would like to ignore warnings.

    Examples of incorrect code for this rule when used without exceptMethods:

    /*eslint class-methods-use-this: "error"*/
    
    class A {
        foo() {
        }
    }

    Examples of correct code for this rule when used with exceptMethods:

    /*eslint class-methods-use-this: ["error", { "exceptMethods": ["foo"] }] */
    
    class A {
        foo() {
        }
    }

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

    Missing '()' invoking a constructor.
    Open

          this.directionsDisplay = new google.maps.DirectionsRenderer

    require parentheses when invoking a constructor with no arguments (new-parens)

    JavaScript allows the omission of parentheses when invoking a function via the new keyword and the constructor has no arguments. However, some coders believe that omitting the parentheses is inconsistent with the rest of the language and thus makes code less clear.

    var person = new Person;

    Rule Details

    This rule requires parentheses when invoking a constructor with no arguments using the new keyword in order to increase code clarity.

    Examples of incorrect code for this rule:

    /*eslint new-parens: "error"*/
    
    var person = new Person;
    var person = new (Person);

    Examples of correct code for this rule:

    /*eslint new-parens: "error"*/
    
    var person = new Person();
    var person = new (Person)();

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

    Unexpected require().
    Open

        const Translate = require('react-translate-component')

    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

      swal = require('sweetalert')

    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/

    Unnecessarily quoted property 'segment' found.
    Open

          { 'segment': this.state.showDirections }

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

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

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

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

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

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

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

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

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

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

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

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

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

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

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

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

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Missing '()' invoking a constructor.
    Open

          this.directionsService = new google.maps.DirectionsService

    require parentheses when invoking a constructor with no arguments (new-parens)

    JavaScript allows the omission of parentheses when invoking a function via the new keyword and the constructor has no arguments. However, some coders believe that omitting the parentheses is inconsistent with the rest of the language and thus makes code less clear.

    var person = new Person;

    Rule Details

    This rule requires parentheses when invoking a constructor with no arguments using the new keyword in order to increase code clarity.

    Examples of incorrect code for this rule:

    /*eslint new-parens: "error"*/
    
    var person = new Person;
    var person = new (Person);

    Examples of correct code for this rule:

    /*eslint new-parens: "error"*/
    
    var person = new Person();
    var person = new (Person)();

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

    Unexpected function expression.
    Open

        }, function (response, status) {

    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/

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

        if (!!this.props.loading) {
          return (
            <div className="ui inverted segment has-header">
              <div className="ui active dimmer">
                <div className="ui small indeterminate text loader">
    Severity: Major
    Found in src/shared/components/addon/maps/gmap.js and 1 other location - About 1 hr to fix
    src/shared/components/PostDetailComponent.js on lines 255..477

    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 72.

    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 4 locations. Consider refactoring.
    Open

                  <button
                    onClick={this._onGeoClick.bind(null, 'DRIVING')}
                    className="ui icon button"><i className="car icon"></i></button>
    Severity: Major
    Found in src/shared/components/addon/maps/gmap.js and 3 other locations - About 50 mins to fix
    src/shared/components/addon/maps/gmap.js on lines 169..171
    src/shared/components/addon/maps/gmap.js on lines 172..174
    src/shared/components/addon/maps/gmap.js on lines 178..180

    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 52.

    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 4 locations. Consider refactoring.
    Open

                  <button
                    onClick={this._onGeoClick.bind(null, 'RESET')}
                    className="ui icon button"><i className="ban icon"></i></button>
    Severity: Major
    Found in src/shared/components/addon/maps/gmap.js and 3 other locations - About 50 mins to fix
    src/shared/components/addon/maps/gmap.js on lines 169..171
    src/shared/components/addon/maps/gmap.js on lines 172..174
    src/shared/components/addon/maps/gmap.js on lines 175..177

    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 52.

    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 4 locations. Consider refactoring.
    Open

                  <button
                  onClick={this._onGeoClick.bind(null, 'WALKING')}
                  className="ui icon button"><i className="child icon"></i></button>
    Severity: Major
    Found in src/shared/components/addon/maps/gmap.js and 3 other locations - About 50 mins to fix
    src/shared/components/addon/maps/gmap.js on lines 169..171
    src/shared/components/addon/maps/gmap.js on lines 175..177
    src/shared/components/addon/maps/gmap.js on lines 178..180

    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 52.

    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 4 locations. Consider refactoring.
    Open

                  <button
                    onClick={this._onGeoClick.bind(null, 'TRANSIT')}
                    className="ui icon button"><i className="bus icon"></i></button>
    Severity: Major
    Found in src/shared/components/addon/maps/gmap.js and 3 other locations - About 50 mins to fix
    src/shared/components/addon/maps/gmap.js on lines 172..174
    src/shared/components/addon/maps/gmap.js on lines 175..177
    src/shared/components/addon/maps/gmap.js on lines 178..180

    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 52.

    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

    Absolute imports should come before relative imports.
    Open

    import { runGeoLoc } from 'shared/utils/geoloc-utils'

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

    'defaultLocale' PropType is defined but prop is never used
    Open

        defaultLocale: PropTypes.string,

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

    propType "onChange" is not required, but has no corresponding defaultProp declaration.
    Open

        onChange: PropTypes.func,

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

    'onHoverKeyChange' PropType is defined but prop is never used
    Open

        onHoverKeyChange: PropTypes.func, // @controllable generated fn

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

    Absolute imports should come before relative imports.
    Open

    import classNames from 'classnames'

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

    'hoverKey' PropType is defined but prop is never used
    Open

        hoverKey: PropTypes.string, // @controllable

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

    propType "defaultLocale" is not required, but has no corresponding defaultProp declaration.
    Open

        defaultLocale: PropTypes.string,

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

    propType "onCenterChange" is not required, but has no corresponding defaultProp declaration.
    Open

        onCenterChange: PropTypes.func, // @controllable generated fn

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

    propType "onHoverKeyChange" is not required, but has no corresponding defaultProp declaration.
    Open

        onHoverKeyChange: PropTypes.func, // @controllable generated fn

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

    'onCenterChange' PropType is defined but prop is never used
    Open

        onCenterChange: PropTypes.func, // @controllable generated fn

    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 13 on the next line)
    Open

                  zoom={this.props.zoom}>

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

    'clickKey' PropType is defined but prop is never used
    Open

        clickKey: PropTypes.string, // @controllable

    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 15 on the next line)
    Open

                    place={this.props.place || counterpart('post.map.my')} />

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

    Prop type array is forbidden
    Open

        defaultCenter: PropTypes.array,

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

    Prop type array is forbidden
    Open

        center: PropTypes.array, // @controllable

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

    propType "onZoomChange" is not required, but has no corresponding defaultProp declaration.
    Open

        onZoomChange: PropTypes.func, // @controllable generated fn

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

    propType "place" is not required, but has no corresponding defaultProp declaration.
    Open

        place: PropTypes.string,

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

    JSX props should not use .bind()
    Open

                    onClick={this._onGeoClick.bind(null, 'TRANSIT')}

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

    'onZoomChange' PropType is defined but prop is never used
    Open

        onZoomChange: PropTypes.func, // @controllable generated fn

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

    Using string literals in ref attributes is deprecated.
    Open

                  ref="gmap"

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

    propType "hoverKey" is not required, but has no corresponding defaultProp declaration.
    Open

        hoverKey: PropTypes.string, // @controllable

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

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

            <div className="ui inverted segment has-header">

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

    propType "clickKey" is not required, but has no corresponding defaultProp declaration.
    Open

        clickKey: PropTypes.string, // @controllable

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

    Empty components are self-closing
    Open

                  className="ui icon button"><i className="child icon"></i></button>

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

    Empty components are self-closing
    Open

                    className="ui icon button"><i className="car icon"></i></button>

    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 15 on the next line)
    Open

                    className="ui icon button"><i className="ban icon"></i></button>

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

    JSX props should not use .bind()
    Open

                    onClick={this._onGeoClick.bind(null, 'DRIVING')}

    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 15 on the next line)
    Open

                    className="ui icon button"><i className="bus icon"></i></button>

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

    Empty components are self-closing
    Open

                    className="ui icon button"><i className="ban icon"></i></button>

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

    JSX props should not use .bind()
    Open

                    onClick={this._onGeoClick.bind(null, 'RESET')}

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

    JSX props should not use .bind()
    Open

                  onClick={this._onGeoClick.bind(null, 'WALKING')}

    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 15 on the next line)
    Open

                  className="ui icon button"><i className="child icon"></i></button>

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

    Expected indentation of 16 space characters but found 14.
    Open

                  onClick={this._onGeoClick.bind(null, 'WALKING')}

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

    Empty components are self-closing
    Open

                    className="ui icon button"><i className="bus icon"></i></button>

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

    Expected indentation of 16 space characters but found 14.
    Open

                  className="ui icon button"><i className="child icon"></i></button>

    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 15 on the next line)
    Open

                    className="ui icon button"><i className="car icon"></i></button>

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

    Empty components are self-closing
    Open

                <div id="directions" className={directionsClasses}></div>

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

    There are no issues that match your filters.

    Category
    Status