简体   繁体   English

将代码嗅探器错误转换为js代码

[英]Code Sniffer error into js code

I have been searching since yesterday for the resolution of two code sniffer errors : 从昨天开始,我一直在寻找两个代码嗅探器错误的解决方案:

62 | ERROR | [x] Expected 1 space after closing parenthesis; found
   |       |     " options.keys = $.extend(\n

Here is my code : 这是我的代码:

  if (newOptions.keys) options.keys = $.extend(
     {
     shift: 1,
     ctrl: 'resize' },
     newOptions.keys
  );

I would like to have the eye of an outside person to solve this, thanks for your attention :) 我想请外部人解决此问题,谢谢您的关注:)

I'd have to see the rest of the file to be able to generate and fix that Expected 1 space after closing parenthesis error, but if you want to format that IF statement in a way that PSR2 is happy with, you'd do this: 我必须查看文件的其余部分,才能Expected 1 space after closing parenthesis错误Expected 1 space after closing parenthesis生成并修复“ Expected 1 space after closing parenthesis ,但是如果要以PSR2满意的方式格式化IF语句,则可以执行此操作:

if (newOptions.keys) {
    options.keys = $.extend(
        {
            shift: 1,
            ctrl: 'resize'
        },
        newOptions.keys
    );
}

If you are using a standard that allows inline control structures, you can ignore the PSR2 error for that and use this code instead: 如果使用允许内联控制结构的标准,则可以为此忽略PSR2错误,而使用以下代码:

if (newOptions.keys) options.keys = $.extend(
    {
        shift: 1,
        ctrl: 'resize'
    },
    newOptions.keys
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM