Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

jslint: remove whitespaces using simple regex #8674

Merged
merged 2 commits into from
Aug 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/extensions/default/JSLint/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,8 @@ define(function (require, exports, module) {
* a gold star when no errors are found.
*/
function lintOneFile(text, fullPath) {
// If a line contains only whitespace, remove the whitespace
// This should be doable with a regexp: text.replace(/\r[\x20|\t]+\r/g, "\r\r");,
// but that doesn't work.
var i, arr = text.split("\n");
for (i = 0; i < arr.length; i++) {
if (!arr[i].match(/\S/)) {
arr[i] = "";
}
}
text = arr.join("\n");
// If a line contains only whitespace (here spaces or tabs), remove the whitespace
text = text.replace(/^[ \t]+$/gm, "");

var options = prefs.get("options");

Expand Down