Update 4:
The newest Web Essentials 2013 1.9 has "Better ignore logic for the lint runners", all the problems are cleared. You can turn on "Run on build" now. It has default ignore rule for common js library and minified js. The following excludeFiles
config still works, but not necessary anymore.
Update 3:
Cross my post from https://github.com/madskristensen/WebEssentials2013/issues/603.
If you don't need JSHint and JSCS's function, just go to "Tools - Options - Web Essentials - JavaScript", set "Run on build" and "Run on save" to False.
If you wish to use them, keep "Run on build" False, set "Run on save" to True. All js will be JSHint and JSCS while preview, open and save. With this change, you can build successfully without slow down. Error list will only be filled with currently opened js's JSHint and JSCS items.
By default setting, JSHint won't run on all minified and some common js library, but JSCS will run always. While JSCS, it may delay you about serval seconds with minified js. If you don't wanna wait, then go to "Web Essentials - Edit global JSCS settings". Change
"excludeFiles": ["test/data/*.js"],
into
"excludeFiles": ["**/*.min.js", "**/*.debug.js", "**/*.intellisense.js", "**/*-vsdoc.js"],
to skip JSCS only on minified js. Or change to
"excludeFiles": ["**"],
to stop JSCS totally, only keep JSHint running.
Of cause you can write your own rule to exclude those you don't need. Just put double stars at the beginning, use '/' instead of '\', other part just use single star for wildcard. Like "**/Scripts/*.js"
.
With exclude rule, it will still generate an xml information item for each js, that will be fix later (hopefully), but at last you can start coding.
At last, you can upgrade to 1.8.5, but it only stop "Run on build" from running. "Run on save" still need these settings. So it don't change what I say here.
Hope these informations are right and helpful, with current version of 1.8 and 1.8.5.
Update 1:
Install new version 1.8.5. It will stop "Run on build" function. That means even you turn it on, it will not run on build. But "Run on save True" will still and actually run on preview, open and save. The right relative pattern of excludeFiles is **/Script/**
.
So the recommand exclude rule for minified js will be:
"excludeFiles": ["**/Scripts/**.min.js", "**/Scripts/**.debug.js", "**/Scripts/**.intellisense.js", "**/Scripts/**-vsdoc.js"],
Or just use **/Script/**
to exclude them all.
The <?xml
problem will be fix by next version, according to JSHint/JSCS Errors on .min files and others?. So this pattern should be the final right one, with one problem that should and will be fix by next Web Essentials version. Or maybe next WE will provide a good default excludeFiles rule.
Update 2:
A better one:
"excludeFiles": ["**/*.min.js", "**/*.debug.js", "**/*.intellisense.js", "**/*-vsdoc.js"],
to exclude all minified js no matter where it is.
The easy way I found is go to "Tools - Options - Web Essentials - JavaScript", set Run on Build/Save to False.
Another method is go to "Web Essentials - Edit global JSCS settings", to set excludeFiles.
But multiple excludeFiles is wrong syntax. Should use [ "a", "b"] syntax.
And should use absolute path, (while setting in global?) with path divider '/', '\' is not allowed.
Sub directory is no use, you should specify every single path.
So a valid setting like this:
"excludeFiles": ["C:/Solution/Project/Scripts/*", "C:/Solution/Project/Scripts/kendo/*"]
But this way will generate another Build error per js file:
JSCS parse error: <?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
</checkstyle>
And information item per js file:
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
</checkstyle>
I don't know how to avoid it. So maybe the best way is just the first easy way.