Skip to content

Commit 2d83464

Browse files
committed
lint fix (warnings)
1 parent 38b102b commit 2d83464

File tree

19 files changed

+64
-75
lines changed

19 files changed

+64
-75
lines changed

build_embedded_fonts.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,7 @@ function parseSvgImage(data, filename) {
8989
transform = path.getAttribute('transform');
9090
}
9191

92-
return {
93-
height : height,
94-
width : width,
95-
d : d,
96-
transform : transform
97-
};
92+
return { height, width, d, transform };
9893
}
9994

10095

@@ -151,6 +146,7 @@ _.forEach(args.input_fonts, function (fontDir) {
151146
_.forEach(cfg.glyphs, function (glyph) {
152147

153148
if (configServer.uids[glyph.uid]) {
149+
/*eslint-disable no-console*/
154150
console.log('Duplicated uid "' + glyph.uid + '"in ' + fontDir);
155151
process.exit(1);
156152
}
@@ -225,8 +221,8 @@ _.forEach(configServer.uids, function (glyph) {
225221
});
226222

227223
var svgOut = svgFontTemplate({
228-
font : font,
229-
glyphs : glyphs,
224+
font,
225+
glyphs,
230226
metadata: 'internal font for fontello.com website',
231227
fontHeight : font.ascent - font.descent
232228
});

client/fontello/app/app.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ function updateGlyphCodes() {
103103
}
104104

105105

106-
// Assign actions handlers
106+
// Assign actions handlers
107107
//
108-
N.wire.once('navigate.done', { priority: -10 }, function () {
108+
N.wire.once('navigate.done', { priority: -10 }, function page_setup() {
109109

110110
//
111111
// Setup autosave
@@ -141,11 +141,11 @@ N.wire.once('navigate.done', { priority: -10 }, function () {
141141
// Basic commands
142142
//
143143

144-
N.wire.on('cmd:reset_selected', function () {
144+
N.wire.on('cmd:reset_selected', function reset_selected() {
145145
N.app.fontsList.unselectAll();
146146
});
147147

148-
N.wire.on('cmd:reset_all', function (src) {
148+
N.wire.on('cmd:reset_all', function reset_all(src) {
149149

150150
// is `src` set, then event was produced
151151
// by link click and we need confirmation
@@ -170,26 +170,26 @@ N.wire.once('navigate.done', { priority: -10 }, function () {
170170
N.app.fontsList.unlock();
171171
});
172172

173-
N.wire.on('cmd:toggle_hinting', function () {
173+
N.wire.on('cmd:toggle_hinting', function toggle_hinting() {
174174
N.app.hinting(!N.app.hinting());
175175
});
176176

177-
N.wire.on('cmd:set_encoding_pua', function () {
177+
N.wire.on('cmd:set_encoding_pua', function set_encoding_pua() {
178178
N.app.encoding('pua');
179179
updateGlyphCodes();
180180
});
181181

182-
N.wire.on('cmd:set_encoding_ascii', function () {
182+
N.wire.on('cmd:set_encoding_ascii', function set_encoding_ascii() {
183183
N.app.encoding('ascii');
184184
updateGlyphCodes();
185185
});
186186

187-
N.wire.on('cmd:set_encoding_unicode', function () {
187+
N.wire.on('cmd:set_encoding_unicode', function set_encoding_unicode() {
188188
N.app.encoding('unicode');
189189
updateGlyphCodes();
190190
});
191191

192-
N.wire.on('cmd:clear_custom_icons', function () {
192+
N.wire.on('cmd:clear_custom_icons', function clear_custom_icons() {
193193
var custom_icons = N.app.fontsList.getFont('custom_icons');
194194

195195
// if something selected - delete selected icons

client/fontello/app/import/_svg_image_flatten.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function processTree(node, ignoredTags, ignoredAttrs, parentTransforms, path) {
150150
if (path !== '' && transformedPath !== '') {
151151
guaranteed = false;
152152
}
153-
path = path + transformedPath;
153+
path += transformedPath;
154154

155155
// Check not supported attributes
156156
_.each(item.attributes, function (item) {
@@ -161,12 +161,7 @@ function processTree(node, ignoredTags, ignoredAttrs, parentTransforms, path) {
161161
});
162162
});
163163

164-
return {
165-
path: path,
166-
ignoredTags: ignoredTags,
167-
ignoredAttrs: ignoredAttrs,
168-
guaranteed: guaranteed
169-
};
164+
return { path, ignoredTags, ignoredAttrs, guaranteed };
170165
}
171166

172167
/**
@@ -292,16 +287,16 @@ module.exports = function convert(sourceXml) {
292287
y: 0,
293288
ignoredTags: [],
294289
ignoredAttrs: [],
295-
error: error,
290+
error,
296291
guaranteed: false
297292
};
298293

299294
var xmlDoc = (new XMLDOMParser({
300295
errorHandler: {
301-
error: function (err) {
296+
error(err) {
302297
error = err;
303298
},
304-
fatalError: function (err) {
299+
fatalError(err) {
305300
error = err;
306301
}
307302
}

client/fontello/app/import/import.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function import_config(str, file) {
109109
});
110110
} catch (e) {
111111
N.wire.emit('notify', t('err_bad_config_format', { name: file.name }));
112+
/*eslint-disable no-console*/
112113
console.log(e);
113114
}
114115
}
@@ -205,7 +206,7 @@ function import_svg_font(data/*, file*/) {
205206
search: [ glyphName ],
206207
svg: {
207208
path: d,
208-
width: width
209+
width
209210
}
210211
});
211212
});
@@ -232,6 +233,7 @@ function import_svg_image(data, file) {
232233

233234
if (result.error) {
234235
N.wire.emit('notify', t('err_invalid_format'));
236+
/*eslint-disable no-console*/
235237
console.error(result.error);
236238
return;
237239
}
@@ -243,7 +245,7 @@ function import_svg_image(data, file) {
243245
var skipped = _.union(result.ignoredTags, result.ignoredAttrs);
244246

245247
if (skipped.length > 0) {
246-
N.wire.emit('notify', t('err_skiped_tags', { 'skipped' : skipped.toString() }));
248+
N.wire.emit('notify', t('err_skiped_tags', { skipped: skipped.toString() }));
247249
} else if (!result.guaranteed) {
248250
N.wire.emit('notify', t('err_merge_path'));
249251
}
@@ -266,8 +268,8 @@ function import_svg_image(data, file) {
266268
charRef: allocatedRefCode++,
267269
search: [ glyphName ],
268270
svg: {
269-
path: d,
270-
width: width
271+
path: d,
272+
width
271273
}
272274
});
273275
}
@@ -371,7 +373,7 @@ function handleFileSelect(event) {
371373
////////////////////////////////////////////////////////////////////////////////
372374

373375

374-
N.wire.once('navigate.done', function () {
376+
N.wire.once('navigate.done', function page_setup() {
375377

376378
//
377379
// Create regular files selector
@@ -394,7 +396,7 @@ N.wire.once('navigate.done', function () {
394396
$input.on('change', handleFileSelect);
395397

396398
// handle settings menu click -> open file dialog
397-
N.wire.on('import.start', function () {
399+
N.wire.on('import.start', function open_file_dlg() {
398400
$input.click();
399401
});
400402

@@ -446,7 +448,7 @@ N.wire.once('navigate.done', function () {
446448
//
447449
// Setup import listener
448450
//
449-
N.wire.on('import.obj', function (obj) {
451+
N.wire.on('import.obj', function setup_import(obj) {
450452
N.app.fontsList.lock();
451453

452454
import_config(JSON.stringify(obj), {});

client/fontello/app/session/session.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ N.wire.on('session_save', _.debounce(function () {
145145

146146

147147

148-
N.wire.on('session_load', function () {
148+
N.wire.on('session_load', function session_load() {
149149
var session, data;
150150

151151
if (!store.exists()) { return; }

client/fontello/blocks/codes_editor/codes_editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ N.wire.once('navigate.done', function () {
1717

1818
// Remove glyph from selection
1919
//
20-
N.wire.on('codes_edit:glyph_remove', function (data) {
20+
N.wire.on('codes_edit:glyph_remove', function glyph_remove(data) {
2121
var $el = data.$this;
2222
var id = $el.data('id');
2323
var glyph = N.app.fontsList.getGlyph(id);

client/fontello/blocks/names_editor/names_editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ N.wire.once('navigate.done', function () {
2424

2525
// Remove glyph from selection
2626
//
27-
N.wire.on('names_edit:glyph_remove', function (data) {
27+
N.wire.on('names_edit:glyph_remove', function glyph_remove(data) {
2828
var $el = data.$this;
2929
var id = $el.data('id');
3030
var glyph = N.app.fontsList.getGlyph(id);

client/fontello/blocks/selector/selector.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ N.wire.once('navigate.done', function () {
2525
$('#selector').selectable({
2626
filter: '.selector__glyph:visible',
2727
distance: 3,
28-
start: function () {
28+
start() {
2929
$('#selector').addClass('_multicursor');
3030
},
31-
stop: function () {
31+
stop() {
3232
var $els = $view.find('.selector__glyph.ui-selected');
3333

3434
// prevent from double-triggering event,
@@ -65,7 +65,7 @@ N.wire.once('navigate.done', function () {
6565

6666
// Toggle glyph state on click
6767
//
68-
N.wire.on('selector:glyph_toggle', function (data) {
68+
N.wire.on('selector:glyph_toggle', function glyph_toggle(data) {
6969
var id = data.$this.data('id');
7070
var glyph = N.app.fontsList.getGlyph(id);
7171

@@ -74,7 +74,7 @@ N.wire.once('navigate.done', function () {
7474

7575
// Toggle font collapse state on click
7676
//
77-
N.wire.on('selector:font_collapse', function (data) {
77+
N.wire.on('selector:font_collapse', function font_collapse(data) {
7878
var id = data.$this.data('id');
7979
var font = N.app.fontsList.getFont(id);
8080

client/fontello/blocks/toolbar/toolbar.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ N.wire.once('navigate.done', function (data) {
117117
//
118118
// Save on button press
119119
//
120-
N.wire.on('api.update', function () {
120+
N.wire.on('api.update', function api_save() {
121121
return save();
122122
});
123123

124124
//
125125
// Export on button press (save & go to pingback url)
126126
//
127-
N.wire.on('api.export', function () {
127+
N.wire.on('api.export', function api_export() {
128128
return save().then(() => {
129129
window.location = N.app.apiUrl();
130130
});
@@ -133,7 +133,7 @@ N.wire.once('navigate.done', function (data) {
133133
//
134134
// build font on button press
135135
//
136-
N.wire.on('build_font', function () {
136+
N.wire.on('build_font', function build_font() {
137137
// That should not happen, but check for safety
138138
if (!N.app.fontsList.selectedCount()) {
139139
return;
@@ -159,10 +159,10 @@ N.wire.once('navigate.done', function (data) {
159159

160160
// inject download url via iframe to start download
161161
var id = res.id; // generated file id
162-
var url = N.router.linkTo('fontello.font.download', { id: id });
162+
var url = N.router.linkTo('fontello.font.download', { id });
163163
$('iframe#' + id).remove();
164164
$('<iframe></iframe>')
165-
.attr({ id: id, src: url })
165+
.attr({ id, src: url })
166166
.css('display', 'none')
167167
.appendTo(window.document.body);
168168
});

client/fontello/layout/layout.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
// Reassign tooltip handler
55
// after every significant page render
66
//
7-
N.wire.after('navigate.done', function () {
7+
N.wire.after('navigate.done', function reassign_tooltip_handler() {
88
$('._tip').tooltip();
99
$('._popover').popover();
1010
});
1111

1212

1313
// Social buttons defered load - after all
1414
//
15-
N.wire.once('navigate.done', { priority: 10 }, function () {
15+
N.wire.once('navigate.done', { priority: 10 }, function load_social_buttons() {
1616
setTimeout(function () {
1717
function injectScript(src, async, id) {
1818
var el, script;

client/fontello/models/_lib/codes_tracker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,5 @@ function observe(glyph) {
213213

214214
module.exports = function (_N) {
215215
N = _N;
216-
return { observe: observe };
216+
return { observe };
217217
};

client/fontello/models/_lib/fontface.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = function (svg, fontId) {
1414
var ttf = svg2ttf(svg, {}).buffer;
1515
var fontInfo = {
1616
ttfDataUri : 'data:font/truetype;base64,' + b64.fromByteArray(ttf),
17-
fontId : fontId
17+
fontId
1818
};
1919

2020
var fontfaceTemplate =

client/fontello/models/models.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ N.wire.once('navigate.done', { priority: -100 }, function () {
122122
// code value as character (for code editor)
123123
//
124124
this.customChar = ko.computed({
125-
read: function () {
125+
read() {
126126
return utils.fixedFromCharCode(this.code());
127127
},
128-
write: function (value) {
128+
write(value) {
129129
this.code(utils.fixedCharCodeAt(value));
130130
},
131131
owner: this
@@ -134,11 +134,11 @@ N.wire.once('navigate.done', { priority: -100 }, function () {
134134
// code value as hex-string (for code editor)
135135
//
136136
this.customHex = ko.computed({
137-
read: function () {
137+
read() {
138138
var code = this.code().toString(16).toUpperCase();
139139
return '0000'.substr(0, Math.max(4 - code.length, 0)) + code;
140140
},
141-
write: function (value) {
141+
write(value) {
142142
// value must be HEX string - omit invalid chars
143143
value = 0 + value.replace(/[^0-9a-fA-F]+/g, '');
144144
this.code(parseInt(value, 16));

server/fontello/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = function (N, apiPath) {
4747
if (!sl) {
4848
callback({
4949
code: N.io.REDIRECT,
50-
head: { 'Location': '/' }
50+
head: { Location: '/' }
5151
});
5252
return;
5353
}

0 commit comments

Comments
 (0)