From 642f7541698fa1caca1398a8f806ed97a579f0fe Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 4 Feb 2016 10:54:41 +0700 Subject: [PATCH] Add more files to linting, make strict mode optional for each file --- .jshintrc | 2 -- Gruntfile.js | 30 +++++++----------------------- src/crypto/cipher/twofish.js | 2 -- src/crypto/hash/index.js | 2 +- src/crypto/hash/sha.js | 2 -- src/packet/packetlist.js | 7 +++++-- 6 files changed, 13 insertions(+), 32 deletions(-) diff --git a/.jshintrc b/.jshintrc index 048a1b12..12cfa4d4 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,6 +1,4 @@ { - "strict": true, - "globalstrict": true, "node": true, "browser": true, "nonew": true, diff --git a/Gruntfile.js b/Gruntfile.js index ffe6ff19..775c0ece 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,40 +3,24 @@ module.exports = function(grunt) { var lintFiles = [ - 'src/config/*.js', + 'src/config/**/*.js', 'src/crypto/cipher/aes.js', 'src/crypto/cipher/blowfish.js', 'src/crypto/cipher/cast5.js', 'src/crypto/cipher/des.js', 'src/crypto/cipher/index.js', + 'src/crypto/hash/index.js', 'src/crypto/hash/md5.js', 'src/crypto/public_key/dsa.js', 'src/crypto/public_key/elgamal.js', 'src/crypto/public_key/index.js', 'src/crypto/public_key/rsa.js', 'src/crypto/*.js', - 'src/encoding/*.js', - 'src/hkp/*.js', - 'src/keyring/*.js', - 'src/packet/all_packets.js', - 'src/packet/compressed.js', - 'src/packet/index.js', - 'src/packet/literal.js', - 'src/packet/marker.js', - 'src/packet/one_pass_signature.js', - 'src/packet/packet.js', - 'src/packet/public_key.js', - 'src/packet/public_key_encrypted_session_key.js', - 'src/packet/public_subkey.js', - 'src/packet/secret_key.js', - 'src/packet/secret_subkey.js', - 'src/packet/sym_encrypted_integrity_protected.js', - 'src/packet/sym_encrypted_session_key.js', - 'src/packet/symmetrically_encrypted.js', - 'src/packet/trust.js', - 'src/packet/user_attribute.js', - 'src/packet/userid.js', - 'src/type/*.js', + 'src/encoding/**/*.js', + 'src/hkp/**/*.js', + 'src/keyring/**/*.js', + 'src/packet/**/*.jss', + 'src/type/**/*.js', 'src/worker/async_proxy.js', 'src/*.js', ]; // add more over time ... goal should be 100% coverage diff --git a/src/crypto/cipher/twofish.js b/src/crypto/cipher/twofish.js index 8d4bd9c0..c7d6e90d 100644 --- a/src/crypto/cipher/twofish.js +++ b/src/crypto/cipher/twofish.js @@ -22,8 +22,6 @@ * @module crypto/cipher/twofish */ -'use strict'; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Math //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/crypto/hash/index.js b/src/crypto/hash/index.js index c886c95e..c092c286 100644 --- a/src/crypto/hash/index.js +++ b/src/crypto/hash/index.js @@ -19,7 +19,7 @@ function node_hash(type) { var shasum = nodeCrypto.createHash(type); shasum.update(new Buffer(data)); return new Uint8Array(shasum.digest()); - } + }; } var hash_fns; diff --git a/src/crypto/hash/sha.js b/src/crypto/hash/sha.js index a936c5a4..e9d4b13e 100644 --- a/src/crypto/hash/sha.js +++ b/src/crypto/hash/sha.js @@ -19,8 +19,6 @@ * 1 = SHA-1, 2 = SHA-224/SHA-256, 4 = SHA-384/SHA-512 */ -var util = require('../../util.js'); - var SUPPORTED_ALGS = 4 | 2 | 1; (function (global) diff --git a/src/packet/packetlist.js b/src/packet/packetlist.js index 0e515936..9d810cbe 100644 --- a/src/packet/packetlist.js +++ b/src/packet/packetlist.js @@ -103,8 +103,9 @@ Packetlist.prototype.filterByTag = function () { var filtered = new Packetlist(); var that = this; + function handle(packetType) {return that[i].tag === packetType;} for (var i = 0; i < this.length; i++) { - if (args.some(function(packetType) {return that[i].tag === packetType;})) { + if (args.some(handle)) { filtered.push(this[i]); } } @@ -151,8 +152,10 @@ Packetlist.prototype.indexOfTag = function () { var args = Array.prototype.slice.call(arguments); var tagIndex = []; var that = this; + + function handle(packetType) {return that[i].tag === packetType;} for (var i = 0; i < this.length; i++) { - if (args.some(function(packetType) {return that[i].tag == packetType;})) { + if (args.some(handle)) { tagIndex.push(i); } }