Skip to content
Browse files

Code wasn't being linted properly, fixed code and lint rules.

  • Loading branch information...
1 parent f3cd7e4 commit 81390d1b0f8f8f22005f924c685243e1611a48d2 @hassankhan hassankhan committed
Showing with 20 additions and 17 deletions.
  1. +4 −7 .jshintrc
  2. +4 −1 Gruntfile.js
  3. +12 −9 emojify.js
View
11 .jshintrc
@@ -13,14 +13,11 @@
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
"trailing" : true, // true: Prohibit trailing whitespaces
+ // Predefined stuff
+ "predef" : ["define", "module"],
+
// Environments
"browser" : true, // Web Browser (window, document, etc)
- "jquery" : false, // jQuery
+ "node" : true // Node.js
- // Custom Globals
- "globals" : { // additional predefined global variables
- "define" : "false",
- "JS" : "false",
- "emojify" : "false"
- }
}
View
5 Gruntfile.js
@@ -10,7 +10,10 @@ module.exports = function (grunt) {
' */'
},
jshint : {
- files : ['emojify.js']
+ files: [ 'emojify.js' ],
+ options: {
+ jshintrc: '.jshintrc'
+ }
},
uglify : {
options : {
View
21 emojify.js
@@ -1,4 +1,6 @@
(function (root, factory) {
+ 'use strict';
+
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
@@ -10,7 +12,7 @@
} else {
// Browser globals (root is window)
root.emojify = factory();
- }
+ }
}(this, function () {
'use strict';
@@ -68,11 +70,11 @@
};
if (defaultConfig.ignore_emoticons) {
- emoticons = {
- /* :..: */ named: /:([a-z0-9A-Z_-]+):/,
- /* :+1: */ thumbsup: /:\+1:/g,
- /* :-1: */ thumbsdown: /:\-1:/g
- };
+ emoticons = {
+ /* :..: */ named: /:([a-z0-9A-Z_-]+):/,
+ /* :+1: */ thumbsup: /:\+1:/g,
+ /* :-1: */ thumbsdown: /:\-1:/g
+ };
}
return Object.keys(emoticons).map(function(key) {
@@ -118,7 +120,7 @@
function insertEmojicon(node, match, emojiName) {
var emojiElement = document.createElement(defaultConfig.emojify_tag_type || 'img');
- if (defaultConfig.emojify_tag_type && defaultConfig.emojify_tag_type != 'img') {
+ if (defaultConfig.emojify_tag_type && defaultConfig.emojify_tag_type !== 'img') {
emojiElement.setAttribute('class', 'emoji emoji-' + emojiName);
} else {
emojiElement.setAttribute('class', 'emoji');
@@ -150,7 +152,7 @@
}
function defaultReplacer(emoji, name) {
- if (defaultConfig.emojify_tag_type && defaultConfig.emojify_tag_type != 'img') {
+ if (defaultConfig.emojify_tag_type && defaultConfig.emojify_tag_type !== 'img') {
return "<" + defaultConfig.emojify_tag_type +" title=':" + name + ":' alt=':" + name + ":' class='emoji emoji-" + name + "'> </" + defaultConfig.emojify_tag_type+ ">";
} else {
return "<img title=':" + name + ":' alt=':" + name + ":' class='emoji' src='" + defaultConfig.img_dir + '/' + name + ".png' align='absmiddle' />";
@@ -302,4 +304,5 @@
})();
return emojify;
-}));
+ }
+));

0 comments on commit 81390d1

Please sign in to comment.
Something went wrong with that request. Please try again.