Skip to content

Commit

Permalink
adding linters
Browse files Browse the repository at this point in the history
  • Loading branch information
adslaton committed Mar 23, 2016
1 parent 7ebd7ab commit 4a84185
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 33 deletions.
12 changes: 8 additions & 4 deletions .editorconfig
@@ -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 All @@ -13,8 +11,14 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_size = 2
[*.go]
indent_style = tab

[*.md]
trim_trailing_whitespace = false

[bower.json]
indent_size = 2

[package.json]
indent_size = 2
12 changes: 12 additions & 0 deletions .esdoc.json
@@ -0,0 +1,12 @@
{
"title": "CNN Hapi",
"source": "./",
"destination": "./docs",
"excludes": ["docs", "node_modules"],
"access": ["public", "protected", "private"],
"coverage": false,
"includeSource": false,
"manual": {
"changelog": ["./CHANGELOG.md"]
}
}
4 changes: 4 additions & 0 deletions .eslintignore
@@ -0,0 +1,4 @@
./docs
./node_modules
.npm-init.js

34 changes: 34 additions & 0 deletions .eslintrc
@@ -0,0 +1,34 @@
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": [2, "never"],
"arrow-parens": [2, "always"],
"arrow-spacing": [2, {"before": true, "after": true}],
"brace-style": [2, "1tbs", {"allowSingleLine": false}],
"comma-spacing": [2, {"before": false, "after": true}],
"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,
"no-trailing-spaces": 2,
"object-curly-spacing": [2, "never"],
"one-var": [2, "always"],
"prefer-template": 2,
"quote-props": [2, "as-needed"],
"quotes": [2, "single"],
"semi": [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-infix-ops": [2, {"int32Hint": false}]
}
}
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules
node_modules
.c9
2 changes: 2 additions & 0 deletions .npmrc
@@ -0,0 +1,2 @@
init-module=.npm-init.js
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
5.6.0
6 changes: 6 additions & 0 deletions .travis.yml
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "4.2"
- "4.3"
- "5.5"
- "5.6"
10 changes: 10 additions & 0 deletions AUTHORS.md
@@ -0,0 +1,10 @@
# Authors ordered by first contribution.

Mathias Pettersson <mape@mape.me>
Robert Sköld <robert@publicclass.se>
Wilson Wise <wilson.wise@turner.com>
Wilson Wise <wilsonodk@gmail.com>
James Young <jmeyoung@gmail.com>
James Drenter <james.drenter@turner.com>

# Generated by tools/update-authors.sh
Empty file added CHANGELOG.md
Empty file.
149 changes: 149 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,149 @@
# Contributing


## Issue contributions

When opening new issues or commenting on existing issues make sure discussions
are related to concrete technical issues.


## Code contributions

This project has an open governance model for Turner developers and welcomes new
contributors. Individuals making significant and valuable contributions may be
made _Collaborators_ and given commit-access to the project. See the
[GOVERNANCE.md](./GOVERNANCE.md) document for more information about how this
works.

This document will guide you though the contribution process.


### Step 1: fork

Fork the project and check out your copy locally.

```shell
$ 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
```


#### Which branch?

For developing new features and bug fixes, the `develop` branch should be pulled
and built upon.


### Step 2: Branch

Create a feature branch and start making changes. The name of the feature
branch should be the GitHub issue number, like `issue-1`.

```shell
$ git checkout -b issue-1
```


### Step 3: Commit

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@somewhere.com"
```

A commit log should describe what changed and why. Follow these guidelines when
writing one:

Each commit message consists of a **header**, a **body** and a **footer**. The
header has a special format that includes a **subsystem** and a
**short-description**:

```
<subsystem>: <short-description>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```

Any line of the commit message cannot be longer 100 characters. Make sure in
commit messages you:

- use the imperative, present tense: "change" not "changed" nor "changes"

- don't capitalize first letter

- no dot (.) at the end

A good commit log can look something like this:

```text
subsystem: succinct description of the change
Body of commit message explaining things in more details and giving background
about the issue being fixed as needed.
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@somewhere.com>
```


### Step 4: Rebase

Use `git rebase` (not `git merge`) to sync your work very frequently.

```shell
$ git pull --rebase upstream develop
```


### Step 5: Test

Bug fixes and features **should come with tests**. Add your tests in the
`test/` directory. Look at other tests to see how they should be structured.

Run all existing tests for the project. See the project README.md for details
on how to run the tests.


### Step 6: Push

```shell
$ git push origin my-feature-branch
```

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
address, apply your changes in a separate commit and push that to your feature
branch. Post a comment in the pull request afterwards; GitHub does not send out
notifications when you add commits.


### Summary of Git commands

```text
. + merge into develop
+---+ |
| R +------+---+------+------+------+ develop
+---+ | | ^
A| | D|
Fork +---+ | | |
of R | F +------+---+--------------------+ develop
+---+ | | |
B| C| |
| V |
+------+------+ issue-1
```

- A - when on F:develop - `git pull upstream develop`
- B - when on F:develop - `git checkout -b issue-1 -t origin/develop`
- C - when on F:issue-1 - `git pull --rebase upstream develop`
- D - Create a Pull Request on GitHub
48 changes: 48 additions & 0 deletions GOVERNANCE.md
@@ -0,0 +1,48 @@
# Project Governance


## Project Owner

This project is governed by a single Project Owner (PO) which is responsible for
the entire project.

The PO has final authority over this project.

For the current PO, see the project README.md.


## Collaborators

This repository is maintained by the PO and additional Collaborators who are
added by the PO on an ongoing basis.

Individuals making significant and valuable contributions are made Collaborators
and given commit-access to the project. These individuals are identified by the
PO and their addition as Collaborators is done by the PO.

Modifications of the contents of this repository are made on a collaborative
basis. Anyone in the TurnerBroadcasting GitHub organization with access to see
the repository may propose a modification via a pull request and it will be
considered by the project Collaborators. All pull requests must be reviewed and
accepted by a Collaborator with sufficient expertise who is able to take full
responsibility for the change. In the case of pull requests proposed by an
existing Collaborator, on projects with multiple Collaborators, an additional
Collaborator is required for sign-off. Consensus should be sought if additional
Collaborators participate and there is disagreement around a particular
modification. See _Consensus Seeking Process_ below for further detail on the
consensus model used for governance.

Collaborators may opt to elevate signification or controversial modifications,
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.

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


## Consensus Seeking Process

The Collaborators should make sure their cases are clear in the pull request
that has the ***po-review*** tag. The PO will read the pull request in its
entirety and make a final decision.
6 changes: 4 additions & 2 deletions README.md
@@ -1,11 +1,13 @@
# node-caching
# CNN Caching

Makes working with caching easier. Now with [hash ring support](http://en.wikipedia.org/wiki/Consistent_hashing)!

Fork of [mape/node-caching](https://github.com/mape/node-caching)


## Installation

Via [npm](http://github.com/isaacs/npm):
Via [npm](https://docs.npmjs.com/getting-started/installing-node):

```
$ npm install caching
Expand Down
11 changes: 7 additions & 4 deletions example.js → example/index.js
@@ -1,15 +1,18 @@
var Caching = require('./lib/caching');
var cache = new Caching('memory'); /* use 'memory' or 'redis' */
const Caching = require('../lib/caching'),
cache = new Caching('memory'), /* use 'memory' or 'redis' */
key = 'a-key-'+Date.now(),
ttl = 30 * 1000;

var key = 'a-key-'+Date.now();
var ttl = 30*1000;
setInterval(function() {
cache(key, ttl, function(passalong) {
console.log('This closure runs when nothing is in cache.');
setTimeout(function() {
passalong(null, 'cached result with '+ttl+'ms ttl');
}, 1000);
}, function(err, results) {
if (err) {
console.log(err);
}
// This callback will be reused each call
console.log(new Date().toString().match(/..:..:../)+' - Results:', results);
});
Expand Down

0 comments on commit 4a84185

Please sign in to comment.