pepjo/react-tabs-navigation

View on GitHub

Showing 16,214 of 16,214 total issues

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

    describe('When the first tab is selected', function () {
      let tabs

      beforeEach(function () {
        tabs = sd.shallowRender(
Severity: Major
Found in src/__test__/tabs-test.js and 1 other location - About 5 hrs to fix
src/__test__/tabs-test.js on lines 36..52

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

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

    describe('When the second tab is selected', function () {
      let tabs

      beforeEach(function () {
        tabs = sd.shallowRender(
Severity: Major
Found in src/__test__/tabs-test.js and 1 other location - About 5 hrs to fix
src/__test__/tabs-test.js on lines 18..34

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

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

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

  render: function () {
    const styles = this.styles() // Gets the user styles for this element
    let filler = this.state.menuFixed
    ? <div
      style={{
Severity: Major
Found in src/tabs.js - About 2 hrs to fix

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

          it('the second tab\'s content should be displayed', function () {
            let component = tabs.getRenderOutput()
            expect(component.props.children[2].props.children).to.equal('content2')
          })
    Severity: Major
    Found in src/__test__/index-test.js and 1 other location - About 1 hr to fix
    src/__test__/index-test.js on lines 31..34

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

    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

          it('the first tab\'s content should be displayed', function () {
            const component = tabs.getRenderOutput()
            expect(component.props.children[2].props.children).to.equal('Hello')
          })
    Severity: Major
    Found in src/__test__/index-test.js and 1 other location - About 1 hr to fix
    src/__test__/index-test.js on lines 58..61

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

    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

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

      render: function () {
        return (
          <div role="application">
            <div>
              {renderFunction(this.props.banner &&
    Severity: Minor
    Found in src/index.js - About 1 hr to fix

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

              tabs = sd.shallowRender(
                <Tabs
                  selected={1}
                  tabs={[
                    {
      Severity: Major
      Found in src/__test__/index-test.js and 1 other location - About 1 hr to fix
      src/__test__/index-test.js on lines 41..55

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

      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

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

              tabs = sd.shallowRender(
                <Tabs
                  selected={1}
                  tabs={[
                    {
      Severity: Major
      Found in src/__test__/index-test.js and 1 other location - About 1 hr to fix
      src/__test__/index-test.js on lines 72..86

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

      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

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

        render: function () {
          const styles = this.styles() // Gets the user styles for this element
          let filler = this.state.menuFixed
          ? <div
            style={{
      Severity: Minor
      Found in src/tabs.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

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

        for (i=0; i<metas.length; i++) {
          if (metas[i].name == "viewport") {
            metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
          }
        }
      Severity: Major
      Found in example/javascripts/scale.fix.js and 1 other location - About 1 hr to fix
      example/javascripts/scale.fix.js on lines 4..8

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

      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

        for (i=0; i<metas.length; i++) {
          if (metas[i].name == "viewport") {
            metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
          }
        }
      Severity: Major
      Found in example/javascripts/scale.fix.js and 1 other location - About 1 hr to fix
      example/javascripts/scale.fix.js on lines 12..16

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

      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

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

          let elements = this.props.elements.map((element, i) => {
            let style = {
              width: elementWidth + '%'
            }
      
      
      Severity: Minor
      Found in src/tabs.js - About 1 hr to fix

        Function handleKeyPress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          handleKeyPress: function (event) {
            if (this.state.focused) {
              if (event.which === KEYS.space || event.which === KEYS.enter) {
                this.handleEnterPress()
              } else if (event.which === KEYS.right) {
        Severity: Minor
        Found in src/tabsKeyboardNavigationMixin.js - About 45 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 styles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          styles: function () {
            let styles = {
              lineStyle: this.props.lineStyle || {},
              selectedTabStyle: this.props.selectedTabStyle || defaultStyles.selectedTabStyle,
              tabsStyle: this.props.tabsStyle || {},
        Severity: Minor
        Found in src/tabs.js - About 45 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

        Definition for rule 'react/jsx-sort-prop-types' was not found
        Open

        module.exports = {
        Severity: Minor
        Found in gulpfile.js/config/lint.js by eslint

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

        Missing whitespace after semicolon.
        Open

        (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
        Severity: Minor
        Found in example/javascripts/out/example.js by eslint

        Enforce spacing before and after semicolons (semi-spacing)

        JavaScript allows you to place unnecessary spaces before or after a semicolon.

        Disallowing or enforcing space around a semicolon can improve the readability of your program.

        var a = "b" ;
        
        var c = "d";var e = "f";

        Rule Details

        This rule aims to enforce spacing around a semicolon. This rule prevents the use of spaces before a semicolon in expressions.

        This rule doesn't check spacing in the following cases:

        • The spacing after the semicolon if it is the first token in the line.

        • The spacing before the semicolon if it is after an opening parenthesis (( or {), or the spacing after the semicolon if it is before a closing parenthesis () or }). That spacing is checked by space-in-parens or block-spacing.

        • The spacing around the semicolon in a for loop with an empty condition (for(;;)).

        Options

        The rule takes one option, an object, which has two keys before and after having boolean values true or false. If before is true, space is enforced before semicolons and if it's false, space is disallowed before semicolons. If after is true, space is enforced after semicolons and if it's false, space is disallowed after semicolons. The after option will be only applied if a semicolon is not at the end of line.

        The default is {"before": false, "after": true}.

        "semi-spacing": ["error", {"before": false, "after": true}]

        {"before": false, "after": true}

        This is the default option. It enforces spacing after semicolons and disallows spacing before semicolons.

        Examples of incorrect code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo ;
        var foo;var bar;
        throw new Error("error") ;
        while (a) { break ; }
        for (i = 0 ; i < 10 ; i++) {}
        for (i = 0;i < 10;i++) {}

        Examples of correct code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo;
        var foo; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0; i < 10; i++) {}
        for (;;) {}
        if (true) {;}
        ;foo();

        {"before": true, "after": false}

        This option enforces spacing before semicolons and disallows spacing after semicolons.

        Examples of incorrect code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo;
        var foo ; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0;i < 10;i++) {}
        for (i = 0; i < 10; i++) {}

        Examples of correct code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo ;
        var foo ;var bar ;
        throw new Error("error") ;
        while (a) {break ;}
        for (i = 0 ;i < 10 ;i++) {}

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons.

        Related Rules

        • [semi](semi.md)
        • [no-extra-semi](no-extra-semi.md)
        • [comma-spacing](comma-spacing.md)
        • [block-spacing](block-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        Missing whitespace after semicolon.
        Open

        (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
        Severity: Minor
        Found in example/javascripts/out/example.js by eslint

        Enforce spacing before and after semicolons (semi-spacing)

        JavaScript allows you to place unnecessary spaces before or after a semicolon.

        Disallowing or enforcing space around a semicolon can improve the readability of your program.

        var a = "b" ;
        
        var c = "d";var e = "f";

        Rule Details

        This rule aims to enforce spacing around a semicolon. This rule prevents the use of spaces before a semicolon in expressions.

        This rule doesn't check spacing in the following cases:

        • The spacing after the semicolon if it is the first token in the line.

        • The spacing before the semicolon if it is after an opening parenthesis (( or {), or the spacing after the semicolon if it is before a closing parenthesis () or }). That spacing is checked by space-in-parens or block-spacing.

        • The spacing around the semicolon in a for loop with an empty condition (for(;;)).

        Options

        The rule takes one option, an object, which has two keys before and after having boolean values true or false. If before is true, space is enforced before semicolons and if it's false, space is disallowed before semicolons. If after is true, space is enforced after semicolons and if it's false, space is disallowed after semicolons. The after option will be only applied if a semicolon is not at the end of line.

        The default is {"before": false, "after": true}.

        "semi-spacing": ["error", {"before": false, "after": true}]

        {"before": false, "after": true}

        This is the default option. It enforces spacing after semicolons and disallows spacing before semicolons.

        Examples of incorrect code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo ;
        var foo;var bar;
        throw new Error("error") ;
        while (a) { break ; }
        for (i = 0 ; i < 10 ; i++) {}
        for (i = 0;i < 10;i++) {}

        Examples of correct code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo;
        var foo; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0; i < 10; i++) {}
        for (;;) {}
        if (true) {;}
        ;foo();

        {"before": true, "after": false}

        This option enforces spacing before semicolons and disallows spacing after semicolons.

        Examples of incorrect code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo;
        var foo ; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0;i < 10;i++) {}
        for (i = 0; i < 10; i++) {}

        Examples of correct code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo ;
        var foo ;var bar ;
        throw new Error("error") ;
        while (a) {break ;}
        for (i = 0 ;i < 10 ;i++) {}

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons.

        Related Rules

        • [semi](semi.md)
        • [no-extra-semi](no-extra-semi.md)
        • [comma-spacing](comma-spacing.md)
        • [block-spacing](block-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        A space is required after ','.
        Open

        (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
        Severity: Minor
        Found in example/javascripts/out/example.js by eslint

        Enforces spacing around commas (comma-spacing)

        Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

        var foo = 1, bar = 2;
        var foo = 1 ,bar = 2;

        Rule Details

        This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

        This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

        • adjacent null elements
        • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

        Options

        This rule has an object option:

        • "before": false (default) disallows spaces before commas
        • "before": true requires one or more spaces before commas
        • "after": true (default) requires one or more spaces after commas
        • "after": false disallows spaces after commas

        after

        Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

        /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
        
        var foo = 1 ,bar = 2;
        var arr = [1 , 2];
        var obj = {"foo": "bar" ,"baz": "qur"};
        foo(a ,b);
        new Foo(a ,b);
        function foo(a ,b){}
        a ,b

        Examples of correct code for this rule with the default { "before": false, "after": true } options:

        /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
        
        var foo = 1, bar = 2
            , baz = 3;
        var arr = [1, 2];
        var arr = [1,, 3]
        var obj = {"foo": "bar", "baz": "qur"};
        foo(a, b);
        new Foo(a, b);
        function foo(a, b){}
        a, b

        Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

        /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
        /*eslint array-bracket-spacing: ["error", "always"]*/
        
        var arr = [ , 2, 3 ]

        before

        Examples of incorrect code for this rule with the { "before": true, "after": false } options:

        /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo = 1, bar = 2;
        var arr = [1 , 2];
        var obj = {"foo": "bar", "baz": "qur"};
        new Foo(a,b);
        function foo(a,b){}
        a, b

        Examples of correct code for this rule with the { "before": true, "after": false } options:

        /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo = 1 ,bar = 2 ,
            baz = true;
        var arr = [1 ,2];
        var arr = [1 ,,3]
        var obj = {"foo": "bar" ,"baz": "qur"};
        foo(a ,b);
        new Foo(a ,b);
        function foo(a ,b){}
        a ,b

        Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

        /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
        /*eslint array-bracket-spacing: ["error", "never"]*/
        
        var arr = [,2 ,3]

        When Not To Use It

        If your project will not be following a consistent comma-spacing pattern, turn this rule off.

        Further Reading

        Related Rules

        • [array-bracket-spacing](array-bracket-spacing.md)
        • [comma-style](comma-style.md)
        • [space-in-brackets](space-in-brackets.md) (deprecated)
        • [space-in-parens](space-in-parens.md)
        • [space-infix-ops](space-infix-ops.md)
        • [space-after-keywords](space-after-keywords)
        • [space-unary-ops](space-unary-ops)
        • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

        Missing whitespace after semicolon.
        Open

        (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
        Severity: Minor
        Found in example/javascripts/out/example.js by eslint

        Enforce spacing before and after semicolons (semi-spacing)

        JavaScript allows you to place unnecessary spaces before or after a semicolon.

        Disallowing or enforcing space around a semicolon can improve the readability of your program.

        var a = "b" ;
        
        var c = "d";var e = "f";

        Rule Details

        This rule aims to enforce spacing around a semicolon. This rule prevents the use of spaces before a semicolon in expressions.

        This rule doesn't check spacing in the following cases:

        • The spacing after the semicolon if it is the first token in the line.

        • The spacing before the semicolon if it is after an opening parenthesis (( or {), or the spacing after the semicolon if it is before a closing parenthesis () or }). That spacing is checked by space-in-parens or block-spacing.

        • The spacing around the semicolon in a for loop with an empty condition (for(;;)).

        Options

        The rule takes one option, an object, which has two keys before and after having boolean values true or false. If before is true, space is enforced before semicolons and if it's false, space is disallowed before semicolons. If after is true, space is enforced after semicolons and if it's false, space is disallowed after semicolons. The after option will be only applied if a semicolon is not at the end of line.

        The default is {"before": false, "after": true}.

        "semi-spacing": ["error", {"before": false, "after": true}]

        {"before": false, "after": true}

        This is the default option. It enforces spacing after semicolons and disallows spacing before semicolons.

        Examples of incorrect code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo ;
        var foo;var bar;
        throw new Error("error") ;
        while (a) { break ; }
        for (i = 0 ; i < 10 ; i++) {}
        for (i = 0;i < 10;i++) {}

        Examples of correct code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo;
        var foo; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0; i < 10; i++) {}
        for (;;) {}
        if (true) {;}
        ;foo();

        {"before": true, "after": false}

        This option enforces spacing before semicolons and disallows spacing after semicolons.

        Examples of incorrect code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo;
        var foo ; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0;i < 10;i++) {}
        for (i = 0; i < 10; i++) {}

        Examples of correct code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo ;
        var foo ;var bar ;
        throw new Error("error") ;
        while (a) {break ;}
        for (i = 0 ;i < 10 ;i++) {}

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons.

        Related Rules

        • [semi](semi.md)
        • [no-extra-semi](no-extra-semi.md)
        • [comma-spacing](comma-spacing.md)
        • [block-spacing](block-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        Requires a space before '}'.
        Open

        (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
        Severity: Minor
        Found in example/javascripts/out/example.js by eslint

        Disallow or enforce spaces inside of single line blocks (block-spacing)

        Rule Details

        This rule enforces consistent spacing inside single-line blocks.

        Options

        This rule has a string option:

        • "always" (default) requires one or more spaces
        • "never" disallows spaces

        always

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

        /*eslint block-spacing: "error"*/
        
        function foo() {return true;}
        if (foo) { bar = 0;}

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

        /*eslint block-spacing: "error"*/
        
        function foo() { return true; }
        if (foo) { bar = 0; }

        never

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

        /*eslint block-spacing: ["error", "never"]*/
        
        function foo() { return true; }
        if (foo) { bar = 0;}

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

        /*eslint block-spacing: ["error", "never"]*/
        
        function foo() {return true;}
        if (foo) {bar = 0;}

        When Not To Use It

        If you don't want to be notified about spacing style inside of blocks, you can safely disable this rule. Source: http://eslint.org/docs/rules/

        Severity
        Category
        Status
        Source
        Language