Skip to content

Commit f573321

Browse files
committed
More housecleaning
1 parent 67ee79f commit f573321

12 files changed

Lines changed: 54 additions & 24 deletions

.eslintrc

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
{
2+
"env": {
3+
"node": true,
4+
"browser": false
5+
},
26
"rules": {
7+
// 2-space indentation
38
"indent": [2, 2, {"SwitchCase": 1}],
9+
// Require strings to use single quotes
410
"quotes": [2, "single"],
11+
// Allow only unix line-endings
512
"linebreak-style": [2, "unix"],
13+
// Always require semicolons
614
"semi": [2, "always"],
15+
// Require curly braces for multi-line control statements
716
"curly": [2, "multi-line"],
17+
// Always handle callback error cases
818
"handle-callback-err": [2, "^err"],
19+
// Require JSDoc for all function definitions
920
"valid-jsdoc": [2, {
1021
"requireReturn": false,
1122
"requireReturnDescription": false,
@@ -20,24 +31,34 @@
2031
}],
2132
"no-redeclare": [2, { "builtinGlobals": true }],
2233
"no-shadow": [2, { "builtinGlobals": true, "hoist": "all" }],
34+
// Disallow using variables before they've been defined
35+
// functions are ok
2336
"no-use-before-define": [2, "nofunc"],
2437
"no-shadow-restricted-names": 2,
2538
"no-extra-semi": 2,
39+
// Disallow unused variables
2640
"no-unused-vars": 2,
2741
"no-undef": 2,
42+
// Use if () { }
43+
// ^ space
44+
"space-after-keywords": [2, "always"],
45+
// Use if () { }
46+
// ^ space
47+
"space-before-blocks": [2, "always"],
48+
// eslint can't handle this, so the check is disabled.
2849
"key-spacing": 0,
2950
"strict": 0,
51+
// Do not force dot-notation
3052
"dot-notation": 0,
3153
"eol-last": 0,
3254
"no-new": 0,
3355
"semi-spacing": 0,
56+
// Allow multi spaces around operators since they are
57+
// used for alignment. This is not consistent in the
58+
// code.
3459
"no-multi-spaces": 0,
3560
"eqeqeq": 0,
3661
"no-mixed-requires": 0,
3762
"no-console": 0
38-
},
39-
"env": {
40-
"node": true,
41-
"browser": false
4263
}
4364
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.iml
2+
*.log
23
*.sublime-*
34
*.un~
45

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.iml
2+
*.log
23
*.sublime-*
34
*.un~
45

Readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data)
22

3-
[![Codacy Badge](https://img.shields.io/codacy/43ece80331c246179695e41f81eeffe2.svg)](https://www.codacy.com/app/form-data/form-data) [![Build Status](https://img.shields.io/travis/form-data/form-data/master.svg)](https://travis-ci.org/form-data/form-data) [![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
4-
53
A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
64

75
The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
86

97
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
108
[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions
119

10+
[![Build Status](https://img.shields.io/travis/form-data/form-data/master.svg)](https://travis-ci.org/form-data/form-data) [![Coverage Status](https://coveralls.io/repos/form-data/form-data/badge.svg?branch=master&service=github)](https://coveralls.io/github/form-data/form-data?branch=master) [![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
11+
12+
<!--
13+
[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data) [![Codacy Badge](https://img.shields.io/codacy/43ece80331c246179695e41f81eeffe2.svg)](https://www.codacy.com/app/form-data/form-data)
14+
-->
15+
1216
## Install
1317

1418
```

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"lint": "eslint lib/*.js test/*.js test/**/*.js",
1616
"predebug": "rimraf coverage test/tmp",
1717
"debug": "verbose=1 ./test/run.js",
18-
"check": "istanbul check-coverage coverage/coverage*.json"
18+
"check": "istanbul check-coverage coverage/coverage*.json",
19+
"coverage": "codeclimate-test-reporter < ./coverage/lcov.info; codacy-coverage < ./coverage/lcov.info; true"
1920
},
2021
"pre-commit": [
2122
"lint",
@@ -32,6 +33,8 @@
3233
},
3334
"license": "MIT",
3435
"devDependencies": {
36+
"codacy-coverage": "^1.1.3",
37+
"codeclimate-test-reporter": "^0.1.1",
3538
"coveralls": "^2.11.6",
3639
"eslint": "^1.10.3",
3740
"fake": "^0.2.2",

test/integration/test-custom-content-type.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ var FIELDS = {
2121
},
2222
'default_type': {
2323
expectedType: FormData.DEFAULT_CONTENT_TYPE,
24-
value: function(){ return new Buffer([1, 2, 3]); }
24+
value: function() { return new Buffer([1, 2, 3]); }
2525
},
2626
'implicit_type': {
2727
expectedType: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
28-
value: function(){ return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
28+
value: function() { return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
2929
},
3030
'overridden_type': {
3131
expectedType: 'image/png',
3232
options: {
3333
contentType: 'image/png'
3434
},
35-
value: function(){ return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
35+
value: function() { return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
3636
}
3737
};
3838
var fieldsPassed = false;

test/integration/test-pipe.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ var FIELDS = {
1919
},
2020
'my_buffer': {
2121
type: FormData.DEFAULT_CONTENT_TYPE,
22-
value: function(){ return new Buffer([1, 2, 3]); }
22+
value: function() { return new Buffer([1, 2, 3]); }
2323
},
2424
'my_file': {
2525
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
26-
value: function(){ return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
26+
value: function() { return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
2727
},
2828
'remote_file': {
2929
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
30-
value: function(){ return request(remoteFile); }
30+
value: function() { return request(remoteFile); }
3131
}
3232
};
3333
var fieldsPassed = Object.keys(FIELDS).length;

test/integration/test-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var fs = require('fs');
1313
var IncomingForm = require('formidable').IncomingForm;
1414

1515
var fileName = common.dir.fixture + '/unicycle.jpg';
16-
var myFile = function(){ return fs.createReadStream(fileName); };
16+
var myFile = function() { return fs.createReadStream(fileName); };
1717
var numItems = 5;
1818

1919
// Make request to use our FormData

test/integration/test-submit-custom-header.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ var FIELDS = {
1919
},
2020
'my_buffer': {
2121
type: FormData.DEFAULT_CONTENT_TYPE,
22-
value: function(){ return new Buffer([1, 2, 3]); }
22+
value: function() { return new Buffer([1, 2, 3]); }
2323
},
2424
'my_file': {
2525
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
26-
value: function(){ return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
26+
value: function() { return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
2727
},
2828
'remote_file': {
2929
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
30-
value: function(){ return request(remoteFile); }
30+
value: function() { return request(remoteFile); }
3131
}
3232
};
3333
var fieldsPassed = Object.keys(FIELDS).length;

test/integration/test-submit-custom.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ var FIELDS = {
1919
},
2020
'my_buffer': {
2121
type: FormData.DEFAULT_CONTENT_TYPE,
22-
value: function(){ return new Buffer([1, 2, 3]); }
22+
value: function() { return new Buffer([1, 2, 3]); }
2323
},
2424
'my_file': {
2525
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
26-
value: function(){ return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
26+
value: function() { return fs.createReadStream(common.dir.fixture + '/unicycle.jpg'); }
2727
},
2828
'remote_file': {
2929
type: mime.lookup(common.dir.fixture + '/unicycle.jpg'),
30-
value: function(){ return request(remoteFile); }
30+
value: function() { return request(remoteFile); }
3131
}
3232
};
3333
var fieldsPassed = Object.keys(FIELDS).length;

0 commit comments

Comments
 (0)