Skip to content

Commit a8f5163

Browse files
committed
lint: use standard style
1 parent 1453b61 commit a8f5163

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage
2+
node_modules

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "standard"
3+
}

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cache:
1515
- node_modules
1616
before_install:
1717
# Setup Node.js version-specific dependencies
18-
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
18+
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard istanbul"
1919

2020
# Update Node.js modules
2121
- "test ! -d node_modules || npm prune"
@@ -24,5 +24,6 @@ script:
2424
# Run test script, depending on istanbul install
2525
- "test ! -z $(npm -ps ls istanbul) || npm test"
2626
- "test -z $(npm -ps ls istanbul) || npm run-script test-travis"
27+
- "test -z $(npm -ps ls eslint ) || npm run-script lint"
2728
after_script:
2829
- "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = unpipe
1818
* @private
1919
*/
2020

21-
function hasPipeDataListeners(stream) {
21+
function hasPipeDataListeners (stream) {
2222
var listeners = stream.listeners('data')
2323

2424
for (var i = 0; i < listeners.length; i++) {
@@ -37,7 +37,7 @@ function hasPipeDataListeners(stream) {
3737
* @public
3838
*/
3939

40-
function unpipe(stream) {
40+
function unpipe (stream) {
4141
if (!stream) {
4242
throw new TypeError('argument stream is required')
4343
}

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"license": "MIT",
77
"repository": "stream-utils/unpipe",
88
"devDependencies": {
9+
"eslint": "2.10.2",
10+
"eslint-config-standard": "5.3.1",
11+
"eslint-plugin-promise": "1.1.0",
12+
"eslint-plugin-standard": "1.3.2",
913
"istanbul": "0.4.3",
1014
"mocha": "2.4.5",
1115
"readable-stream": "2.1.2"
@@ -20,6 +24,7 @@
2024
"node": ">= 0.8"
2125
},
2226
"scripts": {
27+
"lint": "eslint **/*.js",
2328
"test": "mocha --reporter spec --bail --check-leaks test/",
2429
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
2530
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"

test/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
}
5+
}

test/test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,29 @@ describe('unpipe(stream)', function () {
159159
})
160160
})
161161

162-
function SlowOldStream() {
162+
function SlowOldStream () {
163163
stream.Stream.call(this)
164164
}
165165

166166
util.inherits(SlowOldStream, stream.Stream)
167167

168-
function SlowReadStream() {
168+
function SlowReadStream () {
169169
stream.Readable.call(this)
170170
}
171171

172172
util.inherits(SlowReadStream, stream.Readable)
173173

174-
SlowReadStream.prototype._read = function _read() {
174+
SlowReadStream.prototype._read = function _read () {
175175
setTimeout(this.push.bind(this, '.'), 1000)
176176
}
177177

178-
function SlowWriteStream() {
178+
function SlowWriteStream () {
179179
stream.Writable.call(this)
180180
}
181181

182182
util.inherits(SlowWriteStream, stream.Writable)
183183

184-
SlowWriteStream.prototype._write = function _write(chunk, encoding, callback) {
184+
SlowWriteStream.prototype._write = function _write (chunk, encoding, callback) {
185185
this.emit('write')
186186
setTimeout(callback, 1000)
187187
}

0 commit comments

Comments
 (0)