Skip to content

Commit e220e4d

Browse files
committed
lint: use standard style in readme
1 parent c7487de commit e220e4d

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ before_install:
1919
# Setup Node.js version-specific dependencies
2020
- "test $TRAVIS_NODE_VERSION != '0.6' || npm rm --save-dev istanbul"
2121
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
22-
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard"
22+
- "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"
2323

2424
# Update Node.js modules
2525
- "test ! -d node_modules || npm prune"

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ http.createServer(function (req, res) {
3434

3535
`request` is the node HTTP request. `types` is an array of types.
3636

37+
<!-- eslint-disable no-undef -->
38+
3739
```js
3840
// req.headers.content-type = 'application/json'
3941

@@ -54,6 +56,8 @@ Having a body has no relation to how large the body is (it may be 0 bytes).
5456
This is similar to how file existence works. If a body does exist, then this
5557
indicates that there is data to read from the Node.js request stream.
5658

59+
<!-- eslint-disable no-undef -->
60+
5761
```js
5862
if (typeis.hasBody(req)) {
5963
// read the body, since there is one
@@ -68,6 +72,8 @@ if (typeis.hasBody(req)) {
6872

6973
`mediaType` is the [media type](https://tools.ietf.org/html/rfc6838) string. `types` is an array of types.
7074

75+
<!-- eslint-disable no-undef -->
76+
7177
```js
7278
var mediaType = 'application/json'
7379

@@ -92,12 +98,15 @@ typeis.is(mediaType, ['html']) // false
9298

9399
## Examples
94100

95-
#### Example body parser
101+
### Example body parser
96102

97103
```js
98-
var typeis = require('type-is');
104+
var express = require('express')
105+
var typeis = require('type-is')
106+
107+
var app = express()
99108

100-
function bodyParser(req, res, next) {
109+
app.use(function bodyParser (req, res, next) {
101110
if (!typeis.hasBody(req)) {
102111
return next()
103112
}
@@ -106,22 +115,19 @@ function bodyParser(req, res, next) {
106115
case 'urlencoded':
107116
// parse urlencoded body
108117
throw new Error('implement urlencoded body parsing')
109-
break
110118
case 'json':
111119
// parse json body
112120
throw new Error('implement json body parsing')
113-
break
114121
case 'multipart':
115122
// parse multipart body
116123
throw new Error('implement multipart body parsing')
117-
break
118124
default:
119125
// 415 error code
120126
res.statusCode = 415
121127
res.end()
122-
return
128+
break
123129
}
124-
}
130+
})
125131
```
126132

127133
## License

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"devDependencies": {
1616
"eslint": "3.18.0",
1717
"eslint-config-standard": "7.1.0",
18+
"eslint-plugin-markdown": "1.0.0-beta.4",
1819
"eslint-plugin-promise": "3.5.0",
1920
"eslint-plugin-standard": "2.1.1",
2021
"istanbul": "0.4.5",
@@ -29,7 +30,7 @@
2930
"index.js"
3031
],
3132
"scripts": {
32-
"lint": "eslint .",
33+
"lint": "eslint --plugin markdown --ext js,md .",
3334
"test": "mocha --reporter spec --check-leaks --bail test/",
3435
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
3536
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"

0 commit comments

Comments
 (0)