From 07dd310ad8e278928bd583aed7a7003d7cd4a5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Wed, 15 Mar 2017 14:39:56 +0100 Subject: [PATCH] Added ESLint rules. --- index.js | 11 ----------- package.json | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 8b2b6d1..00465c4 100644 --- a/index.js +++ b/index.js @@ -68,7 +68,6 @@ const querystring = require('querystring'); * @return {function} * @api public */ - function ConManager(baseurl, token_name) { this._request = (method, endpoint, data) => { let headers = { 'Content-Type': 'application/json' }; @@ -207,7 +206,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.uploadStream = (rstream, cmpath, upload_type) => { let filename = path.basename(cmpath); let subfolder = path.dirname(cmpath); @@ -333,7 +331,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.upload = (file, cmpath, upload_type) => { let f = fs.createReadStream(file); @@ -350,7 +347,6 @@ function ConManager(baseurl, token_name) { * @return {stream.Readable} * @api public */ - this.downloadStream = (cmpath) => { let headers = {}; let urlpath = url.parse(url.resolve(this._rooturl, cmpath.startsWith('/') ? cmpath.slice(1): cmpath)); @@ -398,7 +394,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.download = (cmpath, file) => { return new Promise((resolve, reject) => { let f = fs.createWriteStream(file).on('error', reject); @@ -421,7 +416,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.login = (username, password) => { let p = Promise.resolve(false); @@ -477,7 +471,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.get = this._request.bind(this, 'GET'); /** @@ -488,7 +481,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.post = this._request.bind(this, 'POST'); /** @@ -499,7 +491,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.put = this._request.bind(this, 'PUT'); /** @@ -510,7 +501,6 @@ function ConManager(baseurl, token_name) { * @return {Promise} * @api public */ - this.delete = this._request.bind(this, 'DELETE'); this._rooturl = baseurl.endsWith('/') ? baseurl : `${baseurl}/`; @@ -522,7 +512,6 @@ function ConManager(baseurl, token_name) { * Cached login response object. * @public */ - this.login_response = {}; } diff --git a/package.json b/package.json index 430cc16..50ab24c 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,60 @@ }, "dependencies": { "debug": "^2.2.0" + }, + "devDependencies": { + "eslint": "^3.17.1" + }, + "scripts": { + "lint": "eslint index.js" + }, + "eslintConfig": { + "env": { + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "rules": { + "dot-notation": "error", + "indent": [ + "error", + 4 + ], + "no-unused-vars": [ + "error", + { + "args": "none" + } + ], + "no-var": "error", + "prefer-arrow-callback": "warn", + "prefer-template": "warn", + "quote-props": [ + "error", + "always" + ], + "require-jsdoc": [ + "warn", + { + "require": { + "FunctionDeclaration": true, + "MethodDefinition": true, + "ClassDeclaration": true, + "ArrowFunctionExpression": true + } + } + ], + "semi": [ + "error", + "always" + ], + "valid-jsdoc": [ + "error", + { + "requireParamDescription": false, + "requireReturnDescription": false + } + ] + } } }