Do not ignore our handlebars plugins in eslint

This commit is contained in:
Pavel Djundik 2016-05-12 16:07:15 +03:00
parent bbf7b8086f
commit 876ce4bc6e
6 changed files with 68 additions and 59 deletions

View file

@ -1,3 +1,7 @@
# built by tools
client/js/libs.min.js client/js/libs.min.js
client/js/libs/**/*.js
client/js/lounge.templates.js client/js/lounge.templates.js
# third party
client/js/libs/jquery/*.js
client/js/libs/*.js

View file

@ -2,7 +2,7 @@ var diff;
Handlebars.registerHelper( Handlebars.registerHelper(
"diff", function(a, opt) { "diff", function(a, opt) {
if (a != diff) { if (a !== diff) {
diff = a; diff = a;
return opt.fn(this); return opt.fn(this);
} else { } else {

View file

@ -2,7 +2,7 @@ Handlebars.registerHelper(
"equal", function(a, b, opt) { "equal", function(a, b, opt) {
a = a.toString(); a = a.toString();
b = b.toString(); b = b.toString();
if (a == b) { if (a === b) {
return opt.fn(this); return opt.fn(this);
} else { } else {
return opt.inverse(this); return opt.inverse(this);

View file

@ -9,7 +9,7 @@ Handlebars.registerHelper(
); );
function uri(text) { function uri(text) {
return URI.withinString(text, function(url, start, end, source) { return window.URI.withinString(text, function(url) {
if (url.indexOf("javascript:") === 0) { if (url.indexOf("javascript:") === 0) {
return url; return url;
} }
@ -60,7 +60,7 @@ var styles = [
var escaped = encodeURI(style[1]).replace("%", "\\x"); var escaped = encodeURI(style[1]).replace("%", "\\x");
return { return {
name: style[0], name: style[0],
style: style[2] != null ? style[2] : "irc-" + style[0], style: style[2] ? style[2] : "irc-" + style[0],
key: style[1], key: style[1],
keyregex: new RegExp(escaped + "(.*?)(" + escaped + "|$)") keyregex: new RegExp(escaped + "(.*?)(" + escaped + "|$)")
}; };
@ -73,7 +73,9 @@ function colors(line) {
// regexs are cruel to parse this thing // regexs are cruel to parse this thing
// already done? // already done?
if (!styleCheck_Re.test(line)) return line; if (!styleCheck_Re.test(line)) {
return line;
}
// split up by the irc style break character ^O // split up by the irc style break character ^O
if (line.indexOf(styleBreak) >= 0) { if (line.indexOf(styleBreak) >= 0) {
@ -106,7 +108,10 @@ function colors(line) {
// Matching styles (italics/bold/underline) // Matching styles (italics/bold/underline)
// if only colours were this easy... // if only colours were this easy...
styles.forEach(function(style) { styles.forEach(function(style) {
if (result.indexOf(style.key) < 0) return; if (result.indexOf(style.key) < 0) {
return;
}
result = result.replace(style.keyregex, function(match, text) { result = result.replace(style.keyregex, function(match, text) {
return styleTemplate({ return styleTemplate({
"style": style.style, "style": style.style,

View file

@ -1,5 +1,5 @@
Handlebars.registerHelper( Handlebars.registerHelper(
"stringcolor", function(str) { "stringcolor", function(str) {
return stringcolor(str); return window.stringcolor(str);
} }
); );

View file

@ -1,5 +1,5 @@
Handlebars.registerHelper( Handlebars.registerHelper(
"users", function(count) { "users", function(count) {
return count + " " + (count == 1 ? "user" : "users"); return count + " " + (count === 1 ? "user" : "users");
} }
); );