Skip to content

Commit d5d8319

Browse files
committed
Separate JSLint errors from warnings.
1 parent 3db8cad commit d5d8319

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/JSLint.coffee

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -299,24 +299,30 @@ ok = JSLINT script, {
299299
plugin: false
300300
}
301301

302+
out = {errors:[],warnings:[]}
302303
unless ok
303304
result = JSLINT.data()
304305
if VERBOSE
305306
console.error util.inspect result, false, 3, true
306-
else
307-
out = {errors:[]}
308-
for error in result.errors
309-
if error?
310-
out.errors.push
311-
raw:error.raw
312-
reason:error.reason
313-
line:error.line
314-
character:error.character
315-
evidence:error.evidence
316-
console.error JSON.stringify out
317-
process.exit 1
318-
else
319-
script = script.substr(head.length, script.length - (head.length+foot.length))
320-
script = "new ADSAFE_APP(#{id}, \"#{adsafeId}\", #{JSON.stringify(details)}, function(ADSAFE){\n#{script}\n});"
321-
fs.writeFileSync outputFilename, script
322-
process.exit 0
307+
for error in result.errors
308+
if error?
309+
entry =
310+
raw:error.raw
311+
reason:error.reason
312+
line:error.line
313+
character:error.character
314+
evidence:error.evidence
315+
if entry.reason is "Confusing use of '!'."
316+
out.warnings.push entry
317+
else
318+
out.errors.push entry
319+
else
320+
out.errors.push null
321+
console.error JSON.stringify out
322+
if out.errors.length > 0
323+
process.exit 1
324+
325+
script = script.substr(head.length, script.length - (head.length+foot.length))
326+
script = "new ADSAFE_APP(#{id}, \"#{adsafeId}\", #{JSON.stringify(details)}, function(ADSAFE){\n#{script}\n});"
327+
fs.writeFileSync outputFilename, script
328+
process.exit 0

0 commit comments

Comments
 (0)