jibeinc/juice

View on GitHub

Showing 25 of 25 total issues

Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (config) {
  var configuration = {
    browsers: [
      'Chrome'
    ],
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

Function constructor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(el, fetch, opts = {}) {
    const currentLocationText = opts.currentLocationText || 'Use my current location';
    const showLoaderOnCurrentLocation = opts.showLoaderOnCurrentLocation || false;

    // define the "current location" icon DOM fragment
Severity: Minor
Found in src/LocationTypeahead/index.js - About 1 hr to fix

Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(el, opts = {}) {
    super(el, {
      parentElement: opts.parentElement,
      preserveChildElements: true
    });
Severity: Minor
Found in src/Toggle/index.js - About 1 hr to fix

Function selectByIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  selectByIndex() {
    if (!this.active()) {
      return;
    }

Severity: Minor
Found in src/Typeahead/index.js - About 1 hr 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

Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(el, onScrollToBottom, opts = {}) {
    super(el, {
      preserveChildElements: true
    });

Severity: Minor
Found in src/InfiniteScroll/index.js - About 1 hr to fix

Function set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  set(v) {

    // If the textInput contains location data
    if (typeof v === 'object') {
      this.value = v;
Severity: Minor
Found in src/LocationTextInput/index.js - About 35 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

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

  constructor(el, content, opts = {}) {
    if (typeof content === 'string') {
      super(el, {preserveChildElements: true});
      Object.assign(this, {
        closeButton: opts.closeButton || 'X',
Severity: Minor
Found in src/Modal/index.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

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

  getDisplayValue() {
    let display;

    for (const opt of this.options) {
      if (opt.selected) {
Severity: Minor
Found in src/SingleSelect/index.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

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

  setOptions(options) {
    const selection = this.get();
    this.options = options.map((opt) => {
      if (typeof opt !== 'object') {
        opt = {
Severity: Minor
Found in src/RadioButtons/index.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

Rule doesn't have all its properties in alphabetical order.
Open

.ui-current-location {
Severity: Minor
Found in src/CurrentLocation/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.ui-curr-loc {
Severity: Minor
Found in src/LocationTypeahead/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.ui-text-input-icon {
Severity: Minor
Found in src/TextInput/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.ui-location-icon {
Severity: Minor
Found in src/LocationTextInput/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.ui-text-input-icon {
Severity: Minor
Found in src/LocationTextInput/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.grow {
Severity: Minor
Found in src/ExpandCollapse/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.categories {
Severity: Minor
Found in examples/multiSelect/styles.css by csslint

Identifier 'Chrome_travis_ci' is not in camel case.
Open

      Chrome_travis_ci: {
Severity: Minor
Found in karma.conf.js by eslint

Require Camelcase (camelcase)

When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

Rule Details

This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls.

Options

This rule has an object option:

  • "properties": "always" (default) enforces camelcase style for property names
  • "properties": "never" does not check property names

always

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

/*eslint camelcase: "error"*/

var my_favorite_color = "#112C85";

function do_something() {
    // ...
}

obj.do_something = function() {
    // ...
};

var obj = {
    my_pref: 1
};

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

/*eslint camelcase: "error"*/

var myFavoriteColor   = "#112C85";
var _myFavoriteColor  = "#112C85";
var myFavoriteColor_  = "#112C85";
var MY_FAVORITE_COLOR = "#112C85";
var foo = bar.baz_boom;
var foo = { qux: bar.baz_boom };

obj.do_something();

var { category_id: category } = query;

never

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

/*eslint camelcase: ["error", {properties: "never"}]*/

var obj = {
    my_pref: 1
};

When Not To Use It

If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

Adjoining classes: .categories.show-all
Open

.categories.show-all {
Severity: Minor
Found in examples/multiSelect/styles.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.ui-text-input {
Severity: Minor
Found in src/TextInput/styles.css by csslint

Use path.join() or path.resolve() instead of + to create paths.
Open

    path: __dirname + '/dist',
Severity: Minor
Found in webpack.config.js by eslint

Disallow string concatenation when using __dirname and __filename (no-path-concat)

In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

var fullPath = __dirname + "/foo.js";

However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

var fullPath = path.join(__dirname, "foo.js");

This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

var fullPath = path.resolve(__dirname, "foo.js");

Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

Rule Details

This rule aims to prevent string concatenation of directory paths in Node.js

Examples of incorrect code for this rule:

/*eslint no-path-concat: "error"*/

var fullPath = __dirname + "/foo.js";

var fullPath = __filename + "/foo.js";

Examples of correct code for this rule:

/*eslint no-path-concat: "error"*/

var fullPath = dirname + "/foo.js";

When Not To Use It

If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language