Skip to content

Commit

Permalink
lint: use standard style in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Feb 20, 2017
1 parent 92e0a99 commit 4d7024d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cache:
before_install:
# Setup Node.js version-specific dependencies
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard"
- "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"

# Update Node.js modules
- "test ! -d node_modules || npm prune"
Expand Down
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,31 @@ to avoid processing any other middleware if we already know the request is for
### express

```javascript
var express = require('express');
var favicon = require('serve-favicon');
var express = require('express')
var favicon = require('serve-favicon')
var path = require('path')

var app = express();
app.use(favicon(__dirname + '/public/favicon.ico'));
var app = express()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your routes here, etc.

app.listen(3000);
app.listen(3000)
```

### connect

```javascript
var connect = require('connect');
var favicon = require('serve-favicon');
var connect = require('connect')
var favicon = require('serve-favicon')
var path = require('path')

var app = connect();
app.use(favicon(__dirname + '/public/favicon.ico'));
var app = connect()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your middleware here, etc.

app.listen(3000);
app.listen(3000)
```

### vanilla http server
Expand All @@ -96,26 +98,27 @@ This middleware can be used anywhere, even outside express/connect. It takes
`req`, `res`, and `callback`.

```javascript
var http = require('http');
var favicon = require('serve-favicon');
var finalhandler = require('finalhandler');
var http = require('http')
var favicon = require('serve-favicon')
var finalhandler = require('finalhandler')
var path = require('path')

var _favicon = favicon(__dirname + '/public/favicon.ico');
var _favicon = favicon(path.join(__dirname, 'public', 'favicon.ico'))

var server = http.createServer(function onRequest(req, res) {
var done = finalhandler(req, res);
var server = http.createServer(function onRequest (req, res) {
var done = finalhandler(req, res)

_favicon(req, res, function onNext(err) {
if (err) return done(err);
_favicon(req, res, function onNext (err) {
if (err) return done(err)

// continue to process the request here, etc.

res.statusCode = 404;
res.end('oops');
});
});
res.statusCode = 404
res.end('oops')
})
})

server.listen(3000);
server.listen(3000)
```

## License
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cache:
install:
- ps: Install-Product node $env:nodejs_version
- if "%nodejs_version%" equ "0.8" npm rm --save-dev istanbul
- npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard
- npm rm --save-dev eslint eslint-config-standard eslint-plugin-markdown eslint-plugin-promise eslint-plugin-standard
- if exist node_modules npm prune
- if exist node_modules npm rebuild
- npm install
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"eslint": "3.15.0",
"eslint-config-standard": "6.2.1",
"eslint-plugin-markdown": "1.0.0-beta.3",
"eslint-plugin-promise": "3.4.2",
"eslint-plugin-standard": "2.0.1",
"istanbul": "0.4.5",
Expand All @@ -34,7 +35,7 @@
"node": ">= 0.8.0"
},
"scripts": {
"lint": "eslint .",
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
Expand Down

0 comments on commit 4d7024d

Please sign in to comment.