javascript - Should I worry about these JSLint warnings on HTML5Shiv.min.js version 3.7.2? -


i copied version of html5shiv.min.js cloudflare link, , when import file adobe brackets, jslint compiler tells me script contains following errors:

4   missing 'use strict' statement.     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins  4   'c' defined.     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins  4   expected ';' , instead saw '='.     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins  4   unreachable '=' after 'return'.     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins  4   expected identifier , instead saw '='.     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins  4   stopping. (100% scanned).     !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins 

is going work if decide use it? code missing statements , unreachable operators. maybe jslint not date or off, second opinion on if possible.

thank you.

don't sweat it. you're fine use library. "missing" line "use strict";, jslint likes, you're not required use it. (here's decent discussion of use strict.)

jslint , other linters 2 types of "errors": functional , style. many of style errors jslint finds translate logical errors want avoid. it's great tool.

at same time, can make style errors jslint doesn't without breaking code's function, especially in minified code. don't worry when see jslint identifying style errors in third-party code -- or anyone's minified code. they're not functional issues.

as rule, should exempt 3rd party libraries linting. there's nothing can external libraries unless want fork them , lint them yourself, is, well, insane. ;^) and, again, minified code takes shortcuts aren't lint-friendly. lint your code before minify keep quality high, don't worry qaing libraries shouldn't touching anyhow. assume have method ensuring high quality, might include using different linter, or linter different set of rules.

and here's "dirty" secret...

jquery borks jslint too...

jquery, unminified, doesn't lint either, instance. if add line tell jslint lay off of whitespace "error", missing "use strict", , let know should assume browser, get...

'module' used before defined.     if ( typeof module === "object" && typeof module.exports === "object" ) { line 18 character 44'module' used before defined.     if ( typeof module === "object" && typeof module.exports === "object" ) { line 26 character 3'module' used before defined.         module.exports = global.document ? line 39 character 3unexpected 'typeof'. use '===' compare directly undefined. }(typeof window !== "undefined" ? window : this, function( window, noglobal ) { line 49 character 5 combine previous 'var' statement.     var slice = deletedids.slice; line 51 character 5 combine previous 'var' statement.     var concat = deletedids.concat; line 53 character 5 combine previous 'var' statement.     var push = deletedids.push; line 55 character 5 combine previous 'var' statement. 

etc etc etc. and nobody going argue jquery bogus, know? don't worry if cloudfire or other file gives same set of errors.

bottom line: don't sweat lint yelling @ libraries, minified ones. linters code quality tools your code. if others have other means of keeping code working , tests uses, leave lib alone. ;^)


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -