From 5d1cb3c7672330f4dd42fae499ad5c3195ea7297 Mon Sep 17 00:00:00 2001 From: Dan Ristea Date: Sat, 3 Oct 2020 02:11:47 +0100 Subject: [PATCH] Add linting to CI --- .travis.yml | 3 ++- package.json | 3 ++- src/aes/aes.ts | 9 ++++++++- src/pbkdf2/pbkdf2-core.ts | 13 +++++++++---- tslint.json | 3 +++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 67882af..b50b437 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,5 @@ node_js: - '12' - '14' script: - npm test + - npm run lint + - npm test diff --git a/package.json b/package.json index e288a98..3f15951 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,8 @@ "scripts": { "prepare": "node -r esm build.js", "test": "node -r esm build.js && mocha -r esm test/*.js", - "prettier": "prettier --single-quote --trailing-comma all --write \"src/**/*.js\" \"src/**/*.ts\" --print-width 120" + "prettier": "prettier --single-quote --trailing-comma all --write \"src/**/*.js\" \"src/**/*.ts\" --print-width 120", + "lint": "tslint -c tslint.json 'src/**/*.ts'" }, "typings": "./dist_es8/entry-export_all.d.ts", "dependencies": {} diff --git a/src/aes/aes.ts b/src/aes/aes.ts index 758f8f5..3e63b98 100644 --- a/src/aes/aes.ts +++ b/src/aes/aes.ts @@ -10,7 +10,14 @@ export class AES { public pos: number = 0; public len: number = 0; - constructor(key: Uint8Array, iv: Uint8Array | undefined, padding = true, mode: AES_mode, heap?: Uint8Array, asm?: AES_asm) { + constructor( + key: Uint8Array, + iv: Uint8Array | undefined, + padding = true, + mode: AES_mode, + heap?: Uint8Array, + asm?: AES_asm, + ) { this.mode = mode; // The AES "worker" diff --git a/src/pbkdf2/pbkdf2-core.ts b/src/pbkdf2/pbkdf2-core.ts index b714ebf..13cdd39 100644 --- a/src/pbkdf2/pbkdf2-core.ts +++ b/src/pbkdf2/pbkdf2-core.ts @@ -1,8 +1,13 @@ -import { HmacSha1 } from "../hmac/hmac-sha1"; -import { HmacSha256 } from "../hmac/hmac-sha256"; -import { HmacSha512 } from "../hmac/hmac-sha512"; +import { HmacSha1 } from '../hmac/hmac-sha1'; +import { HmacSha256 } from '../hmac/hmac-sha256'; +import { HmacSha512 } from '../hmac/hmac-sha512'; -export function pbkdf2core(hmac: HmacSha1 | HmacSha256 | HmacSha512, salt: Uint8Array, length: number, count: number): Uint8Array { +export function pbkdf2core( + hmac: HmacSha1 | HmacSha256 | HmacSha512, + salt: Uint8Array, + length: number, + count: number, +): Uint8Array { const result = new Uint8Array(length); const blocks = Math.ceil(length / hmac.HMAC_SIZE); diff --git a/tslint.json b/tslint.json index d6b2aa2..4ca138c 100644 --- a/tslint.json +++ b/tslint.json @@ -2,5 +2,8 @@ "extends": ["tslint-plugin-prettier"], "rules": { "prettier": true + }, + "linterOptions": { + "exclude": ["src/**/*.d.ts"] } }