简体   繁体   中英

JSLint error in Gruntfile.js

I've written a Gruntfile.js where I call grunt.file.delete() , and JSLint is barking at me, saying, "Expected an identifier and instead saw 'delete' (a reserved word). grunt.file.delete(config[task].dest); "

config is an object, task a string matching the task name, and dest a path string.

I already have /*jslint node:true */ set at the top of the file.

Does anyone know if this is a valid issue, and if it is, what's the basis and what do I do to fix it?

According to https://github.com/gruntjs/grunt/issues/752

If you enable the es5 option for linting your Gruntfile with JSHint, this error should go away.

Alternatively, just change grunt.file.delete to grunt.file['delete']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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