Browse Source

fix linter warnings

pull/225/head
butlerx 5 years ago
parent
commit
4f4d75f0e7
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 5
      .eslintrc.js
  2. 2
      .github/workflows/publish.yml
  3. 2
      package.json
  4. 15
      src/client/download.ts
  5. 8
      src/client/index.ts

5
.eslintrc.js

@ -21,6 +21,11 @@ module.exports = {
'no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'import/prefer-default-export': 'off',
'lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true },
],
'import/extensions': [
'error',
'always',

2
.github/workflows/publish.yml

@ -21,6 +21,8 @@ jobs:
run: yarn lint
- run: yarn build
name: Compile Typescript
- run: yarn test
name: Run tests
- name: Publish
uses: mikeal/merge-release@master
env:

2
package.json

@ -1,6 +1,6 @@
{
"name": "wetty",
"version": "1.2.2",
"version": "1.2.3",
"description": "WeTTY = Web + TTY. Terminal access in browser over http/https",
"homepage": "https://github.com/butlerx/wetty",
"repository": {

15
src/client/download.ts

@ -2,8 +2,14 @@ const DEFAULT_FILE_BEGIN = '\u001b[5i';
const DEFAULT_FILE_END = '\u001b[4i';
export class FileDownloader {
fileBuffer: string[];
fileBegin: string;
fileEnd: string;
partialFileBegin: string;
onCompleteFileCallback: Function;
constructor(
onCompleteFileCallback: (file: string) => any,
onCompleteFileCallback: (file: string) => void,
fileBegin: string = DEFAULT_FILE_BEGIN,
fileEnd: string = DEFAULT_FILE_END
) {
@ -87,10 +93,13 @@ export class FileDownloader {
) {
return data;
}
return data.split('').map(this.bufferCharacter.bind(this)).join('')
return data
.split('')
.map(this.bufferCharacter.bind(this))
.join('');
}
onCompleteFile(bufferCharacters: string) {
onCompleteFile(bufferCharacters: string): void {
this.onCompleteFileCallback(bufferCharacters);
}
}

8
src/client/index.ts

@ -1,8 +1,8 @@
import { Terminal } from 'xterm';
import { isNull } from 'lodash';
import { dom, library } from "@fortawesome/fontawesome-svg-core";
import { faCogs } from "@fortawesome/free-solid-svg-icons/faCogs";
import { dom, library } from '@fortawesome/fontawesome-svg-core';
import { faCogs } from '@fortawesome/free-solid-svg-icons/faCogs';
import Toastify from 'toastify-js';
import * as fileType from 'file-type';
import { socket } from './socket';
@ -78,9 +78,7 @@ socket.on('connect', () => {
term.focus();
mobileKeyboard();
const fileDownloader = new FileDownloader(function (
bufferCharacters: string
) {
const fileDownloader = new FileDownloader((bufferCharacters: string) => {
let fileCharacters = bufferCharacters;
// Try to decode it as base64, if it fails we assume it's not base64
try {

Loading…
Cancel
Save