Skip to content

Commit

Permalink
Configure git hooks, linter config, and cleanup linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nason committed Oct 23, 2016
1 parent 29c7dd6 commit 29d0484
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 236 deletions.
281 changes: 55 additions & 226 deletions .eslintrc

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ node_modules
.npm

# Optional REPL history
.node_repl_history
.node_repl_history

# ESLint Cache
.eslintcache
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,26 @@
"test:node:tdd": "npm run test:node -- --cache --watch",
"test:node:ci": "npm run test:node && nyc report --reporter=text-lcov | coveralls",
"test:bundle:tdd": "npm-run-all -l --parallel 'bundle:* -- --watch'",
"eslint": "eslint src test",
"lint": "eslint --format ./node_modules/eslint-friendly-formatter --cache src test",
"clean": "rimraf dist && mkdirp dist",
"bundle": "npm-run-all -l --parallel bundle:node bundle:browser",
"bundle:node": "rollup -c --environment RUNTIME_ENV:node",
"bundle:browser": "rollup -c --environment RUNTIME_ENV:client",
"start": "npm test && npm run dist",
"dist": "npm run eslint && npm run clean && npm run bundle && npm run docs",
"dist": "npm run lint && npm run clean && npm run bundle && npm run docs",
"docs": "documentation build src/client.js src/node.js --github --format md --output API.md",
"security-scan": "nsp check --output summary --warn-only",
"pretest": "npm run bundle",
"preversion": "npm run dist; git add API.md",
"version": "auto-changelog --template compact --package; git add CHANGELOG.md",
"release": "np"
},
"config": {
"ghooks": {
"pre-commit": "npm run lint",
"pre-push": "npm run security-scan"
}
},
"repository": {
"type": "git",
"url": "git@github.com:wework/we-js-logger.git"
Expand Down Expand Up @@ -82,6 +89,10 @@
"coveralls": "2.11.14",
"documentation": "4.0.0-beta11",
"eslint": "3.8.1",
"eslint-friendly-formatter": "2.0.6",
"eslint-plugin-import": "2.0.1",
"eslint-plugin-mocha": "4.7.0",
"ghooks": "1.3.2",
"imports-loader": "0.6.5",
"json-loader": "0.5.4",
"karma": "1.3.0",
Expand All @@ -96,6 +107,7 @@
"mocha": "3.1.2",
"np": "2.9.0",
"npm-run-all": "3.1.1",
"nsp": "2.6.2",
"nyc": "8.3.1",
"phantomjs-prebuilt": "2.1.13",
"rimraf": "2.5.4",
Expand Down
2 changes: 2 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ function getStreams(config) {
});
}
} else {
/* eslint-disable no-console */
console.warn('Client rollbar is not correctly configured');
/* eslint-enable */
}

// Transport client logs
Expand Down
1 change: 0 additions & 1 deletion src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Rollbar from 'rollbar';
import bunyanFormat from 'bunyan-format';
import ServerRollbarLogger from './util/server/rollbarLogger';
import ServerLogentriesLogger from './util/server/logentriesLogger';
import RollbarLogger from './util/server/rollbarLogger';
import createRequestLogger from './util/server/requestLogger';

/**
Expand Down
1 change: 0 additions & 1 deletion src/util/client/rollbarLogger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import bunyan from 'bunyan';
import omit from 'lodash/omit';
import get from 'lodash/get';
import { bunyanLevelToRollbarLevelName } from '../common/rollbar';
Expand Down
1 change: 0 additions & 1 deletion src/util/server/rollbarLogger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Rollbar from 'rollbar';
import omit from 'lodash/omit';
import isError from 'lodash/isError';
import bunyan from 'bunyan';
import { bunyanLevelToRollbarLevelName } from '../common/rollbar';

/**
Expand Down
19 changes: 19 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"mocha": true
},
"globals": {
"sinon": false,
"expect": false
},
"rules": {
"no-unused-expressions": 0,
"max-len": 0,
"mocha/no-exclusive-tests": 1,
"mocha/handle-done-callback": 1,
"mocha/no-nested-tests": 1
},
"plugins": [
"mocha"
]
}
6 changes: 2 additions & 4 deletions test/specs/logger.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Require the package. For client tests, webpack should resolve to the browser version automatically.
import _ from 'lodash';
import bunyan from 'bunyan';

// Require the package. For client tests, webpack should
// resolve to the browser version automatically.
import Logger from '../../';
import TestLogger from '../testLogger';

Expand Down

0 comments on commit 29d0484

Please # to comment.