简体   繁体   English

JSLint:对象数组中出现意外的']'

[英]JSLint : Unexpected ']' in array of object

I'm using JSLint in PHPStorm with ES6 and I have this error after the line : pathPublic + "/css/style.css", 我在ES6的PHPStorm中使用JSLint,并且在以下行出现此错误:pathPublic +“ /css/style.css”,

JSLint: Unexpected ']'. JSLint:意外的']'。

My code : 我的代码:

    let filesCss = [
    {
        outputFilename: "fc-main.min.css",
        outputPath: pathPublic + "/css",
        inputFiles: [
            pathPublic + "/css/style.css",
        ],
    },
];

The trailing commas can hisotrically give issues on older IE versions: 后面的逗号会从历史上给出旧版IE的问题:

The "Extra comma. (it breaks older versions of IE)" error (and the alternative "Trailing comma" and "Unexpected ',' errors") are thrown when JSLint, JSHint and ESLint encounter a comma following the final element of an array literal or a comma following the final value in an object literal. 当JSLint,JSHint和ESLint在数组的最后一个元素之后遇到逗号时,将引发“额外逗号(它会破坏IE的较旧版本)”错误(以及备选的“尾随逗号”和“意外错误,'错误”)。文字或对象文字中最终值后的逗号。 Since version 2.0.0 JSHint will only raise this warning if the es3 option is set to true. 从2.0.0版开始,仅当es3选项设置为true时,JSHint才会发出此警告。

So you have to remove them or use the es<version> option: 因此,您必须删除它们或使用es<version>选项:

    let filesCss = [
    {
        outputFilename: "fc-main.min.css",
        outputPath: pathPublic + "/css",
        inputFiles: [
            pathPublic + "/css/style.css"
        ]
    }
];

See: https://github.com/jamesallardice/jslint-error-explanations/blob/master/message-articles/extra-comma.md 参见: https : //github.com/jamesallardice/jslint-error-explanations/blob/master/message-articles/extra-comma.md

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

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