Browse Source

Make lint happy (sorry cookie monster, nothing for you here :( )

Godzil 5 years ago
parent
commit
2e8de8c5c2
3 changed files with 13 additions and 8 deletions
  1. 2 1
      src/batch.ts
  2. 2 2
      src/config.ts
  3. 9 5
      src/my_request.ts

+ 2 - 1
src/batch.ts

@@ -35,7 +35,8 @@ export default function(args: string[], done: (err?: Error) => void)
     config.pass = undefined;
     my_request.eatCookies(config);
     cfg.save(config);
-    log.info("Unlogged!");
+    log.info('Unlogged!');
+
     process.exit(0);
   }
 

+ 2 - 2
src/config.ts

@@ -3,7 +3,7 @@ import os = require('os');
 import fs = require('fs-extra');
 import path = require('path');
 
-const configFile = path.join(process.cwd(), "config.json");
+const configFile = path.join(process.cwd(), 'config.json');
 
 function fileExist(path: string)
 {
@@ -24,7 +24,7 @@ export function load(): IConfigLine
     const data = fs.readFileSync(configFile, 'utf8');
     return JSON.parse(data);
   }
-  
+
   return {args: undefined};
 }
 

+ 9 - 5
src/my_request.ts

@@ -152,10 +152,12 @@ function checkIfUserIsAuth(config: IConfig, done: (err: Error) => void): void
 function loadCookies(config: IConfig)
 {
   const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
-  if(!fs.existsSync(cookiePath))
+
+  if (!fs.existsSync(cookiePath))
   {
-      fs.closeSync(fs.openSync(cookiePath, 'w'));
+    fs.closeSync(fs.openSync(cookiePath, 'w'));
   }
+
   j = request.jar(new cookieStore(cookiePath));
 }
 
@@ -163,10 +165,11 @@ export function eatCookies(config: IConfig)
 {
   const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
 
-  if(fs.existsSync(cookiePath))
+  if (fs.existsSync(cookiePath))
   {
       fs.removeSync(cookiePath);
   }
+
   j = undefined;
 }
 
@@ -190,6 +193,7 @@ export function get(config: IConfig, options: string|request.Options, done: (err
     cloudscraper.request(modify(options, 'GET'), (error: any, response: any, body: any) =>
     {
       if (error) return done(error);
+
       done(null, typeof body === 'string' ? body : String(body));
     });
   });
@@ -209,14 +213,14 @@ export function post(config: IConfig, options: request.Options, done: (err: Erro
   {
     if (err)
     {
-        return done(err);
+      return done(err);
     }
 
     cloudscraper.request(modify(options, 'POST'), (error: Error, response: any, body: any) =>
     {
       if (error)
       {
-         return done(error);
+        return done(error);
       }
       done(null, typeof body === 'string' ? body : String(body));
     });