MinnPost/object-sync-for-salesforce

View on GitHub

Showing 364 of 364 total issues

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

    public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '', $force_return = false ) {
        $post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
        if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
            $wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
            $wordpress_id     = isset( $post_data['wordpress_id'] ) ? absint( $post_data['wordpress_id'] ) : '';
Severity: Minor
Found in classes/class-object-sync-sf-admin.php - 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 object_edit_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function object_edit_link( $object_type, $wordpress_id ) {
        $edit_link = '';
        if ( 'user' === $object_type ) {
            $edit_link = get_edit_user_link( $wordpress_id );
        } elseif ( 'post' === $object_type || 'page' === $object_type || 'attachment' === $object_type ) {
Severity: Minor
Found in classes/class-object-sync-sf-wordpress.php - 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 wp_readme_find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function wp_readme_find( $target_dir = '.' ) {
    $target_dir = rtrim( $target_dir, DIRECTORY_SEPARATOR );
    if ( is_dir( $target_dir ) ) {
        foreach ( scandir( $target_dir ) as $file ) {
            if ( in_array( $file, array( 'readme.md', 'README.md' ), true ) ) {
Severity: Minor
Found in bin/wp-readme.php - 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

Missing JSDoc for parameter 'button'.
Open

/**
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

enforce valid JSDoc comments (valid-jsdoc)

JSDoc generates application programming interface (API) documentation from specially-formatted comments in JavaScript code. For example, this is a JSDoc comment for a function:

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

If comments are invalid because of typing mistakes, then documentation will be incomplete.

If comments are inconsistent because they are not updated when function definitions are modified, then readers might become confused.

Rule Details

This rule enforces valid and consistent JSDoc comments. It reports any of the following problems:

  • missing parameter tag: @arg, @argument, or @param
  • inconsistent order of parameter names in a comment compared to the function or method
  • missing return tag: @return or @returns
  • missing parameter or return type
  • missing parameter or return description
  • syntax error

This rule does not report missing JSDoc comments for classes, functions, or methods.

Note: This rule does not support all of the Google Closure documentation tool's use cases. As such, some code such as (/**number*/ n => n * 2); will be flagged as missing appropriate function JSDoc comments even though /**number*/ is intended to be a type hint and not a documentation block for the function. We don't recommend using this rule if you use type hints in this way.

Examples of incorrect code for this rule:

/*eslint valid-jsdoc: "error"*/

// expected @param tag for parameter num1 but found num instead
// missing @param tag for parameter num2
// missing return type
/**
 * Add two numbers.
 * @param {number} num The first number.
 * @returns The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

// missing brace
// missing @returns tag
/**
 * @param {string name Whom to greet.
 */
function greet(name) {
    console.log("Hello " + name);
}

// missing parameter type for num1
// missing parameter description for num2
/**
 * Represents a sum.
 * @constructor
 * @param num1 The first number.
 * @param {number} num2
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

Examples of correct code for this rule:

/*eslint valid-jsdoc: "error"*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

// default options allow missing function description
// return type `void` means the function has no `return` statement
/**
 * @param {string} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

// @constructor tag allows missing @returns tag
/**
 * Represents a sum.
 * @constructor
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

// class constructor allows missing @returns tag
/**
 * Represents a sum.
 */
class Sum {
    /**
     * @param {number} num1 The first number.
     * @param {number} num2 The second number.
     */
    constructor(num1, num2) {
        this.num1 = num1;
        this.num2 = num2;
    }
}

// @abstract tag allows @returns tag without `return` statement
class Widget {
    /**
    * When the state changes, does it affect the rendered appearance?
    * @abstract
    * @param {Object} state The new state of the widget.
    * @returns {boolean} Is current appearance inconsistent with new state?
    */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

// @override tag allows missing @param and @returns tags
class WonderfulWidget extends Widget {
    /**
     * @override
     */
    mustRender (state) {
        return state !== this.state; // shallow comparison
    }
}

Options

This rule has an object option:

  • "prefer" enforces consistent documentation tags specified by an object whose properties mean instead of key use value (for example, "return": "returns" means instead of @return use @returns)
  • "preferType" enforces consistent type strings specified by an object whose properties mean instead of key use value (for example, "object": "Object" means instead of object use Object)
  • "requireReturn" requires a return tag:
    • true (default) even if the function or method does not have a return statement (this option value does not apply to constructors)
    • false if and only if the function or method has a return statement (this option value does apply to constructors)
  • "requireReturnType": false allows missing type in return tags
  • "matchDescription" specifies (as a string) a regular expression to match the description in each JSDoc comment (for example, ".+" requires a description; this option does not apply to descriptions in parameter or return tags)
  • "requireParamDescription": false allows missing description in parameter tags
  • "requireReturnDescription": false allows missing description in return tags

prefer

Examples of additional incorrect code for this rule with sample "prefer": { "arg": "param", "argument": "param", "class": "constructor", "return": "returns", "virtual": "abstract" } options:

/*eslint valid-jsdoc: ["error", { "prefer": { "arg": "param", "argument": "param", "class": "constructor", "return": "returns", "virtual": "abstract" } }]*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @arg {int} num1 The first number.
 * @arg {int} num2 The second number.
 * @return {int} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

/**
 * Represents a sum.
 * @class
 * @argument {number} num1 The first number.
 * @argument {number} num2 The second number.
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @virtual
     * @argument {Object} state The new state of the widget.
     * @return {boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

preferType

Examples of additional incorrect code for this rule with sample "preferType": { "Boolean": "boolean", "Number": "number", "object": "Object", "String": "string" } options:

/*eslint valid-jsdoc: ["error", { "preferType": { "Boolean": "boolean", "Number": "number", "object": "Object", "String": "string" } }]*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @param {Number} num1 The first number.
 * @param {Number} num2 The second number.
 * @returns {Number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

/**
 * Output a greeting as a side effect.
 * @param {String} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @abstract
     * @param {object} state The new state of the widget.
     * @returns {Boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

requireReturn

Examples of additional incorrect code for this rule with the "requireReturn": false option:

/*eslint valid-jsdoc: ["error", { "requireReturn": false }]*/

// unexpected @returns tag because function has no `return` statement
/**
 * @param {string} name Whom to greet.
 * @returns {string} The greeting.
 */
function greet(name) {
    console.log("Hello " + name);
}

// add @abstract tag to allow @returns tag without `return` statement
class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @param {Object} state The new state of the widget.
     * @returns {boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

Example of additional correct code for this rule with the "requireReturn": false option:

/*eslint valid-jsdoc: ["error", { "requireReturn": false }]*/

/**
 * @param {string} name Whom to greet.
 */
function greet(name) {
    console.log("Hello " + name);
}

requireReturnType

Example of additional correct code for this rule with the "requireReturnType": false option:

/*eslint valid-jsdoc: ["error", { "requireReturnType": false }]*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

matchDescription

Example of additional incorrect code for this rule with a sample "matchDescription": ".+" option:

/*eslint valid-jsdoc: ["error", { "matchDescription": ".+" }]*/

// missing function description
/**
 * @param {string} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

requireParamDescription

Example of additional correct code for this rule with the "requireParamDescription": false option:

/*eslint valid-jsdoc: ["error", { "requireParamDescription": false }]*/

/**
 * Add two numbers.
 * @param {int} num1
 * @param {int} num2
 * @returns {int} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

requireReturnDescription

Example of additional correct code for this rule with the "requireReturnDescription": false option:

/*eslint valid-jsdoc: ["error", { "requireReturnDescription": false }]*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number}
 */
function add(num1, num2) {
    return num1 + num2;
}

When Not To Use It

If you aren't using JSDoc, then you can safely turn this rule off.

Further Reading

Related Rules

Expected line before comment.
Open

    // disable the items that are selected in another select, enable them otherwise.
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

require empty lines around comments (lines-around-comment)

Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

Rule Details

This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

Options

This rule has an object option:

  • "beforeBlockComment": true (default) requires an empty line before block comments
  • "afterBlockComment": true requires an empty line after block comments
  • "beforeLineComment": true requires an empty line before line comments
  • "afterLineComment": true requires an empty line after line comments
  • "allowBlockStart": true allows comments to appear at the start of block statements
  • "allowBlockEnd": true allows comments to appear at the end of block statements
  • "allowObjectStart": true allows comments to appear at the start of object literals
  • "allowObjectEnd": true allows comments to appear at the end of object literals
  • "allowArrayStart": true allows comments to appear at the start of array literals
  • "allowArrayEnd": true allows comments to appear at the end of array literals
  • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
  • "ignorePattern" custom patterns to be ignored by the rule

beforeBlockComment

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";
/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

afterBlockComment

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */

var day = "great"

beforeLineComment

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";

// what a great and wonderful day
var day = "great"

afterLineComment

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day

var day = "great"

allowBlockStart

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/

function foo(){
    // what a great and wonderful day
    var day = "great"
    return day;
}

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/

function foo(){
    /* what a great and wonderful day */
    var day = "great"
    return day;
}

allowBlockEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;
    // what a great and wonderful day
}

Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;

    /* what a great and wonderful day */
}

allowObjectStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/

var foo = {
    // what a great and wonderful day
    day: "great"
};

const {
    // what a great and wonderful day
    foo: someDay
} = {foo: "great"};

const {
    // what a great and wonderful day
    day
} = {day: "great"};

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/

var foo = {
    /* what a great and wonderful day */
    day: "great"
};

const {
    /* what a great and wonderful day */
    foo: someDay
} = {foo: "great"};

const {
    /* what a great and wonderful day */
    day
} = {day: "great"};

allowObjectEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"
    // what a great and wonderful day
};

const {
    foo: someDay
    // what a great and wonderful day
} = {foo: "great"};

const {
    day
    // what a great and wonderful day
} = {day: "great"};

Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"

    /* what a great and wonderful day */
};

const {
    foo: someDay

    /* what a great and wonderful day */
} = {foo: "great"};

const {
    day

    /* what a great and wonderful day */
} = {day: "great"};

allowArrayStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/

var day = [
    // what a great and wonderful day
    "great",
    "wonderful"
];

const [
    // what a great and wonderful day
    someDay
] = ["great", "not great"];

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/

var day = [
    /* what a great and wonderful day */
    "great",
    "wonderful"
];

const [
    /* what a great and wonderful day */
    someDay
] = ["great", "not great"];

allowArrayEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"
    // what a great and wonderful day
];

const [
    someDay
    // what a great and wonderful day
] = ["great", "not great"];

Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"

    /* what a great and wonderful day */
];

const [
    someDay

    /* what a great and wonderful day */
] = ["great", "not great"];

ignorePattern

By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

Examples of correct code for the ignorePattern option:

/*eslint lines-around-comment: ["error"]*/

foo();
/* eslint mentioned in this comment */,
bar();


/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

foo();
/* a valid comment using pragma in it */

Examples of incorrect code for the ignorePattern option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

1 + 1;
/* something else */

applyDefaultIgnorePatterns

Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

Examples of correct code for the { "applyDefaultIgnorePatterns": false } option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */

foo();
/* a valid comment using pragma in it */

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

/*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */

foo();
/* eslint mentioned in comment */

When Not To Use It

Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

Related Rules

Adjoining classes: .settings_page_object-sync-salesforce-admin .select2-container .select2-selection__rendered.ui-sortable li
Open

.settings_page_object-sync-salesforce-admin .form-table td .checkbox{line-height:1.3;margin-bottom:9px}.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current,.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current td{background:#72aee6;color:#fff}.settings_page_object-sync-salesforce-admin .fieldmap .spinner{display:inline-block;float:none}.settings_page_object-sync-salesforce-admin .fieldmap fieldset{border:1px solid #dcdcde;margin-bottom:15px;position:relative}.settings_page_object-sync-salesforce-admin .fieldmap .fields{border:0}.settings_page_object-sync-salesforce-admin .fieldmap legend{margin-top:15px;padding-left:12px;position:absolute}.settings_page_object-sync-salesforce-admin .fieldmap .fields>:nth-child(2){padding-top:35px}.settings_page_object-sync-salesforce-admin .fieldmap .fields .fieldmap-template{display:none}.settings_page_object-sync-salesforce-admin .fieldmap .fieldmap_settings>:nth-child(2){padding-top:45px}.settings_page_object-sync-salesforce-admin .fieldmap div{padding:15px 10px}.settings_page_object-sync-salesforce-admin .fieldmap div label{display:inline-block;font-weight:700;margin-bottom:7.5px}.settings_page_object-sync-salesforce-admin .fieldmap div input,.settings_page_object-sync-salesforce-admin .fieldmap div select{display:block}.settings_page_object-sync-salesforce-admin .fieldmap div.fieldmap_status select{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes label,.settings_page_object-sync-salesforce-admin .fieldmap .radios label{display:block;font-weight:400}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes input,.settings_page_object-sync-salesforce-admin .fieldmap .radios input{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap table .column-direction{min-width:200px}.settings_page_object-sync-salesforce-admin .fieldmap table td div{padding-left:0;padding-top:0}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors{margin:2px 0 .8em;padding-top:10px;text-align:right}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors .displaying-num{display:inline-block;margin-right:10px}.settings_page_object-sync-salesforce-admin .object_map .object_map_field label{display:block}.settings_page_object-sync-salesforce-admin .object_map_data li{margin-bottom:8px}.settings_page_object-sync-salesforce-admin .object_map_data .label{color:#646970;display:inline-block;margin-right:5px;min-width:150px}.settings_page_object-sync-salesforce-admin .select2-drop,.settings_page_object-sync-salesforce-admin .select2-dropdown{z-index:999999!important}.settings_page_object-sync-salesforce-admin .select2-results{line-height:1.5}.settings_page_object-sync-salesforce-admin .select2-results .select2-results__group,.settings_page_object-sync-salesforce-admin .select2-results .select2-results__option{margin:0;padding:8px}.settings_page_object-sync-salesforce-admin .select2-results .description{display:block;padding-top:4px}.settings_page_object-sync-salesforce-admin .select2-dropdown{border-color:#dcdcde}.settings_page_object-sync-salesforce-admin .select2-dropdown--below{box-shadow:0 1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-dropdown--above{box-shadow:0 -1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection{border-color:#ddd}.settings_page_object-sync-salesforce-admin .select2-container .select2-search__field{min-width:150px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single{height:32px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__rendered{line-height:2;padding-right:24px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__arrow{height:30px;right:3px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple{border-radius:0;line-height:1.5;min-height:28px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple li{margin:0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice{padding:2px 6px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice .description{display:none}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__clear{color:#999;margin-top:-1px}.settings_page_object-sync-salesforce-admin .select2-container .select2-search--inline .select2-search__field{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__rendered.ui-sortable li{cursor:move}.salesforce_user_ajax_message{border-left:4px solid #00a32a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px}.salesforce_user_ajax_message p{margin:.5em 0;padding:2px}.mapped-salesforce-user{width:auto}.mapped-salesforce-user caption{border:1px solid #dcdcde;border-bottom:0;box-shadow:0 1px 1px rgba(0,0,0,.04);color:#555;font-size:14px;font-weight:400;line-height:1.3;padding:8px 10px;text-align:left}.mapped-salesforce-user tr th{border-right:1px solid #dcdcde;font-size:13px;width:140px}

Expected line before comment.
Open

// load available options if the Salesforce object changes
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

require empty lines around comments (lines-around-comment)

Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

Rule Details

This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

Options

This rule has an object option:

  • "beforeBlockComment": true (default) requires an empty line before block comments
  • "afterBlockComment": true requires an empty line after block comments
  • "beforeLineComment": true requires an empty line before line comments
  • "afterLineComment": true requires an empty line after line comments
  • "allowBlockStart": true allows comments to appear at the start of block statements
  • "allowBlockEnd": true allows comments to appear at the end of block statements
  • "allowObjectStart": true allows comments to appear at the start of object literals
  • "allowObjectEnd": true allows comments to appear at the end of object literals
  • "allowArrayStart": true allows comments to appear at the start of array literals
  • "allowArrayEnd": true allows comments to appear at the end of array literals
  • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
  • "ignorePattern" custom patterns to be ignored by the rule

beforeBlockComment

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";
/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

afterBlockComment

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */

var day = "great"

beforeLineComment

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";

// what a great and wonderful day
var day = "great"

afterLineComment

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day

var day = "great"

allowBlockStart

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/

function foo(){
    // what a great and wonderful day
    var day = "great"
    return day;
}

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/

function foo(){
    /* what a great and wonderful day */
    var day = "great"
    return day;
}

allowBlockEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;
    // what a great and wonderful day
}

Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;

    /* what a great and wonderful day */
}

allowObjectStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/

var foo = {
    // what a great and wonderful day
    day: "great"
};

const {
    // what a great and wonderful day
    foo: someDay
} = {foo: "great"};

const {
    // what a great and wonderful day
    day
} = {day: "great"};

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/

var foo = {
    /* what a great and wonderful day */
    day: "great"
};

const {
    /* what a great and wonderful day */
    foo: someDay
} = {foo: "great"};

const {
    /* what a great and wonderful day */
    day
} = {day: "great"};

allowObjectEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"
    // what a great and wonderful day
};

const {
    foo: someDay
    // what a great and wonderful day
} = {foo: "great"};

const {
    day
    // what a great and wonderful day
} = {day: "great"};

Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"

    /* what a great and wonderful day */
};

const {
    foo: someDay

    /* what a great and wonderful day */
} = {foo: "great"};

const {
    day

    /* what a great and wonderful day */
} = {day: "great"};

allowArrayStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/

var day = [
    // what a great and wonderful day
    "great",
    "wonderful"
];

const [
    // what a great and wonderful day
    someDay
] = ["great", "not great"];

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/

var day = [
    /* what a great and wonderful day */
    "great",
    "wonderful"
];

const [
    /* what a great and wonderful day */
    someDay
] = ["great", "not great"];

allowArrayEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"
    // what a great and wonderful day
];

const [
    someDay
    // what a great and wonderful day
] = ["great", "not great"];

Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"

    /* what a great and wonderful day */
];

const [
    someDay

    /* what a great and wonderful day */
] = ["great", "not great"];

ignorePattern

By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

Examples of correct code for the ignorePattern option:

/*eslint lines-around-comment: ["error"]*/

foo();
/* eslint mentioned in this comment */,
bar();


/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

foo();
/* a valid comment using pragma in it */

Examples of incorrect code for the ignorePattern option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

1 + 1;
/* something else */

applyDefaultIgnorePatterns

Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

Examples of correct code for the { "applyDefaultIgnorePatterns": false } option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */

foo();
/* a valid comment using pragma in it */

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

/*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */

foo();
/* eslint mentioned in comment */

When Not To Use It

Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

Related Rules

There must be a space inside this paren.
Open

    allSelected = allSelected.filter((v, i, a) => a.indexOf(v) === i);
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

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

Some style guides require or disallow spaces inside of parentheses:

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

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

Rule Details

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

Options

There are two options for this rule:

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

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

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

"never"

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

/*eslint space-in-parens: ["error", "never"]*/

foo( 'bar');
foo('bar' );
foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

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

/*eslint space-in-parens: ["error", "never"]*/

foo();

foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

"always"

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

/*eslint space-in-parens: ["error", "always"]*/

foo( 'bar');
foo('bar' );
foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

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

/*eslint space-in-parens: ["error", "always"]*/

foo();

foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

Exceptions

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

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

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo(1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo(1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo( 1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo( 1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1);

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1);

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1 );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1 );

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

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

foo((1 + 2));
foo((1 + 2), 1);

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

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

foo( (1 + 2) );
foo( (1 + 2), 1);

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

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

foo( ( 1 + 2 ) );
foo( ( 1 + 2 ), 1 );

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

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

foo(( 1 + 2 ));
foo(( 1 + 2 ), 1 );

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

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

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

foo();

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

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

foo( );

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

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

foo( );

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

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

foo();

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

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar( {bar:'baz'} );
baz( 1, [1,2] );
foo( {bar: 'baz'}, [1, 2] );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar({bar:'baz'});
baz( 1, [1,2]);
foo({bar: 'baz'}, [1, 2]);

When Not To Use It

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

Related Rules

There must be a space inside this paren.
Open

    allSelected = allSelected.filter((v, i, a) => a.indexOf(v) === i);
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

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

Some style guides require or disallow spaces inside of parentheses:

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

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

Rule Details

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

Options

There are two options for this rule:

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

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

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

"never"

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

/*eslint space-in-parens: ["error", "never"]*/

foo( 'bar');
foo('bar' );
foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

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

/*eslint space-in-parens: ["error", "never"]*/

foo();

foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

"always"

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

/*eslint space-in-parens: ["error", "always"]*/

foo( 'bar');
foo('bar' );
foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

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

/*eslint space-in-parens: ["error", "always"]*/

foo();

foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

Exceptions

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

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

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo(1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo(1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo( 1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo( 1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1);

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1);

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1 );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1 );

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

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

foo((1 + 2));
foo((1 + 2), 1);

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

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

foo( (1 + 2) );
foo( (1 + 2), 1);

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

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

foo( ( 1 + 2 ) );
foo( ( 1 + 2 ), 1 );

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

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

foo(( 1 + 2 ));
foo(( 1 + 2 ), 1 );

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

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

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

foo();

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

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

foo( );

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

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

foo( );

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

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

foo();

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

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar( {bar:'baz'} );
baz( 1, [1,2] );
foo( {bar: 'baz'}, [1, 2] );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar({bar:'baz'});
baz( 1, [1,2]);
foo({bar: 'baz'}, [1, 2]);

When Not To Use It

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

Related Rules

Expected line before comment.
Open

    // add each currently selected value to an array, then make it unique.
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

require empty lines around comments (lines-around-comment)

Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

Rule Details

This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

Options

This rule has an object option:

  • "beforeBlockComment": true (default) requires an empty line before block comments
  • "afterBlockComment": true requires an empty line after block comments
  • "beforeLineComment": true requires an empty line before line comments
  • "afterLineComment": true requires an empty line after line comments
  • "allowBlockStart": true allows comments to appear at the start of block statements
  • "allowBlockEnd": true allows comments to appear at the end of block statements
  • "allowObjectStart": true allows comments to appear at the start of object literals
  • "allowObjectEnd": true allows comments to appear at the end of object literals
  • "allowArrayStart": true allows comments to appear at the start of array literals
  • "allowArrayEnd": true allows comments to appear at the end of array literals
  • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
  • "ignorePattern" custom patterns to be ignored by the rule

beforeBlockComment

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";
/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

afterBlockComment

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */

var day = "great"

beforeLineComment

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";

// what a great and wonderful day
var day = "great"

afterLineComment

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day

var day = "great"

allowBlockStart

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/

function foo(){
    // what a great and wonderful day
    var day = "great"
    return day;
}

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/

function foo(){
    /* what a great and wonderful day */
    var day = "great"
    return day;
}

allowBlockEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;
    // what a great and wonderful day
}

Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;

    /* what a great and wonderful day */
}

allowObjectStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/

var foo = {
    // what a great and wonderful day
    day: "great"
};

const {
    // what a great and wonderful day
    foo: someDay
} = {foo: "great"};

const {
    // what a great and wonderful day
    day
} = {day: "great"};

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/

var foo = {
    /* what a great and wonderful day */
    day: "great"
};

const {
    /* what a great and wonderful day */
    foo: someDay
} = {foo: "great"};

const {
    /* what a great and wonderful day */
    day
} = {day: "great"};

allowObjectEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"
    // what a great and wonderful day
};

const {
    foo: someDay
    // what a great and wonderful day
} = {foo: "great"};

const {
    day
    // what a great and wonderful day
} = {day: "great"};

Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"

    /* what a great and wonderful day */
};

const {
    foo: someDay

    /* what a great and wonderful day */
} = {foo: "great"};

const {
    day

    /* what a great and wonderful day */
} = {day: "great"};

allowArrayStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/

var day = [
    // what a great and wonderful day
    "great",
    "wonderful"
];

const [
    // what a great and wonderful day
    someDay
] = ["great", "not great"];

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/

var day = [
    /* what a great and wonderful day */
    "great",
    "wonderful"
];

const [
    /* what a great and wonderful day */
    someDay
] = ["great", "not great"];

allowArrayEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"
    // what a great and wonderful day
];

const [
    someDay
    // what a great and wonderful day
] = ["great", "not great"];

Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"

    /* what a great and wonderful day */
];

const [
    someDay

    /* what a great and wonderful day */
] = ["great", "not great"];

ignorePattern

By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

Examples of correct code for the ignorePattern option:

/*eslint lines-around-comment: ["error"]*/

foo();
/* eslint mentioned in this comment */,
bar();


/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

foo();
/* a valid comment using pragma in it */

Examples of incorrect code for the ignorePattern option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

1 + 1;
/* something else */

applyDefaultIgnorePatterns

Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

Examples of correct code for the { "applyDefaultIgnorePatterns": false } option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */

foo();
/* a valid comment using pragma in it */

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

/*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */

foo();
/* eslint mentioned in comment */

When Not To Use It

Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

Related Rules

Newline required after opening brace
Open

            <input type="text" name="salesforce_id" id="salesforce_id" value="<?php if ( isset( $mapping['id'] ) ) { echo esc_attr( $mapping['salesforce_id'] ); } ?>" class="regular-text" required /><br />

Element (div.fieldmap_status) is overqualified, just use .fieldmap_status without element name.
Open

.settings_page_object-sync-salesforce-admin .form-table td .checkbox{line-height:1.3;margin-bottom:9px}.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current,.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current td{background:#72aee6;color:#fff}.settings_page_object-sync-salesforce-admin .fieldmap .spinner{display:inline-block;float:none}.settings_page_object-sync-salesforce-admin .fieldmap fieldset{border:1px solid #dcdcde;margin-bottom:15px;position:relative}.settings_page_object-sync-salesforce-admin .fieldmap .fields{border:0}.settings_page_object-sync-salesforce-admin .fieldmap legend{margin-top:15px;padding-left:12px;position:absolute}.settings_page_object-sync-salesforce-admin .fieldmap .fields>:nth-child(2){padding-top:35px}.settings_page_object-sync-salesforce-admin .fieldmap .fields .fieldmap-template{display:none}.settings_page_object-sync-salesforce-admin .fieldmap .fieldmap_settings>:nth-child(2){padding-top:45px}.settings_page_object-sync-salesforce-admin .fieldmap div{padding:15px 10px}.settings_page_object-sync-salesforce-admin .fieldmap div label{display:inline-block;font-weight:700;margin-bottom:7.5px}.settings_page_object-sync-salesforce-admin .fieldmap div input,.settings_page_object-sync-salesforce-admin .fieldmap div select{display:block}.settings_page_object-sync-salesforce-admin .fieldmap div.fieldmap_status select{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes label,.settings_page_object-sync-salesforce-admin .fieldmap .radios label{display:block;font-weight:400}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes input,.settings_page_object-sync-salesforce-admin .fieldmap .radios input{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap table .column-direction{min-width:200px}.settings_page_object-sync-salesforce-admin .fieldmap table td div{padding-left:0;padding-top:0}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors{margin:2px 0 .8em;padding-top:10px;text-align:right}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors .displaying-num{display:inline-block;margin-right:10px}.settings_page_object-sync-salesforce-admin .object_map .object_map_field label{display:block}.settings_page_object-sync-salesforce-admin .object_map_data li{margin-bottom:8px}.settings_page_object-sync-salesforce-admin .object_map_data .label{color:#646970;display:inline-block;margin-right:5px;min-width:150px}.settings_page_object-sync-salesforce-admin .select2-drop,.settings_page_object-sync-salesforce-admin .select2-dropdown{z-index:999999!important}.settings_page_object-sync-salesforce-admin .select2-results{line-height:1.5}.settings_page_object-sync-salesforce-admin .select2-results .select2-results__group,.settings_page_object-sync-salesforce-admin .select2-results .select2-results__option{margin:0;padding:8px}.settings_page_object-sync-salesforce-admin .select2-results .description{display:block;padding-top:4px}.settings_page_object-sync-salesforce-admin .select2-dropdown{border-color:#dcdcde}.settings_page_object-sync-salesforce-admin .select2-dropdown--below{box-shadow:0 1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-dropdown--above{box-shadow:0 -1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection{border-color:#ddd}.settings_page_object-sync-salesforce-admin .select2-container .select2-search__field{min-width:150px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single{height:32px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__rendered{line-height:2;padding-right:24px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__arrow{height:30px;right:3px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple{border-radius:0;line-height:1.5;min-height:28px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple li{margin:0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice{padding:2px 6px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice .description{display:none}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__clear{color:#999;margin-top:-1px}.settings_page_object-sync-salesforce-admin .select2-container .select2-search--inline .select2-search__field{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__rendered.ui-sortable li{cursor:move}.salesforce_user_ajax_message{border-left:4px solid #00a32a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px}.salesforce_user_ajax_message p{margin:.5em 0;padding:2px}.mapped-salesforce-user{width:auto}.mapped-salesforce-user caption{border:1px solid #dcdcde;border-bottom:0;box-shadow:0 1px 1px rgba(0,0,0,.04);color:#555;font-size:14px;font-weight:400;line-height:1.3;padding:8px 10px;text-align:left}.mapped-salesforce-user tr th{border-right:1px solid #dcdcde;font-size:13px;width:140px}

Expected line before comment.
Open

    // reinitialize select2 if it's active.
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

require empty lines around comments (lines-around-comment)

Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

Rule Details

This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

Options

This rule has an object option:

  • "beforeBlockComment": true (default) requires an empty line before block comments
  • "afterBlockComment": true requires an empty line after block comments
  • "beforeLineComment": true requires an empty line before line comments
  • "afterLineComment": true requires an empty line after line comments
  • "allowBlockStart": true allows comments to appear at the start of block statements
  • "allowBlockEnd": true allows comments to appear at the end of block statements
  • "allowObjectStart": true allows comments to appear at the start of object literals
  • "allowObjectEnd": true allows comments to appear at the end of object literals
  • "allowArrayStart": true allows comments to appear at the start of array literals
  • "allowArrayEnd": true allows comments to appear at the end of array literals
  • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
  • "ignorePattern" custom patterns to be ignored by the rule

beforeBlockComment

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";
/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

afterBlockComment

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/

var night = "long";

/* what a great and wonderful day */

var day = "great"

beforeLineComment

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/

var night = "long";

// what a great and wonderful day
var day = "great"

afterLineComment

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day
var day = "great"

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

/*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/

var night = "long";
// what a great and wonderful day

var day = "great"

allowBlockStart

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

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/

function foo(){
    // what a great and wonderful day
    var day = "great"
    return day;
}

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

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/

function foo(){
    /* what a great and wonderful day */
    var day = "great"
    return day;
}

allowBlockEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;
    // what a great and wonderful day
}

Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/

function foo(){
    var day = "great"
    return day;

    /* what a great and wonderful day */
}

allowObjectStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/

var foo = {
    // what a great and wonderful day
    day: "great"
};

const {
    // what a great and wonderful day
    foo: someDay
} = {foo: "great"};

const {
    // what a great and wonderful day
    day
} = {day: "great"};

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/

var foo = {
    /* what a great and wonderful day */
    day: "great"
};

const {
    /* what a great and wonderful day */
    foo: someDay
} = {foo: "great"};

const {
    /* what a great and wonderful day */
    day
} = {day: "great"};

allowObjectEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"
    // what a great and wonderful day
};

const {
    foo: someDay
    // what a great and wonderful day
} = {foo: "great"};

const {
    day
    // what a great and wonderful day
} = {day: "great"};

Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/

var foo = {
    day: "great"

    /* what a great and wonderful day */
};

const {
    foo: someDay

    /* what a great and wonderful day */
} = {foo: "great"};

const {
    day

    /* what a great and wonderful day */
} = {day: "great"};

allowArrayStart

Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/

var day = [
    // what a great and wonderful day
    "great",
    "wonderful"
];

const [
    // what a great and wonderful day
    someDay
] = ["great", "not great"];

Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

/*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/

var day = [
    /* what a great and wonderful day */
    "great",
    "wonderful"
];

const [
    /* what a great and wonderful day */
    someDay
] = ["great", "not great"];

allowArrayEnd

Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"
    // what a great and wonderful day
];

const [
    someDay
    // what a great and wonderful day
] = ["great", "not great"];

Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

/*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/

var day = [
    "great",
    "wonderful"

    /* what a great and wonderful day */
];

const [
    someDay

    /* what a great and wonderful day */
] = ["great", "not great"];

ignorePattern

By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

Examples of correct code for the ignorePattern option:

/*eslint lines-around-comment: ["error"]*/

foo();
/* eslint mentioned in this comment */,
bar();


/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

foo();
/* a valid comment using pragma in it */

Examples of incorrect code for the ignorePattern option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */

1 + 1;
/* something else */

applyDefaultIgnorePatterns

Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

Examples of correct code for the { "applyDefaultIgnorePatterns": false } option:

/*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */

foo();
/* a valid comment using pragma in it */

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

/*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */

foo();
/* eslint mentioned in comment */

When Not To Use It

Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

Related Rules

There must be a space inside this paren.
Open

    allSelected = allSelected.filter((v, i, a) => a.indexOf(v) === i);
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

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

Some style guides require or disallow spaces inside of parentheses:

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

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

Rule Details

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

Options

There are two options for this rule:

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

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

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

"never"

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

/*eslint space-in-parens: ["error", "never"]*/

foo( 'bar');
foo('bar' );
foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

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

/*eslint space-in-parens: ["error", "never"]*/

foo();

foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

"always"

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

/*eslint space-in-parens: ["error", "always"]*/

foo( 'bar');
foo('bar' );
foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

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

/*eslint space-in-parens: ["error", "always"]*/

foo();

foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

Exceptions

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

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

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo(1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo(1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo( 1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo( 1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1);

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1);

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1 );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1 );

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

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

foo((1 + 2));
foo((1 + 2), 1);

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

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

foo( (1 + 2) );
foo( (1 + 2), 1);

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

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

foo( ( 1 + 2 ) );
foo( ( 1 + 2 ), 1 );

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

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

foo(( 1 + 2 ));
foo(( 1 + 2 ), 1 );

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

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

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

foo();

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

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

foo( );

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

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

foo( );

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

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

foo();

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

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar( {bar:'baz'} );
baz( 1, [1,2] );
foo( {bar: 'baz'}, [1, 2] );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar({bar:'baz'});
baz( 1, [1,2]);
foo({bar: 'baz'}, [1, 2]);

When Not To Use It

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

Related Rules

Newline required after opening brace
Open

                        <?php if ( '' !== esc_url( $this->wordpress->object_delete_link( $mapping_error['wordpress_object'], $mapping_error['wordpress_id'] ) ) ) : ?> | <?php endif; ?>

There must be a space inside this paren.
Open

    allSelected = allSelected.filter((v, i, a) => a.indexOf(v) === i);
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

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

Some style guides require or disallow spaces inside of parentheses:

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

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

Rule Details

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

Options

There are two options for this rule:

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

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

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

"never"

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

/*eslint space-in-parens: ["error", "never"]*/

foo( 'bar');
foo('bar' );
foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

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

/*eslint space-in-parens: ["error", "never"]*/

foo();

foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

"always"

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

/*eslint space-in-parens: ["error", "always"]*/

foo( 'bar');
foo('bar' );
foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

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

/*eslint space-in-parens: ["error", "always"]*/

foo();

foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

Exceptions

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

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

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo(1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo(1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo( 1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo( 1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1);

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1);

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1 );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1 );

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

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

foo((1 + 2));
foo((1 + 2), 1);

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

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

foo( (1 + 2) );
foo( (1 + 2), 1);

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

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

foo( ( 1 + 2 ) );
foo( ( 1 + 2 ), 1 );

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

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

foo(( 1 + 2 ));
foo(( 1 + 2 ), 1 );

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

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

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

foo();

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

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

foo( );

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

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

foo( );

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

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

foo();

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

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar( {bar:'baz'} );
baz( 1, [1,2] );
foo( {bar: 'baz'}, [1, 2] );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar({bar:'baz'});
baz( 1, [1,2]);
foo({bar: 'baz'}, [1, 2]);

When Not To Use It

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

Related Rules

There must be a space inside this paren.
Open

    });
Severity: Minor
Found in assets/js/src/03-fieldmap-rows.js by eslint

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

Some style guides require or disallow spaces inside of parentheses:

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

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

Rule Details

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

Options

There are two options for this rule:

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

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

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

"never"

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

/*eslint space-in-parens: ["error", "never"]*/

foo( 'bar');
foo('bar' );
foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

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

/*eslint space-in-parens: ["error", "never"]*/

foo();

foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

"always"

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

/*eslint space-in-parens: ["error", "always"]*/

foo( 'bar');
foo('bar' );
foo('bar');

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());

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

/*eslint space-in-parens: ["error", "always"]*/

foo();

foo( 'bar' );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );

Exceptions

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

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

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo(1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo(1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo( {bar: 'baz'} );
foo( 1, {bar: 'baz'} );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/

foo({bar: 'baz'});
foo( 1, {bar: 'baz'});

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1);

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

/*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1);

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo( [bar, baz] );
foo( [bar, baz], 1 );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/

foo([bar, baz]);
foo([bar, baz], 1 );

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

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

foo((1 + 2));
foo((1 + 2), 1);

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

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

foo( (1 + 2) );
foo( (1 + 2), 1);

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

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

foo( ( 1 + 2 ) );
foo( ( 1 + 2 ), 1 );

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

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

foo(( 1 + 2 ));
foo(( 1 + 2 ), 1 );

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

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

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

foo();

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

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

foo( );

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

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

foo( );

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

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

foo();

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

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar( {bar:'baz'} );
baz( 1, [1,2] );
foo( {bar: 'baz'}, [1, 2] );

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

/*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/

bar({bar:'baz'});
baz( 1, [1,2]);
foo({bar: 'baz'}, [1, 2]);

When Not To Use It

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

Related Rules

Use of !important
Open

.settings_page_object-sync-salesforce-admin .form-table td .checkbox{line-height:1.3;margin-bottom:9px}.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current,.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current td{background:#72aee6;color:#fff}.settings_page_object-sync-salesforce-admin .fieldmap .spinner{display:inline-block;float:none}.settings_page_object-sync-salesforce-admin .fieldmap fieldset{border:1px solid #dcdcde;margin-bottom:15px;position:relative}.settings_page_object-sync-salesforce-admin .fieldmap .fields{border:0}.settings_page_object-sync-salesforce-admin .fieldmap legend{margin-top:15px;padding-left:12px;position:absolute}.settings_page_object-sync-salesforce-admin .fieldmap .fields>:nth-child(2){padding-top:35px}.settings_page_object-sync-salesforce-admin .fieldmap .fields .fieldmap-template{display:none}.settings_page_object-sync-salesforce-admin .fieldmap .fieldmap_settings>:nth-child(2){padding-top:45px}.settings_page_object-sync-salesforce-admin .fieldmap div{padding:15px 10px}.settings_page_object-sync-salesforce-admin .fieldmap div label{display:inline-block;font-weight:700;margin-bottom:7.5px}.settings_page_object-sync-salesforce-admin .fieldmap div input,.settings_page_object-sync-salesforce-admin .fieldmap div select{display:block}.settings_page_object-sync-salesforce-admin .fieldmap div.fieldmap_status select{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes label,.settings_page_object-sync-salesforce-admin .fieldmap .radios label{display:block;font-weight:400}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes input,.settings_page_object-sync-salesforce-admin .fieldmap .radios input{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap table .column-direction{min-width:200px}.settings_page_object-sync-salesforce-admin .fieldmap table td div{padding-left:0;padding-top:0}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors{margin:2px 0 .8em;padding-top:10px;text-align:right}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors .displaying-num{display:inline-block;margin-right:10px}.settings_page_object-sync-salesforce-admin .object_map .object_map_field label{display:block}.settings_page_object-sync-salesforce-admin .object_map_data li{margin-bottom:8px}.settings_page_object-sync-salesforce-admin .object_map_data .label{color:#646970;display:inline-block;margin-right:5px;min-width:150px}.settings_page_object-sync-salesforce-admin .select2-drop,.settings_page_object-sync-salesforce-admin .select2-dropdown{z-index:999999!important}.settings_page_object-sync-salesforce-admin .select2-results{line-height:1.5}.settings_page_object-sync-salesforce-admin .select2-results .select2-results__group,.settings_page_object-sync-salesforce-admin .select2-results .select2-results__option{margin:0;padding:8px}.settings_page_object-sync-salesforce-admin .select2-results .description{display:block;padding-top:4px}.settings_page_object-sync-salesforce-admin .select2-dropdown{border-color:#dcdcde}.settings_page_object-sync-salesforce-admin .select2-dropdown--below{box-shadow:0 1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-dropdown--above{box-shadow:0 -1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection{border-color:#ddd}.settings_page_object-sync-salesforce-admin .select2-container .select2-search__field{min-width:150px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single{height:32px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__rendered{line-height:2;padding-right:24px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__arrow{height:30px;right:3px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple{border-radius:0;line-height:1.5;min-height:28px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple li{margin:0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice{padding:2px 6px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice .description{display:none}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__clear{color:#999;margin-top:-1px}.settings_page_object-sync-salesforce-admin .select2-container .select2-search--inline .select2-search__field{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__rendered.ui-sortable li{cursor:move}.salesforce_user_ajax_message{border-left:4px solid #00a32a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px}.salesforce_user_ajax_message p{margin:.5em 0;padding:2px}.mapped-salesforce-user{width:auto}.mapped-salesforce-user caption{border:1px solid #dcdcde;border-bottom:0;box-shadow:0 1px 1px rgba(0,0,0,.04);color:#555;font-size:14px;font-weight:400;line-height:1.3;padding:8px 10px;text-align:left}.mapped-salesforce-user tr th{border-right:1px solid #dcdcde;font-size:13px;width:140px}

Using width with border-right can sometimes make elements larger than you expect.
Open

.settings_page_object-sync-salesforce-admin .form-table td .checkbox{line-height:1.3;margin-bottom:9px}.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current,.settings_page_object-sync-salesforce-admin .sfwp-salesforce-version-list>tbody>tr.current td{background:#72aee6;color:#fff}.settings_page_object-sync-salesforce-admin .fieldmap .spinner{display:inline-block;float:none}.settings_page_object-sync-salesforce-admin .fieldmap fieldset{border:1px solid #dcdcde;margin-bottom:15px;position:relative}.settings_page_object-sync-salesforce-admin .fieldmap .fields{border:0}.settings_page_object-sync-salesforce-admin .fieldmap legend{margin-top:15px;padding-left:12px;position:absolute}.settings_page_object-sync-salesforce-admin .fieldmap .fields>:nth-child(2){padding-top:35px}.settings_page_object-sync-salesforce-admin .fieldmap .fields .fieldmap-template{display:none}.settings_page_object-sync-salesforce-admin .fieldmap .fieldmap_settings>:nth-child(2){padding-top:45px}.settings_page_object-sync-salesforce-admin .fieldmap div{padding:15px 10px}.settings_page_object-sync-salesforce-admin .fieldmap div label{display:inline-block;font-weight:700;margin-bottom:7.5px}.settings_page_object-sync-salesforce-admin .fieldmap div input,.settings_page_object-sync-salesforce-admin .fieldmap div select{display:block}.settings_page_object-sync-salesforce-admin .fieldmap div.fieldmap_status select{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes label,.settings_page_object-sync-salesforce-admin .fieldmap .radios label{display:block;font-weight:400}.settings_page_object-sync-salesforce-admin .fieldmap .checkboxes input,.settings_page_object-sync-salesforce-admin .fieldmap .radios input{display:inline-block}.settings_page_object-sync-salesforce-admin .fieldmap table .column-direction{min-width:200px}.settings_page_object-sync-salesforce-admin .fieldmap table td div{padding-left:0;padding-top:0}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors{margin:2px 0 .8em;padding-top:10px;text-align:right}.settings_page_object-sync-salesforce-admin form.error-rows .tablenav-pages-mappingerrors .displaying-num{display:inline-block;margin-right:10px}.settings_page_object-sync-salesforce-admin .object_map .object_map_field label{display:block}.settings_page_object-sync-salesforce-admin .object_map_data li{margin-bottom:8px}.settings_page_object-sync-salesforce-admin .object_map_data .label{color:#646970;display:inline-block;margin-right:5px;min-width:150px}.settings_page_object-sync-salesforce-admin .select2-drop,.settings_page_object-sync-salesforce-admin .select2-dropdown{z-index:999999!important}.settings_page_object-sync-salesforce-admin .select2-results{line-height:1.5}.settings_page_object-sync-salesforce-admin .select2-results .select2-results__group,.settings_page_object-sync-salesforce-admin .select2-results .select2-results__option{margin:0;padding:8px}.settings_page_object-sync-salesforce-admin .select2-results .description{display:block;padding-top:4px}.settings_page_object-sync-salesforce-admin .select2-dropdown{border-color:#dcdcde}.settings_page_object-sync-salesforce-admin .select2-dropdown--below{box-shadow:0 1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-dropdown--above{box-shadow:0 -1px 1px rgba(0,0,0,.1)}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection{border-color:#ddd}.settings_page_object-sync-salesforce-admin .select2-container .select2-search__field{min-width:150px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single{height:32px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__rendered{line-height:2;padding-right:24px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--single .select2-selection__arrow{height:30px;right:3px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple{border-radius:0;line-height:1.5;min-height:28px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple li{margin:0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice{padding:2px 6px}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection--multiple .select2-selection__choice .description{display:none}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__clear{color:#999;margin-top:-1px}.settings_page_object-sync-salesforce-admin .select2-container .select2-search--inline .select2-search__field{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 0}.settings_page_object-sync-salesforce-admin .select2-container .select2-selection__rendered.ui-sortable li{cursor:move}.salesforce_user_ajax_message{border-left:4px solid #00a32a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px}.salesforce_user_ajax_message p{margin:.5em 0;padding:2px}.mapped-salesforce-user{width:auto}.mapped-salesforce-user caption{border:1px solid #dcdcde;border-bottom:0;box-shadow:0 1px 1px rgba(0,0,0,.04);color:#555;font-size:14px;font-weight:400;line-height:1.3;padding:8px 10px;text-align:left}.mapped-salesforce-user tr th{border-right:1px solid #dcdcde;font-size:13px;width:140px}

Missing JSDoc @returns for function.
Open

/**

enforce valid JSDoc comments (valid-jsdoc)

JSDoc generates application programming interface (API) documentation from specially-formatted comments in JavaScript code. For example, this is a JSDoc comment for a function:

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

If comments are invalid because of typing mistakes, then documentation will be incomplete.

If comments are inconsistent because they are not updated when function definitions are modified, then readers might become confused.

Rule Details

This rule enforces valid and consistent JSDoc comments. It reports any of the following problems:

  • missing parameter tag: @arg, @argument, or @param
  • inconsistent order of parameter names in a comment compared to the function or method
  • missing return tag: @return or @returns
  • missing parameter or return type
  • missing parameter or return description
  • syntax error

This rule does not report missing JSDoc comments for classes, functions, or methods.

Note: This rule does not support all of the Google Closure documentation tool's use cases. As such, some code such as (/**number*/ n => n * 2); will be flagged as missing appropriate function JSDoc comments even though /**number*/ is intended to be a type hint and not a documentation block for the function. We don't recommend using this rule if you use type hints in this way.

Examples of incorrect code for this rule:

/*eslint valid-jsdoc: "error"*/

// expected @param tag for parameter num1 but found num instead
// missing @param tag for parameter num2
// missing return type
/**
 * Add two numbers.
 * @param {number} num The first number.
 * @returns The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

// missing brace
// missing @returns tag
/**
 * @param {string name Whom to greet.
 */
function greet(name) {
    console.log("Hello " + name);
}

// missing parameter type for num1
// missing parameter description for num2
/**
 * Represents a sum.
 * @constructor
 * @param num1 The first number.
 * @param {number} num2
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

Examples of correct code for this rule:

/*eslint valid-jsdoc: "error"*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

// default options allow missing function description
// return type `void` means the function has no `return` statement
/**
 * @param {string} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

// @constructor tag allows missing @returns tag
/**
 * Represents a sum.
 * @constructor
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

// class constructor allows missing @returns tag
/**
 * Represents a sum.
 */
class Sum {
    /**
     * @param {number} num1 The first number.
     * @param {number} num2 The second number.
     */
    constructor(num1, num2) {
        this.num1 = num1;
        this.num2 = num2;
    }
}

// @abstract tag allows @returns tag without `return` statement
class Widget {
    /**
    * When the state changes, does it affect the rendered appearance?
    * @abstract
    * @param {Object} state The new state of the widget.
    * @returns {boolean} Is current appearance inconsistent with new state?
    */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

// @override tag allows missing @param and @returns tags
class WonderfulWidget extends Widget {
    /**
     * @override
     */
    mustRender (state) {
        return state !== this.state; // shallow comparison
    }
}

Options

This rule has an object option:

  • "prefer" enforces consistent documentation tags specified by an object whose properties mean instead of key use value (for example, "return": "returns" means instead of @return use @returns)
  • "preferType" enforces consistent type strings specified by an object whose properties mean instead of key use value (for example, "object": "Object" means instead of object use Object)
  • "requireReturn" requires a return tag:
    • true (default) even if the function or method does not have a return statement (this option value does not apply to constructors)
    • false if and only if the function or method has a return statement (this option value does apply to constructors)
  • "requireReturnType": false allows missing type in return tags
  • "matchDescription" specifies (as a string) a regular expression to match the description in each JSDoc comment (for example, ".+" requires a description; this option does not apply to descriptions in parameter or return tags)
  • "requireParamDescription": false allows missing description in parameter tags
  • "requireReturnDescription": false allows missing description in return tags

prefer

Examples of additional incorrect code for this rule with sample "prefer": { "arg": "param", "argument": "param", "class": "constructor", "return": "returns", "virtual": "abstract" } options:

/*eslint valid-jsdoc: ["error", { "prefer": { "arg": "param", "argument": "param", "class": "constructor", "return": "returns", "virtual": "abstract" } }]*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @arg {int} num1 The first number.
 * @arg {int} num2 The second number.
 * @return {int} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

/**
 * Represents a sum.
 * @class
 * @argument {number} num1 The first number.
 * @argument {number} num2 The second number.
 */
function sum(num1, num2) {
    this.num1 = num1;
    this.num2 = num2;
}

class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @virtual
     * @argument {Object} state The new state of the widget.
     * @return {boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

preferType

Examples of additional incorrect code for this rule with sample "preferType": { "Boolean": "boolean", "Number": "number", "object": "Object", "String": "string" } options:

/*eslint valid-jsdoc: ["error", { "preferType": { "Boolean": "boolean", "Number": "number", "object": "Object", "String": "string" } }]*/
/*eslint-env es6*/

/**
 * Add two numbers.
 * @param {Number} num1 The first number.
 * @param {Number} num2 The second number.
 * @returns {Number} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

/**
 * Output a greeting as a side effect.
 * @param {String} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @abstract
     * @param {object} state The new state of the widget.
     * @returns {Boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

requireReturn

Examples of additional incorrect code for this rule with the "requireReturn": false option:

/*eslint valid-jsdoc: ["error", { "requireReturn": false }]*/

// unexpected @returns tag because function has no `return` statement
/**
 * @param {string} name Whom to greet.
 * @returns {string} The greeting.
 */
function greet(name) {
    console.log("Hello " + name);
}

// add @abstract tag to allow @returns tag without `return` statement
class Widget {
    /**
     * When the state changes, does it affect the rendered appearance?
     * @param {Object} state The new state of the widget.
     * @returns {boolean} Is current appearance inconsistent with new state?
     */
    mustRender (state) {
        throw new Error("Widget subclass did not implement mustRender");
    }
}

Example of additional correct code for this rule with the "requireReturn": false option:

/*eslint valid-jsdoc: ["error", { "requireReturn": false }]*/

/**
 * @param {string} name Whom to greet.
 */
function greet(name) {
    console.log("Hello " + name);
}

requireReturnType

Example of additional correct code for this rule with the "requireReturnType": false option:

/*eslint valid-jsdoc: ["error", { "requireReturnType": false }]*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

matchDescription

Example of additional incorrect code for this rule with a sample "matchDescription": ".+" option:

/*eslint valid-jsdoc: ["error", { "matchDescription": ".+" }]*/

// missing function description
/**
 * @param {string} name Whom to greet.
 * @returns {void}
 */
function greet(name) {
    console.log("Hello " + name);
}

requireParamDescription

Example of additional correct code for this rule with the "requireParamDescription": false option:

/*eslint valid-jsdoc: ["error", { "requireParamDescription": false }]*/

/**
 * Add two numbers.
 * @param {int} num1
 * @param {int} num2
 * @returns {int} The sum of the two numbers.
 */
function add(num1, num2) {
    return num1 + num2;
}

requireReturnDescription

Example of additional correct code for this rule with the "requireReturnDescription": false option:

/*eslint valid-jsdoc: ["error", { "requireReturnDescription": false }]*/

/**
 * Add two numbers.
 * @param {number} num1 The first number.
 * @param {number} num2 The second number.
 * @returns {number}
 */
function add(num1, num2) {
    return num1 + num2;
}

When Not To Use It

If you aren't using JSDoc, then you can safely turn this rule off.

Further Reading

Related Rules

Severity
Category
Status
Source
Language