core/modules/_core/res/js/crud/field/text/ckeditor.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function Text has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AC.Crud.Edit.Text = function() {

    var addCKEditor = function(elm) {

        // release instances, we need this if pages are loaded with AJAX to
Severity: Major
Found in core/modules/_core/res/js/crud/field/text/ckeditor.js - About 3 hrs to fix

    Function init has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            init: function() {
    
                var removeEmptyPFilter = {
                    elements : {
                        p : function( element ) {
    Severity: Major
    Found in core/modules/_core/res/js/crud/field/text/ckeditor.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                              if (!(element.previous && element.next) && child && !child.children
                                  && (!child.value || CKEDITOR.tools.trim( child.value ).match( /^(?:&nbsp;|\xa0|<br \/>)$/ ))) {
                                  return false;
                              }
      Severity: Major
      Found in core/modules/_core/res/js/crud/field/text/ckeditor.js - About 40 mins to fix

        Unnecessary semicolon.
        Open

        ;

        disallow unnecessary semicolons (no-extra-semi)

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

        Rule Details

        This rule disallows unnecessary semicolons.

        Examples of incorrect code for this rule:

        /*eslint no-extra-semi: "error"*/
        
        var x = 5;;
        
        function foo() {
            // code
        };

        Examples of correct code for this rule:

        /*eslint no-extra-semi: "error"*/
        
        var x = 5;
        
        var foo = function() {
            // code
        };

        When Not To Use It

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

        Related Rules

        Wrap an immediate function invocation in parentheses.
        Open

        AC.Crud.Edit.Text = function() {

        Require IIFEs to be Wrapped (wrap-iife)

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

        // function expression could be unwrapped
        var x = function () { return { y: 1 };}();
        
        // function declaration must be wrapped
        function () { /* side effects */ }(); // SyntaxError

        Rule Details

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

        Options

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

        String option:

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

        Object option:

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

        outside

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

        /*eslint wrap-iife: ["error", "outside"]*/
        
        var x = function () { return { y: 1 };}(); // unwrapped
        var x = (function () { return { y: 1 };})(); // wrapped function expression

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

        /*eslint wrap-iife: ["error", "outside"]*/
        
        var x = (function () { return { y: 1 };}()); // wrapped call expression

        inside

        Examples of incorrect code for the "inside" option:

        /*eslint wrap-iife: ["error", "inside"]*/
        
        var x = function () { return { y: 1 };}(); // unwrapped
        var x = (function () { return { y: 1 };}()); // wrapped call expression

        Examples of correct code for the "inside" option:

        /*eslint wrap-iife: ["error", "inside"]*/
        
        var x = (function () { return { y: 1 };})(); // wrapped function expression

        any

        Examples of incorrect code for the "any" option:

        /*eslint wrap-iife: ["error", "any"]*/
        
        var x = function () { return { y: 1 };}(); // unwrapped

        Examples of correct code for the "any" option:

        /*eslint wrap-iife: ["error", "any"]*/
        
        var x = (function () { return { y: 1 };}()); // wrapped call expression
        var x = (function () { return { y: 1 };})(); // wrapped function expression

        functionPrototypeMethods

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

        /* eslint wrap-iife: [2, "inside", { functionPrototypeMethods: true }] */
        
        var x = function(){ foo(); }()
        var x = (function(){ foo(); }())
        var x = function(){ foo(); }.call(bar)
        var x = (function(){ foo(); }.call(bar))

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

        /* eslint wrap-iife: [2, "inside", { functionPrototypeMethods: true }] */
        
        var x = (function(){ foo(); })()
        var x = (function(){ foo(); }).call(bar)

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

        There are no issues that match your filters.

        Category
        Status