Skip to content

Commit

Permalink
Add standard-markdown to lint js code inside docs files
Browse files Browse the repository at this point in the history
  • Loading branch information
manidlou committed May 2, 2017
1 parent 096a8e1 commit c2ab3c5
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 18 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ const fs = require('fs-extra')
// Async with promises:
fs.copy('/tmp/myfile', '/tmp/mynewfile')
.then(() => console.log('success!'))
.catch(err => {
// Handle error
})
.catch(err => console.error(err))

// Async with callbacks:
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
Expand Down
2 changes: 1 addition & 1 deletion docs/copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fs.copy('/tmp/myfile', '/tmp/mynewfile')
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```

Expand Down
2 changes: 1 addition & 1 deletion docs/emptyDir.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ fs.emptyDir('/tmp/some/dir')
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/ensureDir.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ fs.ensureDir(dir)
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/ensureFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ fs.ensureFile(file)
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/ensureLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ fs.ensureLink(srcpath, dstpath)
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/ensureSymlink.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ fs.ensureSymlink(srcpath, dstpath)
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/move.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```

Expand Down
3 changes: 2 additions & 1 deletion docs/outputFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fs.outputFile(file, 'hello!', err => {
console.log(err) // => null

fs.readFile(file, 'utf8', (err, data) => {
if (err) return console.error(err)
console.log(data) // => hello!
})
})
Expand All @@ -28,6 +29,6 @@ fs.outputFile(file, 'hello!')
console.log(data) // => hello!
})
.catch(err => {
// handle error
console.error(err)
})
```
3 changes: 2 additions & 1 deletion docs/outputJson.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fs.outputJson(file, {name: 'JP'}, err => {
console.log(err) // => null

fs.readJson(file, (err, data) => {
if (err) return console.error(err)
console.log(data.name) // => JP
})
})
Expand All @@ -31,6 +32,6 @@ fs.outputJson(file, {name: 'JP'})
console.log(data.name) // => JP
})
.catch(err => {
// handle error
console.error(err)
})
```
4 changes: 2 additions & 2 deletions docs/readJson.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fs.readJson('./package.json')
console.log(packageObj.version) // => 0.1.3
})
.catch(err => {
// handle error
console.error(err)
})
```

Expand All @@ -53,6 +53,6 @@ fs.readJson(file, { throws: false })
console.log(obj) // => null
})
.catch(err => {
// Not called
console.error(err) // Not called
})
```
2 changes: 1 addition & 1 deletion docs/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fs.remove('/tmp/myfile')
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```
2 changes: 1 addition & 1 deletion docs/writeJson.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fs.writeJson('./package.json', {name: 'fs-extra'})
console.log('success!')
})
.catch(err => {
// handle error
console.error(err)
})
```

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@
"read-dir-files": "^0.1.1",
"rimraf": "^2.2.8",
"secure-random": "^1.1.1",
"standard": "^10.0.2"
"standard": "^10.0.2",
"standard-markdown": "^2.3.0"
},
"main": "./lib/index",
"scripts": {
"coverage": "istanbul cover -i 'lib/**' -x '**/__tests__/**' test.js",
"coveralls": "npm run coverage && coveralls < coverage/lcov.info",
"lint": "standard",
"lint": "standard && standard-markdown",
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
"test": "npm run lint && npm run unit",
"unit": "node test.js"
Expand Down

0 comments on commit c2ab3c5

Please sign in to comment.