Skip to content

Commit

Permalink
eslint: fix all eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jamsyoung committed Feb 17, 2016
1 parent 90cc52f commit 5ca530b
Show file tree
Hide file tree
Showing 23 changed files with 642 additions and 512 deletions.
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

; Refer to the README for setup instructions

root = true

[*]
Expand Down
6 changes: 4 additions & 2 deletions .esdoc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"title": "CNN Hapi",
"title": "CNN Metrics",
"source": "./",
"destination": "./docs",
"excludes": ["docs", "node_modules"],
"access": ["public", "protected", "private"],
"coverage": false,
"includeSource": false,
"manual": {
"changelog": "./CHANGELOG.md"
"changelog": ["./CHANGELOG.md"]
}
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
./docs
./node-modules
.npm-init.js
26 changes: 12 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": [2, "never"],
"arrow-parens": [2, "always"],
Expand All @@ -8,28 +17,17 @@
"curly": [2, "all"],
"indent": [2, 4, {"SwitchCase": 1, "VariableDeclarator": 1}],
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"keyword-spacing": 2,
"linebreak-style": [2, "unix"],
"no-console": 0,
"object-curly-spacing": [2, "never"],
"one-var": [2, "always"],
"prefer-template": 2,
"quote-props": [2, "as-needed"],
"quotes": [2, "single"],
"semi": [2, "always"],
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-before-keywords": [2, "always"],
"space-infix-ops": [2, {"int32Hint": false}]
},
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"modules": true
},
"plugins": [
]
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.c9
docs
node_modules
.idea/touc
npm-debug.log
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
init-module=.npm-init.js
save-exact=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.6
4.3.1
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# CNN Hapi Changelog
# CNN Metrics Changelog

0.1.x - Initial versions - changes too numerous to list
88 changes: 77 additions & 11 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
- [Accepting Modifications](#accepting-modifications)
- [Involving the PO/TC](#involving-the-potc)
- [Landing Pull Requests](#landing-pull-requests)
- [Technical HOWTO](#technical-howto)
- [Summarized Technical HOWTO](#summarized-technical-howto)
- [Detailed Technical HOWTO](#detailed-technical-howto)
- [I've made a huge mistake](#ive-made-a-huge-mistake)
- [Creating a Release](#creating-a-release)

This document contains information for Collaborators of this project regarding
maintaining the code, documentation and issues. This is almost exactly the same
as the [node.js Collaborator Guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md)
with changes to be a bit more generic and apply to projects with a single
Project Owner (PO) versus a Technical Committee (TC).
as the [Node.js Collaborator Guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md)
with changes to better fit our needs.

Collaborators should be familiar with the guidelines for new contributors in
[CONTRIBUTING.md](./CONTRIBUTING.md) and also understand the project governance
Expand Down Expand Up @@ -65,10 +66,7 @@ If you are unsure about the modification and are not prepared to take full
responsibility for the change, defer to another Collaborator.

Before landing pull requests, sufficient time should be left for input from
other Collaborators. Leave at least 48 hours during the week and 72 hours over
weekends to account for time differences and work schedules. Trivial changes
(e.g. those which fix minor bugs or improve performance without affecting API or
causing other wide-reaching inpact) may be landed after a shorter delay.
other Collaborators. Trivial changes may be landed after a shorter delay.

Where this is no disagreement amongst Collaborators, a pull request may be
landed given appropriate review. Where there is discussion amongst
Expand Down Expand Up @@ -128,9 +126,29 @@ Additionally:
bisecting to find a breaking change.


### Technical HOWTO
### Summarized Technical HOWTO

_Optional:_ ensure that you are not in a borked `am`/`rebase` state
The Detailed Technical HOWTO above covers all the bases. You rarely need to do
many of those steps though. Here is a summary for the typical landing of a PR.

```shell
$ git checkout develop
$ git fetch -p; git pull origin develop
$ curl -L $ curl -L https://patch-diff.githubusercontent.com/raw/ORG_NAME/REPO_NAME/pull/171.patch?token=VALID_TOKEN | git am -3
$ git rebase -i origin/develop

... squash all commits except for the first one ...

$ git push origin develop
```

If you run into any problem, do a `git rebase --abort` and click the _**Merge**_
button on the PR.


### Detailed Technical HOWTO

Ensure that you are not in a borked `am`/`rebase` state.

```shell
$ git am --abort
Expand All @@ -155,7 +173,7 @@ add `.patch` to the end of the URL and hit return. It will redirect to a patch
of the changes. Copy that URL and use it below.

```shell
$ curl -L https://patch-diff.githubusercontent.com/raw/TurnerBroadcasting/hapi-boilerplate/pull/171.patch?token=AApgjpIXve_Vup5y7nuYPhg94APftqplks5VjxMjwA%3D%3D | git am --whitespace=fix
$ curl -L https://patch-diff.githubusercontent.com/raw/ORG_NAME/REPO_NAME/pull/PR_NUMBER.patch?token=VALID_TOKEN | git am -3
```

Check and re-review the changes, they should match exactly what is in the pull
Expand Down Expand Up @@ -250,3 +268,51 @@ allowed for simpler slip-ups such as typos in commit messages. However, you are
only allowed to force push to any projects branch within 10 minutes from your
original push. If someone else pushes to the branch or the 10 minute period
passes, consider the commit final.


## Creating a Release

Creating a release basically means bumping the package.json version number,
generating the changelog, and merging the code into the master branch, which
will generate a build that can be deployed to any environment, including
production.

```shell
$ git checkout develop
$ git fetch -p; git pull origin develop
$ jq .version package.json
0.29.0
$ git checkout -b release/0.30.0
$ vim package.json

... update the version from 0.29.0 to 0.30.0 in package.json ...

$ npm run generate-changelog

> REPO_NAME@0.29.0 generate-changelog /Users/jyoung/dev/REPO_NAME
> changelog-maker --group

* [[`47d94cbca5`](https://github.com/ORG_NAME/REPO_NAME/commit/47d94cbca5)] - update candidate info (AUTHOR)

... copy the commit lines, they start with * ...

$ vim CHANGELOG.md

... update the changelog, follow the conventions of previous entries, including spacing and capitalization ...

$ git commit -am 0.30.0
$ git checkout master
$ git merge release/0.30.0
$ git push origin master
$ git tag v0.30.0
$ git push origin v0.30.0
$ git checkout develop
$ git merge master
$ git push origin develop
```

Copy the CHANGELOG.md entry you made earlier. Add the release notes to GitHub.
Goto https://github.com/ORG_NAME/REPO_NAME/tags and click
_**Add Release Notes**_ next to the tag that was pushed up earlier.

Publish the released version to npm.
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ This document will guide you though the contribution process.
Fork the project and check out your copy locally.

```shell
$ git clone git@github.com:your-github-username/repo-name.git
$ cd repo-name
$ git remote add upstream git@github.com:TurnerBroadcasting/repo-name.git
$ git clone git@github.com:ORG_NAME/REPO_NAME.git
$ cd REPO_NAME
$ git remote add upstream git@github.com:ORG_NAME/REPO_NAME.git
```


Expand All @@ -51,7 +51,7 @@ Make sure git knows your _correct_ name and email address:

```shell
$ git config --global user.name "Your Name"
$ git config --global user.email "your.email@turner.com"
$ git config --global user.email "your.email@somewhere.com"
```

A commit log should describe what changed and why. Follow these guidelines when
Expand Down Expand Up @@ -90,7 +90,7 @@ The body can be several paragraphs. Try to limit the line length to around 72
characters or so.
Fixes: #12
Reviewed-By: Your Name <your.email@turner.com>
Reviewed-By: Your Name <your.email@somewhere.com>
```


Expand Down Expand Up @@ -118,7 +118,7 @@ on how to run the tests.
$ git push origin my-feature-branch
```

Go to https://github.com/yourusername/repo-name and select your feature
Go to https://github.com/yourusername/hapi-boilerplate and select your feature
branch. Click the 'Pull Request' button and fill out the form.

Pull requests are usually reviewed within a few days. If there are comments to
Expand Down
5 changes: 1 addition & 4 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ the entire project.

The PO has final authority over this project.

For the current PO, see the project [README.md](./README.md#project-owner).
For the current PO, see the project README.md.


## Collaborators
Expand Down Expand Up @@ -37,9 +37,6 @@ or modifications that have not found consensus to the PO for discussion by
assigning the ***po-review*** tag to a pull request or issue. The PO should
serve as the final arbiter where required.

For the current list of Collaborators, see the project
[README.md](./README.md#current-project-team-members).

A guide for Collaborators is maintained in
[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md).

Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# CNN Metrics


## Requirements

A current LTS or Stable version of [Node.js](https://nodejs.org). We recommend
Expand All @@ -22,8 +23,14 @@ See the [`example/`](./example) directory.

This package requires a few environment variable to be set.

- `NODE_ENV`:
- `NODE_ENV`

- `ENVIRONMENT`

- `HOSTEDGRAPHITE_APIKEY`

- `NODE_APP_INSTANCE`

- `ENVIRONMENT`:
- `REGION`

- `HOSTEDGRAPHITE_APIKEY`:
- `DEBUGMETRICS`
17 changes: 11 additions & 6 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
var Metrics = require('../lib/metrics');
'use strict';

const Metrics = require('../lib/metrics');


Metrics.init({ app: 'example', flushEvery: 200000, plugins:['customCounters']});
Metrics.init({
app: 'example',
flushEvery: 1000 * 20,
plugins: [
'customCounters'
]
});

console.log('Start');


setInterval(()=>{
setInterval(() => {
console.log('count');
Metrics.count('example.counter');
},4000);
}, 1000 * 4);
Loading

0 comments on commit 5ca530b

Please sign in to comment.