NMandapaty/ArcticVoice

View on GitHub

Showing 22,124 of 22,124 total issues

Unexpected string concatenation of literals.
Open

      infoWindowContent.push(['<div class="info_content">' + "<h3><a href='/posts/" +  markers[i]["id"] + "'" + 'target="_blank" rel="noopener noreferrer">' + markers[i]["marker_title"] + '</a></h3>' + '<p>'+ window.authors[i] + '</p>' + '</div>']);
Severity: Minor
Found in app/assets/javascripts/map.js by eslint

Disallow unnecessary concatenation of strings (no-useless-concat)

It's unnecessary to concatenate two strings together, such as:

var foo = "a" + "b";

This code is likely the result of refactoring where a variable was removed from the concatenation (such as "a" + b + "b"). In such a case, the concatenation isn't important and the code can be rewritten as:

var foo = "ab";

Rule Details

This rule aims to flag the concatenation of 2 literals when they could be combined into a single literal. Literals can be strings or template literals.

Examples of incorrect code for this rule:

/*eslint no-useless-concat: "error"*/
/*eslint-env es6*/

// these are the same as "10"
var a = `some` + `string`;
var a = '1' + '0';
var a = '1' + `0`;
var a = `1` + '0';
var a = `1` + `0`;

Examples of correct code for this rule:

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

// when a non string is included
var c = a + b;
var c = '1' + a;
var a = 1 + '1';
var c = 1 - 2;
// when the string concatenation is multiline
var c = "foo" +
    "bar";

When Not To Use It

If you don't want to be notified about unnecessary string concatenation, you can safely disable this rule. Source: http://eslint.org/docs/rules/

Don't use IDs in selectors.
Open

#footer {

Move the invocation into the parens that contain the function.
Open

        google.maps.event.addListener(marker, 'click', (function(marker, i) {
Severity: Minor
Found in app/assets/javascripts/map.js by eslint

Require IIFEs to be Wrapped (wrap-iife)

You can immediately invoke function expressions, but not function declarations. A common technique to create an immediately-invoked function expression (IIFE) is to wrap a function declaration in parentheses. The opening parentheses causes the contained function to be parsed as an expression, rather than a declaration.

// function expression could be unwrapped
var x = function () { return { y: 1 };}();

// function declaration must be wrapped
function () { /* side effects */ }(); // SyntaxError

Rule Details

This rule requires all immediately-invoked function expressions to be wrapped in parentheses.

Options

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

String option:

  • "outside" enforces always wrapping the call expression. The default is "outside".
  • "inside" enforces always wrapping the function expression.
  • "any" enforces always wrapping, but allows either style.

Object option:

  • "functionPrototypeMethods": true additionally enforces wrapping function expressions invoked using .call and .apply. The default is false.

outside

Examples of incorrect code for the default "outside" option:

/*eslint wrap-iife: ["error", "outside"]*/

var x = function () { return { y: 1 };}(); // unwrapped
var x = (function () { return { y: 1 };})(); // wrapped function expression

Examples of correct code for the default "outside" option:

/*eslint wrap-iife: ["error", "outside"]*/

var x = (function () { return { y: 1 };}()); // wrapped call expression

inside

Examples of incorrect code for the "inside" option:

/*eslint wrap-iife: ["error", "inside"]*/

var x = function () { return { y: 1 };}(); // unwrapped
var x = (function () { return { y: 1 };}()); // wrapped call expression

Examples of correct code for the "inside" option:

/*eslint wrap-iife: ["error", "inside"]*/

var x = (function () { return { y: 1 };})(); // wrapped function expression

any

Examples of incorrect code for the "any" option:

/*eslint wrap-iife: ["error", "any"]*/

var x = function () { return { y: 1 };}(); // unwrapped

Examples of correct code for the "any" option:

/*eslint wrap-iife: ["error", "any"]*/

var x = (function () { return { y: 1 };}()); // wrapped call expression
var x = (function () { return { y: 1 };})(); // wrapped function expression

functionPrototypeMethods

Examples of incorrect code for this rule with the "inside", { "functionPrototypeMethods": true } options:

/* eslint wrap-iife: [2, "inside", { functionPrototypeMethods: true }] */

var x = function(){ foo(); }()
var x = (function(){ foo(); }())
var x = function(){ foo(); }.call(bar)
var x = (function(){ foo(); }.call(bar))

Examples of correct code for this rule with the "inside", { "functionPrototypeMethods": true } options:

/* eslint wrap-iife: [2, "inside", { functionPrototypeMethods: true }] */

var x = (function(){ foo(); })()
var x = (function(){ foo(); }).call(bar)

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

Don't use IDs in selectors.
Open

  #footer a {

Useless assignment to variable - e.
Open

      rescue ActiveRecord::RecordNotFound => e
Severity: Minor
Found in app/controllers/posts_controller.rb by rubocop

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.
Open

        #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{position:absolute; bottom:-29px; background:url(colorbox/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;}

Values of 0 shouldn't have units specified.
Open

        #cboxClose:hover{background-position:-100px 0px;}

Don't use IDs in selectors.
Open

        #cboxNext:hover{background-position:-75px 0px;}

Values of 0 shouldn't have units specified.
Open

        .cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}

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

.timestamp {

Element (a.src_link) is overqualified, just use .src_link without element name.
Open

a.src_link {

Unnecessary semicolon.
Open

};
Severity: Minor
Found in app/assets/javascripts/scripts.js by eslint

disallow unnecessary semicolons (no-extra-semi)

Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

Rule Details

This rule disallows unnecessary semicolons.

Examples of incorrect code for this rule:

/*eslint no-extra-semi: "error"*/

var x = 5;;

function foo() {
    // code
};

Examples of correct code for this rule:

/*eslint no-extra-semi: "error"*/

var x = 5;

var foo = function() {
    // code
};

When Not To Use It

If you intentionally use extra semicolons then you can disable this rule.

Related Rules

Heading (h4) should not be qualified.
Open

.source_table h3, .source_table h4 {

Don't use IDs in selectors.
Open

        #cboxClose{right:0; background-position:-100px -25px;}

Heading (h2) has already been defined.
Open

h1, h2, h3, h4 {

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

h1, h2, h3, h4 {

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

      .group_tabs li a:hover {

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

    .group_tabs li.active a {

Heading (h3) should not be qualified.
Open

.source_table h3, .source_table h4 {

Values of 0 shouldn't have units specified.
Open

    margin: 0px;
Severity
Category
Status
Source
Language