0

我将 JSHint 和 SublimeLinter 与 Sublime Text 3 一起使用,但是当使用 Facebooks API 时,它不喜欢:结构中的对象 double,例如。{ og:url: 'example.com' }

FB.api(
'me/objects/my-app:object',
'post',
{
    og:url: http://samples.ogp.me/12345678910,
    og:title: Sample Object,
    og:type: my-app:object,
    og:image: https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png,
    og:description: ,
    fb:app_id: 12345678910,
    place:location:latitude: Sample Location: Latitude,
    place:location:longitude: Sample Location: Longitude
},
    function(response) {
        // handle the response
    }
);

我知道如何忽略项目根目录上的 .jshintrc 文件中的某些变量和名称,但不知道如何阻止它抱怨这种结构。我认为由于 Facebook API 很受欢迎,因此值得在这里发布。

4

1 回答 1

0

用引号括起来。例如。{ 'og:url': 'example.com' }

于 2015-07-21T21:31:58.010 回答