Skip to content

Commit 26f900b

Browse files
committed
Fix code according to the ESLint.
1 parent 94e85d0 commit 26f900b

7 files changed

Lines changed: 31 additions & 34 deletions

File tree

builders.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ SchemaBuilderEntity.prototype.required = function(name, fn) {
198198
if (!prop)
199199
throw new Error('Property "{0}" doesn\'t exist in "{1}" schema.'.format(name, self.name));
200200

201-
var is = prop.required;
202-
203201
prop.can = typeof(fn) === 'function' ? fn : null;
204202

205203
if (!prop.required) {

image.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const child = require('child_process');
3131
const exec = child.exec;
3232
const spawn = child.spawn;
3333
const Fs = require('fs');
34-
const REGEXP_SVG = /(width=\"\d+\")+|(height=\"\d+\")+/g;
34+
const REGEXP_SVG = /(width="\d+")+|(height="\d+")+/g;
3535
const REGEXP_PATH = /\//g;
36-
const REGEXP_ESCAPE = /\'/g;
36+
const REGEXP_ESCAPE = /'/g;
3737
const D = require('os').platform().substring(0, 3).toLowerCase() === 'win' ? '"' : '\'';
3838

3939
var CACHE = {};
@@ -366,7 +366,7 @@ Image.prototype.arg = function(first, last) {
366366
arr.push(o.cmd);
367367
else {
368368
arr.push(o.cmd.substring(0, index));
369-
arr.push(o.cmd.substring(index + 1).replace(/\"/g, ''));
369+
arr.push(o.cmd.substring(index + 1).replace(/"/g, ''));
370370
}
371371
}
372372

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@ function Framework() {
698698

699699
this.validators = {
700700
email: new RegExp('^[a-zA-Z0-9-_.+]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'),
701-
url: /^(https?:\/\/(?:www\.|(?!www))[^\s\.#!:\?\+=&@!$'~*,;\/\(\)\[\]]+\.[^\s#!\?\+=&@!$'~*,;\(\)\[\]\\]{2,}\/?|www\.[^\s#!:\.\?\+=&@!$'~*,;\/\(\)\[\]]+\.[^\s#!\?\+=&@!$'~*,;\(\)\[\]\\]{2,}\/?)/i,
702-
phone: /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im,
701+
url: /^(https?:\/\/(?:www\.|(?!www))[^\s.#!:?+=&@!$'~*,;/()[\]]+\.[^\s#!?+=&@!$'~*,;()[\]\\]{2,}\/?|www\.[^\s#!:.?+=&@!$'~*,;/()[\]]+\.[^\s#!?+=&@!$'~*,;()[\]\\]{2,}\/?)/i,
702+
phone: /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/im,
703703
zip: /^\d{5}(?:[-\s]\d{4})?$/,
704704
uid: /^\d{14,}[a-z]{3}[01]{1}$/
705705
};
@@ -1331,7 +1331,7 @@ F.resize = function(url, fn, flags) {
13311331
var flag = flags[i];
13321332
if (flag[0] === '.')
13331333
extensions[flag.substring(1)] = true;
1334-
else if (flag[0] === '~' || flag[0] === '/' || flag.match(/^http\:|https\:/gi))
1334+
else if (flag[0] === '~' || flag[0] === '/' || flag.match(/^http:|https:/gi))
13351335
path = flag;
13361336
else if (flag === 'nocache')
13371337
cache = false;
@@ -1350,7 +1350,7 @@ F.resize = function(url, fn, flags) {
13501350
else if (extensions['jpeg'] && !extensions['jpg'])
13511351
extensions['jpg'] = true;
13521352

1353-
F.routes.resize[url] = { fn: fn, path: U.path(path || url), ishttp: path.match(/http\:|https\:/gi) ? true : false, extension: extensions, cache: cache };
1353+
F.routes.resize[url] = { fn: fn, path: U.path(path || url), ishttp: path.match(/http:|https:/gi) ? true : false, extension: extensions, cache: cache };
13541354
F.owners.push({ type: 'resize', owner: _owner, id: url });
13551355
return F;
13561356
};
@@ -2991,9 +2991,9 @@ F.error = function(err, name, uri) {
29912991
}
29922992

29932993
if (!name && !uri && err.stack) {
2994-
var defer = err.stack.match(/\/\w+\/defer\-.*?\.js/);
2994+
var defer = err.stack.match(/\/\w+\/defer-.*?\.js/);
29952995
if (defer)
2996-
err.stack = err.stack.replace(defer, defer.toString()).replace(/\/\w+\/defer\-/, '/').split('$').join('/');
2996+
err.stack = err.stack.replace(defer, defer.toString()).replace(/\/\w+\/defer-/, '/').split('$').join('/');
29972997
}
29982998

29992999
F.onError(err, name, uri);
@@ -6252,7 +6252,7 @@ F.initialize = function(http, debug, options, restart) {
62526252

62536253
F.isHTTPS = http.STATUS_CODES === undefined;
62546254

6255-
if (isNaN(port) && typeof(port) !== 'string')
6255+
if (isNaN(port) && typeof(port) !== 'string')
62566256
port = null;
62576257

62586258
if (options.id)
@@ -8123,7 +8123,7 @@ F.$configure_workflows = function(arr, clean) {
81238123
line.substring(index + 1).split('-->').forEach(function(operation, index) {
81248124

81258125
var options = 'options||EMPTYOBJECT';
8126-
operation = operation.trim().replace(/\"/g, '\'');
8126+
operation = operation.trim().replace(/"/g, '\'');
81278127

81288128
var oindex = operation.indexOf('{');
81298129
if (oindex !== -1) {
@@ -8228,7 +8228,7 @@ F.$configure_configs = function(arr, rewrite) {
82288228
if (existsSync(configs)) {
82298229
var tmp = Fs.readdirSync(configs);
82308230
for (var i = 0, length = tmp.length; i < length; i++) {
8231-
var skip = tmp[i].match(/\-(debug|release|test)$/i);
8231+
var skip = tmp[i].match(/-(debug|release|test)$/i);
82328232
if (skip) {
82338233
skip = skip[0].toString().toLowerCase();
82348234
if (skip === '-debug' && !F.isDebug)
@@ -8309,7 +8309,7 @@ F.$configure_configs = function(arr, rewrite) {
83098309
break;
83108310
case 'default-image-consumption':
83118311
case 'default-image-quality':
8312-
obj[name] = U.parseInt(value.replace(/\%|\s/g, ''));
8312+
obj[name] = U.parseInt(value.replace(/%|\s/g, ''));
83138313
break;
83148314

83158315
case 'static-accepts-custom':
@@ -11445,7 +11445,7 @@ Controller.prototype.json = function(obj, headers, beautify, replacer) {
1144511445
Controller.prototype.success = function(is, value) {
1144611446
if (is === undefined)
1144711447
is = true;
11448-
return this.json(SUCCESS(is, value))
11448+
return this.json(SUCCESS(is, value));
1144911449
};
1145011450

1145111451
/**

internal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ function minify_javascript(data) {
11221122
var output = [];
11231123
var isCS = false;
11241124
var isCI = false;
1125-
var alpha = /[0-9a-z\$]/i;
1125+
var alpha = /[0-9a-z$]/i;
11261126
var white = /\W/;
11271127
var skip = { '$': true, '_': true };
11281128
var regexp = false;
@@ -1893,7 +1893,7 @@ function view_parse(content, minify, filename, controller) {
18931893
var isMeta = tmp.indexOf('\'meta\'') !== -1;
18941894
var isHead = tmp.indexOf('\'head\'') !== -1;
18951895
var isComponent = tmp.indexOf('\'components\'') !== -1;
1896-
tmp = tmp.replace(/\'(meta|head|components)\'\,/g, '').replace(/(\,\,|\,\)|\s{1,})/g, '');
1896+
tmp = tmp.replace(/'(meta|head|components)',/g, '').replace(/(,,|,\)|\s{1,})/g, '');
18971897
if (isMeta || isHead || isComponent) {
18981898
var tmpimp = '';
18991899
if (isMeta)
@@ -2422,7 +2422,7 @@ function compressView(html, minify) {
24222422

24232423
html = compressHTML(html, minify, false);
24242424

2425-
return html.replace(/\#\@\d+\#/g, function(text) {
2425+
return html.replace(/#@\d+#/g, function(text) {
24262426
return cache[+text.substring(2, text.length - 1)];
24272427
});
24282428
}

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ exports.load = function() {
156156

157157
function logger(fail, name, description) {
158158
var time = Math.floor(Date.now() - T.now) + ' ms';
159-
T.count++
159+
T.count++;
160160
if (fail) {
161161
T.countno++;
162162
T.current.countno++;

utils.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ if (!global.framework_utils)
4545

4646
var regexpSTATIC = /\.\w{2,8}($|\?)+/;
4747
const regexpTRIM = /^[\s]+|[\s]+$/g;
48-
const regexpDATE = /(\d{1,2}\.\d{1,2}\.\d{4})|(\d{4}\-\d{1,2}\-\d{1,2})|(\d{1,2}\:\d{1,2}(\:\d{1,2})?)/g;
48+
const regexpDATE = /(\d{1,2}\.\d{1,2}\.\d{4})|(\d{4}-\d{1,2}-\d{1,2})|(\d{1,2}:\d{1,2}(:\d{1,2})?)/g;
4949
const regexpDATEFORMAT = /yyyy|yy|M+|d+|HH|H|hh|h|mm|m|ss|s|a|ww|w/g;
5050
const regexpSTRINGFORMAT = /\{\d+\}/g;
5151
const regexpPATH = /\\/g;
5252
const regexpTags = /<\/?[^>]+(>|$)/g;
5353
const regexpDiacritics = /[^\u0000-\u007e]/g;
54-
const regexpXML = /\w+\=\".*?\"/g;
54+
const regexpXML = /\w+=".*?"/g;
5555
const regexpDECODE = /&#?[a-z0-9]+;/g;
5656
const regexpPARAM = /\{{2}[^}\n]*\}{2}/g;
57-
const regexpINTEGER = /(^\-|\s-)?[0-9]+/g;
58-
const regexpFLOAT = /(^\-|\s-)?[0-9\.\,]+/g;
57+
const regexpINTEGER = /(^-|\s-)?[0-9]+/g;
58+
const regexpFLOAT = /(^-|\s-)?[0-9.,]+/g;
5959
const regexpALPHA = /^[A-Za-z0-9]+$/;
6060
const regexpSEARCH = /[^a-zA-Zá-žÁ-Ž\d\s:]/g;
61-
const regexpDECRYPT = /\-|\_/g;
61+
const regexpDECRYPT = /-|_/g;
6262
const regexpENCRYPT = /\/|\+/g;
6363
const regexpUNICODE = /\\u([\d\w]{4})/gi;
6464
const regexpTERMINAL = /[\w\S]+/g;
@@ -1868,7 +1868,7 @@ exports.setContentType = function(ext, type) {
18681868
ext = ext.substring(1);
18691869

18701870
if (ext.length > 8) {
1871-
var tmp = regexpSTATIC.toString().replace(/\,\d+\}/, ',' + ext.length + '}').substring(1);
1871+
var tmp = regexpSTATIC.toString().replace(/,\d+\}/, ',' + ext.length + '}').substring(1);
18721872
regexpSTATIC = new RegExp(tmp.substring(0, tmp.length - 1));
18731873
}
18741874

@@ -2681,7 +2681,6 @@ Date.prototype.format = function(format, resource) {
26812681
return datetimeformat[format](this, resource);
26822682

26832683
var key = format;
2684-
var self = this;
26852684
var half = false;
26862685

26872686
if (format && format[0] === '!') {
@@ -3430,7 +3429,7 @@ String.prototype.parseInt2 = function(def) {
34303429

34313430
String.prototype.parseFloat2 = function(def) {
34323431
var num = this.match(regexpFLOAT);
3433-
return num ? +num[0].toString().replace(/\,/g, '.') : def || 0;
3432+
return num ? +num[0].toString().replace(/,/g, '.') : def || 0;
34343433
};
34353434

34363435
String.prototype.parseBool = String.prototype.parseBoolean = function() {
@@ -5451,7 +5450,7 @@ exports.set = function(obj, path, value) {
54515450
break;
54525451
}
54535452

5454-
var fn = (new Function('w', 'a', 'b', builder.join(';') + ';w.' + path.replace(/\'/, '\'') + '=a;return a'));
5453+
var fn = (new Function('w', 'a', 'b', builder.join(';') + ';w.' + path.replace(/'/, '\'') + '=a;return a'));
54555454
F.temporary.other[cachekey] = fn;
54565455
fn(obj, value, path);
54575456
};
@@ -5476,7 +5475,7 @@ exports.get = function(obj, path) {
54765475
builder.push('if(!w.' + p + ')return');
54775476
}
54785477

5479-
var fn = (new Function('w', builder.join(';') + ';return w.' + path.replace(/\'/, '\'')));
5478+
var fn = (new Function('w', builder.join(';') + ';return w.' + path.replace(/'/, '\'')));
54805479
F.temporary.other[cachekey] = fn;
54815480
return fn(obj);
54825481
};

websocketclient.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ WebSocketClient.prototype.connect = function(url, protocol, origin) {
9595

9696
self.req.on('error', function(e) {
9797
self.$events.error && self.emit('error', e);
98-
})
98+
});
9999

100-
self.req.on('response', function(response) {
100+
self.req.on('response', function() {
101101
self.$events.error && self.emit('error', new Error('Unexpected server response.'));
102102
self.free();
103103
});
104104

105-
self.req.on('upgrade', function(response, socket, head) {
105+
self.req.on('upgrade', function(response, socket) {
106106

107107
self.socket = socket;
108108
self.socket.$websocket = self;
@@ -112,7 +112,7 @@ WebSocketClient.prototype.connect = function(url, protocol, origin) {
112112

113113
if (response.headers['sec-websocket-accept'] !== digest) {
114114
socket.destroy();
115-
ws.closed = true;
115+
self.closed = true;
116116
self.$events.error && self.emit('error', new Error('Invalid server key.'));
117117
self.free();
118118
return;

0 commit comments

Comments
 (0)