diff --git a/lib/helper/XML.d.ts b/lib/helper/XML.d.ts index 3a17ad7a..f7b268ff 100644 --- a/lib/helper/XML.d.ts +++ b/lib/helper/XML.d.ts @@ -15,8 +15,8 @@ export declare abstract class XML { name: string; attributes: any; elements: any[]; - ele: (name: string, attributes?: any) => any; - add: (element: any) => any; + ele(name: string, attributes?: any): any; + add(element: any): any; eleFn: (name: string, attributes?: any, text?: string) => any; }; } diff --git a/lib/manager/VirtualFSManager.js b/lib/manager/VirtualFSManager.js index bee55be5..d4e99ede 100644 --- a/lib/manager/VirtualFSManager.js +++ b/lib/manager/VirtualFSManager.js @@ -11,7 +11,7 @@ var VirtualFSManager = (function () { return this._instance; }; VirtualFSManager.prototype.serialize = function (resource) { - var obj; + var obj = {}; obj.name = resource.name; if (resource.children) obj.children = resource.children; diff --git a/lib/server/WebDAVServer.js b/lib/server/WebDAVServer.js index 842ff1cb..0ac79a6c 100644 --- a/lib/server/WebDAVServer.js +++ b/lib/server/WebDAVServer.js @@ -123,7 +123,7 @@ var WebDAVServer = (function () { }; WebDAVServer.prototype.stop = function (callback) { if (this.server) { - this.server.close(function () { return callback(); }); + this.server.close(callback); this.server = null; } else diff --git a/lib/server/commands/Put.js b/lib/server/commands/Put.js index c6b865b6..58e81773 100644 --- a/lib/server/commands/Put.js +++ b/lib/server/commands/Put.js @@ -58,10 +58,10 @@ function default_1(arg, callback) { }); } else { - var data = new Buffer(arg.data); + var data_1 = new Buffer(arg.data); if (e) { createResource(arg, callback, function (r) { - r.write(data, function (e) { + r.write(data_1, function (e) { if (e) arg.setCode(WebDAVRequest_1.HTTPCodes.InternalServerError); else @@ -72,7 +72,7 @@ function default_1(arg, callback) { return; } arg.requirePrivilege(['canWrite'], r, function () { - r.write(data, function (e) { + r.write(data_1, function (e) { if (e) arg.setCode(WebDAVRequest_1.HTTPCodes.InternalServerError); else diff --git a/src/helper/XML.ts b/src/helper/XML.ts index d3383f99..8dfc3359 100644 --- a/src/helper/XML.ts +++ b/src/helper/XML.ts @@ -25,11 +25,11 @@ function seekForNS(node : any, parentNS : any) : any function mutateNodeNS(node : any, parentNS = { _default: 'DAV' }) { - var nss = seekForNS(node, parentNS); + const nss = seekForNS(node, parentNS); if(node.name) { - for(var ns in nss) + for(const ns in nss) { if(ns === '_default') continue; @@ -143,16 +143,16 @@ export abstract class XML const result = { type: 'element', - name: name, - attributes: attributes, + name, + attributes, elements: [], - ele: function(name : string, attributes ?: any) + ele(name : string, attributes ?: any) { const el = result.eleFn(name, attributes); result.elements.push(el); return el; }, - add: function(element : any) + add(element : any) { if(element.constructor === String || element.constructor === Number || element.constructor === Boolean) element = { diff --git a/src/manager/VirtualFSManager.ts b/src/manager/VirtualFSManager.ts index 631ac15e..6862cd54 100644 --- a/src/manager/VirtualFSManager.ts +++ b/src/manager/VirtualFSManager.ts @@ -16,11 +16,11 @@ export class VirtualFSManager implements FSManager serialize(resource : any) : object { - let obj : { + const obj : { name, children, content - }; + } = { } as any; obj.name = resource.name; if(resource.children) diff --git a/src/server/WebDAVServer.ts b/src/server/WebDAVServer.ts index 8e7238e5..df71d665 100644 --- a/src/server/WebDAVServer.ts +++ b/src/server/WebDAVServer.ts @@ -179,7 +179,7 @@ export class WebDAVServer { if(this.server) { - this.server.close(() => callback()); + this.server.close(callback); this.server = null; } else diff --git a/src/server/commands/Put.ts b/src/server/commands/Put.ts index e646738c..ede76a4d 100644 --- a/src/server/commands/Put.ts +++ b/src/server/commands/Put.ts @@ -71,7 +71,7 @@ export default function(arg : MethodCallArgs, callback) } else { // Write to a file - var data = new Buffer(arg.data); + const data = new Buffer(arg.data); if(e) { // Resource not found diff --git a/tslint.json b/tslint.json index 12343c6c..cb8c99d8 100644 --- a/tslint.json +++ b/tslint.json @@ -63,7 +63,6 @@ "quotemark": [ true, "single" ], "return-undefined": true, "space-before-function-paren": [true, "never"], - "variable-name": [ true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-trailing-underscore", "allow-snake-case" ], "whitespace": [ true, "check-decl", "check-operator", "check-module", "check-separator", "check-typecast", "check-preblock" ] } } \ No newline at end of file