Skip to content

Commit 93d7560

Browse files
author
Bryan Donovan
committed
upgrading jshint/jscs to eslint; istanbul to nyc
1 parent 1682063 commit 93d7560

19 files changed

+3635
-358
lines changed

Diff for: .eslintrc

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"browser": false,
5+
"node": true,
6+
"mocha": true
7+
},
8+
9+
"parserOptions": {
10+
"ecmaVersion": 2017
11+
},
12+
13+
"rules": {
14+
"array-bracket-spacing": ["error", "never"],
15+
"indent": ["error", 4, {"SwitchCase": 1}],
16+
"comma-dangle": ["error", "never"],
17+
"no-dupe-keys": "error",
18+
"no-mixed-requires": [0, false],
19+
"no-empty": "error",
20+
"no-unreachable": "error",
21+
"no-extra-bind": "error",
22+
"no-multi-spaces": "error",
23+
"no-redeclare": "error",
24+
"no-undef": "error",
25+
"no-unused-vars": "error",
26+
"no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0, "maxBOF": 0}],
27+
"one-var": ["error", "never"],
28+
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
29+
"object-curly-spacing": ["error", "never"],
30+
"space-before-function-paren": ["error", {
31+
"anonymous": "never",
32+
"named": "never",
33+
"asyncArrow": "always"
34+
}],
35+
"space-before-blocks": "error",
36+
"keyword-spacing": "error",
37+
"arrow-parens": ["error", "as-needed"],
38+
"space-in-parens": ["error", "never"],
39+
"space-infix-ops": ["error", {"int32Hint": false}],
40+
"block-spacing": "error",
41+
"comma-spacing": ["error", {"before": false, "after": true}],
42+
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
43+
"no-trailing-spaces": "error",
44+
"operator-linebreak": ["error", "after"],
45+
"no-unneeded-ternary": "error",
46+
"strict": [0, "global"],
47+
"semi": [2, "always"],
48+
"no-extra-semi": "error",
49+
"curly": "error",
50+
"no-bitwise": 1,
51+
"max-len": ["error", 140, 4],
52+
"vars-on-top": 0,
53+
"guard-for-in": 1
54+
},
55+
56+
"globals": {
57+
"main": "true",
58+
"require": "true",
59+
"module": "true"
60+
}
61+
}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
coverage
3+
.nyc_output
34
.idea
45
*.iml
56
out

Diff for: .jscs.json

-106
This file was deleted.

Diff for: .jshintrc

-87
This file was deleted.

Diff for: .nycrc.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"check-coverage": true,
3+
"lines": 95,
4+
"statements": 95,
5+
"functions": 95,
6+
"branches": 75,
7+
"include": [
8+
"lib/**/*.js"
9+
],
10+
"exclude": [
11+
"**/datamigration/**",
12+
"**/new-schema-migration/**"
13+
],
14+
"reporter": [
15+
"lcov",
16+
"text"
17+
],
18+
"cache": true,
19+
"all": true
20+
}

Diff for: .travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ node_js:
66
script: 'make test-travis'
77
branches:
88
only:
9+
- feature/fix-npm-vulnerabilities
910
- master

Diff for: Makefile

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
BASE = .
22

3-
ISTANBUL = ./node_modules/.bin/istanbul
3+
NYC = ./node_modules/.bin/nyc
44
COVERAGE_OPTS = --lines 99 --statements 95 --branches 90 --functions 95
55

66
main: lint test docs
77

88
cover:
9-
$(ISTANBUL) cover test/run.js
9+
$(NYC) test/run.js
1010

1111
check-coverage:
12-
$(ISTANBUL) check-coverage $(COVERAGE_OPTS)
12+
$(NYC) check-coverage $(COVERAGE_OPTS)
1313

1414
test: cover check-coverage
1515

@@ -18,15 +18,12 @@ test-cov: cover check-coverage
1818
open coverage/lcov-report/index.html
1919

2020
test-travis: lint
21-
./node_modules/.bin/istanbul cover test/run.js --report lcovonly \
21+
./node_modules/.bin/nyc test/run.js --report lcovonly \
2222
-- -T unit,functional -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
2323
lint:
24-
./node_modules/.bin/jscs ./lib && \
25-
./node_modules/.bin/jscs ./test && \
26-
./node_modules/.bin/jscs ./examples && \
27-
./node_modules/.bin/jshint ./lib --config $(BASE)/.jshintrc && \
28-
./node_modules/.bin/jshint ./test --config $(BASE)/.jshintrc && \
29-
./node_modules/.bin/jshint ./examples --config $(BASE)/.jshintrc
24+
./node_modules/.bin/eslint ./lib && \
25+
./node_modules/.bin/eslint ./test && \
26+
./node_modules/.bin/eslint ./examples
3027

3128
docs:
3229
./node_modules/.bin/jsdoc lib --recurse --readme README.md --package package.json

Diff for: examples/example.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var cacheManager = require('../');
44
var memoryCache = cacheManager.caching({store: 'memory', max: 100, ttl: 10});
55
var memoryCache2 = cacheManager.caching({store: 'memory', max: 100, ttl: 100});
6-
var ttl; //Can't use a different ttl per set() call with memory cache
76

87
//
98
// Basic usage
@@ -36,7 +35,8 @@ var key = 'user_' + userId;
3635
// wrap() example
3736
//
3837

39-
// Instead of manually managing the cache like this:
38+
/**
39+
Instead of manually managing the cache like this:
4040
function getCachedUserManually(id, cb) {
4141
memoryCache.get(id, function(err, result) {
4242
if (err) { return cb(err); }
@@ -52,6 +52,7 @@ function getCachedUserManually(id, cb) {
5252
});
5353
});
5454
}
55+
*/
5556

5657
// ... you can instead use the `wrap` function:
5758
function getCachedUser(id, cb) {

Diff for: lib/multi_caching.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,11 @@ var multiCaching = function(caches, options) {
309309
return new Promise(function(resolve, reject) {
310310
self.wrap(key, function(cb) {
311311
Promise.resolve()
312-
.then(promise)
313-
.then(function(result) {
314-
cb(null, result);
315-
})
316-
.catch(cb);
312+
.then(promise)
313+
.then(function(result) {
314+
cb(null, result);
315+
})
316+
.catch(cb);
317317
}, options, function(err, result) {
318318
if (err) {
319319
return reject(err);

Diff for: lib/stores/memory.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*eslint no-unused-vars:0*/
12
var Lru = require("lru-cache");
23
var deepmerge = require('deepmerge');
34
var utils = require('../utils');
@@ -15,7 +16,7 @@ var memoryStore = function(args) {
1516
var self = {};
1617
self.name = 'memory';
1718
var Promise = args.promiseDependency || global.Promise;
18-
self.usePromises = (typeof Promise === 'undefined' || args.noPromises) ? false : true;
19+
self.usePromises = !((typeof Promise === 'undefined' || args.noPromises));
1920

2021
var ttl = args.ttl;
2122
var lruOpts = {

0 commit comments

Comments
 (0)