Skip to content

Commit 30b77bc

Browse files
committed
lint: use standard style in readme
1 parent 8ffd532 commit 30b77bc

3 files changed

Lines changed: 56 additions & 53 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cache:
1616
before_install:
1717
# Setup Node.js version-specific dependencies
1818
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
19-
- "test $(echo $TRAVIS_NODE_VERSION | cut -d'.' -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard"
19+
- "test $(echo $TRAVIS_NODE_VERSION | cut -d'.' -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-markdown eslint-plugin-promise eslint-plugin-standard"
2020
# Update Node.js modules
2121
- "test ! -d node_modules || npm prune"
2222
- "test ! -d node_modules || npm rebuild"

README.md

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -71,83 +71,85 @@ care to check if the request has timedout before you continue to act
7171
on the request.
7272

7373
```javascript
74-
var express = require('express');
75-
var timeout = require('connect-timeout');
74+
var bodyParser = require('body-parser')
75+
var cookieParser = require('cookie-parser')
76+
var express = require('express')
77+
var timeout = require('connect-timeout')
7678

7779
// example of using this top-level; note the use of haltOnTimedout
7880
// after every middleware; it will stop the request flow on a timeout
79-
var app = express();
80-
app.use(timeout('5s'));
81-
app.use(bodyParser());
82-
app.use(haltOnTimedout);
83-
app.use(cookieParser());
84-
app.use(haltOnTimedout);
81+
var app = express()
82+
app.use(timeout('5s'))
83+
app.use(bodyParser())
84+
app.use(haltOnTimedout)
85+
app.use(cookieParser())
86+
app.use(haltOnTimedout)
8587

8688
// Add your routes here, etc.
8789

88-
function haltOnTimedout(req, res, next){
89-
if (!req.timedout) next();
90+
function haltOnTimedout (req, res, next) {
91+
if (!req.timedout) next()
9092
}
9193

92-
app.listen(3000);
94+
app.listen(3000)
9395
```
9496

9597
### express 3.x
9698

9799
```javascript
98-
var express = require('express');
99-
var bodyParser = require('body-parser');
100-
var timeout = require('connect-timeout');
101-
102-
var app = express();
103-
app.post('/save', timeout('5s'), bodyParser.json(), haltOnTimedout, function(req, res, next){
104-
savePost(req.body, function(err, id){
105-
if (err) return next(err);
106-
if (req.timedout) return;
107-
res.send('saved as id ' + id);
108-
});
109-
});
110-
111-
function haltOnTimedout(req, res, next){
112-
if (!req.timedout) next();
100+
var express = require('express')
101+
var bodyParser = require('body-parser')
102+
var timeout = require('connect-timeout')
103+
104+
var app = express()
105+
app.post('/save', timeout('5s'), bodyParser.json(), haltOnTimedout, function (req, res, next) {
106+
savePost(req.body, function (err, id) {
107+
if (err) return next(err)
108+
if (req.timedout) return
109+
res.send('saved as id ' + id)
110+
})
111+
})
112+
113+
function haltOnTimedout (req, res, next) {
114+
if (!req.timedout) next()
113115
}
114116

115-
function savePost(post, cb){
116-
setTimeout(function(){
117-
cb(null, ((Math.random()* 40000) >>> 0));
118-
}, (Math.random()* 7000) >>> 0);
117+
function savePost (post, cb) {
118+
setTimeout(function () {
119+
cb(null, ((Math.random() * 40000) >>> 0))
120+
}, (Math.random() * 7000) >>> 0)
119121
}
120122

121-
app.listen(3000);
123+
app.listen(3000)
122124
```
123125

124126
### connect
125127

126128
```javascript
127-
var bodyParser = require('body-parser');
128-
var connect = require('connect');
129-
var timeout = require('connect-timeout');
130-
131-
var app = connect();
132-
app.use('/save', timeout('5s'), bodyParser.json(), haltOnTimedout, function(req, res, next){
133-
savePost(req.body, function(err, id){
134-
if (err) return next(err);
135-
if (req.timedout) return;
136-
res.send('saved as id ' + id);
137-
});
138-
});
139-
140-
function haltOnTimedout(req, res, next){
141-
if (!req.timedout) next();
129+
var bodyParser = require('body-parser')
130+
var connect = require('connect')
131+
var timeout = require('connect-timeout')
132+
133+
var app = connect()
134+
app.use('/save', timeout('5s'), bodyParser.json(), haltOnTimedout, function (req, res, next) {
135+
savePost(req.body, function (err, id) {
136+
if (err) return next(err)
137+
if (req.timedout) return
138+
res.send('saved as id ' + id)
139+
})
140+
})
141+
142+
function haltOnTimedout (req, res, next) {
143+
if (!req.timedout) next()
142144
}
143145

144-
function savePost(post, cb){
145-
setTimeout(function(){
146-
cb(null, ((Math.random()* 40000) >>> 0));
147-
}, (Math.random()* 7000) >>> 0);
146+
function savePost (post, cb) {
147+
setTimeout(function () {
148+
cb(null, ((Math.random() * 40000) >>> 0))
149+
}, (Math.random() * 7000) >>> 0)
148150
}
149151

150-
app.listen(3000);
152+
app.listen(3000)
151153
```
152154

153155
## License

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"devDependencies": {
1818
"eslint": "3.10.2",
1919
"eslint-config-standard": "6.2.1",
20+
"eslint-plugin-markdown": "1.0.0-beta.3",
2021
"eslint-plugin-promise": "3.4.0",
2122
"eslint-plugin-standard": "2.0.1",
2223
"istanbul": "0.4.5",
@@ -32,7 +33,7 @@
3233
"node": ">= 0.8"
3334
},
3435
"scripts": {
35-
"lint": "eslint .",
36+
"lint": "eslint --plugin markdown --ext js,md .",
3637
"test": "mocha --reporter spec --bail --check-leaks test/",
3738
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
3839
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --check-leaks test/"

0 commit comments

Comments
 (0)