Skip to content

Commit 2ff09cc

Browse files
committedNov 7, 2015
Merge pull request #3547 from ChristianMurphy/eslint-update
ESLint Update
2 parents 352d80d + fc3f645 commit 2ff09cc

8 files changed

+43
-41
lines changed
 

‎.eslintrc

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@ env:
55
mocha: true
66

77
rules:
8+
comma-style: 2
9+
consistent-this:
10+
- 1
11+
- _this
812
indent:
913
- 2
1014
- 2
1115
- SwitchCase: 1
1216
VariableDeclarator: 2
13-
no-trailing-spaces: 2
14-
comma-style: 2
15-
no-spaced-func: 2
17+
key-spacing: 1
18+
no-console: 0
1619
no-multi-spaces: 1
20+
no-spaced-func: 2
21+
no-trailing-spaces: 2
22+
semi: 2
1723
space-after-keywords: 2
1824
space-before-blocks: 2
1925
space-before-function-paren:
@@ -23,8 +29,3 @@ rules:
2329
space-infix-ops: 2
2430
space-return-throw-case: 2
2531
space-unary-ops: 1
26-
no-console: 0
27-
consistent-this:
28-
- 1
29-
- _this
30-
semi: 2

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ test/triage/*.js
1717
/inspections
1818
bin/mongoose.min.js
1919
coverage
20+
npm-debug.log
2021

2122
# Visual Studio
2223
# =========

‎README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var mongoose = require('mongoose');
5757
mongoose.connect('mongodb://localhost/my_database');
5858
```
5959

60-
Once connected, the `open` event is fired on the `Connection` instance. If you're using `mongoose.connect`, the `Connection` is `mongoose.connection`. Otherwise, `mongoose.createConnection` return value is a `Connection`.
60+
Once connected, the `open` event is fired on the `Connection` instance. If you're using `mongoose.connect`, the `Connection` is `mongoose.connection`. Otherwise, `mongoose.createConnection` return value is a `Connection`.
6161

6262
**Note:** _If the local connection fails then try using 127.0.0.1 instead of localhost. Sometimes issues may arise when the local hostname has been changed._
6363

@@ -68,14 +68,14 @@ Once connected, the `open` event is fired on the `Connection` instance. If you'r
6868
Models are defined through the `Schema` interface.
6969

7070
```js
71-
var Schema = mongoose.Schema
72-
, ObjectId = Schema.ObjectId;
71+
var Schema = mongoose.Schema,
72+
ObjectId = Schema.ObjectId;
7373

7474
var BlogPost = new Schema({
75-
author : ObjectId
76-
, title : String
77-
, body : String
78-
, date : Date
75+
author : ObjectId,
76+
title : String,
77+
body : String,
78+
date : Date
7979
});
8080
```
8181

@@ -96,11 +96,11 @@ The following example shows some of these features:
9696

9797
```js
9898
var Comment = new Schema({
99-
name : { type: String, default: 'hahaha' }
100-
, age : { type: Number, min: 18, index: true }
101-
, bio : { type: String, match: /[a-z]/ }
102-
, date : { type: Date, default: Date.now }
103-
, buff : Buffer
99+
name : { type: String, default: 'hahaha' },
100+
age : { type: Number, min: 18, index: true },
101+
bio : { type: String, match: /[a-z]/ },
102+
date : { type: Date, default: Date.now },
103+
buff : Buffer
104104
});
105105

106106
// a setter
@@ -269,19 +269,19 @@ Moreover, you can mutate the incoming `method` arguments so that subsequent midd
269269

270270
```js
271271
new Schema({
272-
broken: { type: Boolean }
273-
, asset : {
274-
name: String
275-
, type: String // uh oh, it broke. asset will be interpreted as String
272+
broken: { type: Boolean },
273+
asset : {
274+
name: String,
275+
type: String // uh oh, it broke. asset will be interpreted as String
276276
}
277277
});
278278

279279
new Schema({
280-
works: { type: Boolean }
281-
, asset : {
282-
name: String
283-
, type: { type: String } // works. asset is an object with a type property
284-
}
280+
works: { type: Boolean },
281+
asset : {
282+
name: String,
283+
type: { type: String } // works. asset is an object with a type property
284+
}
285285
});
286286
```
287287

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"bluebird": "2.9.34",
4040
"co": "3.1.0",
4141
"dox": "0.3.1",
42-
"eslint": "1.7.3",
42+
"eslint": "1.9.0",
4343
"highlight.js": "7.0.1",
4444
"istanbul": "^0.3.13",
4545
"jade": "0.26.3",
@@ -67,7 +67,8 @@
6767
"scripts": {
6868
"install-browser": "npm install `node format_deps.js`",
6969
"test": "mocha --async-only test/*.test.js test/**/*.test.js",
70-
"test-cov": "istanbul cover _mocha --async-only test/*.test.js"
70+
"test-cov": "istanbul cover _mocha --async-only test/*.test.js",
71+
"lint": "eslint . --quiet"
7172
},
7273
"main": "./index.js",
7374
"engines": {

‎test/docs/promises.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var PromiseProvider = require('../../lib/promise_provider');
22
var assert = require('assert');
3-
var async = require('async');
43
var mongoose = require('../../');
54

65
describe('promises docs', function() {

‎test/document.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ describe('document', function() {
20722072
var axl = new Person({ name: 'Axl Rose' });
20732073
var gnr = new Band({ leadSinger: axl });
20742074

2075-
gnr.save(function(error, doc) {
2075+
gnr.save(function(error) {
20762076
assert.ifError(error);
20772077
assert.equal(gnr.leadSinger.name, 'Axl Rose');
20782078
db.close(done);

‎test/model.findOneAndUpdate.test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1481,9 +1481,9 @@ describe('model: findByIdAndUpdate:', function() {
14811481
var db = start();
14821482
var recordSchema = new mongoose.Schema({
14831483
kind: String,
1484-
amount: Number,
1484+
amount: Number
14851485
}, {
1486-
_id: false,
1486+
_id: false
14871487
});
14881488

14891489
var shiftSchema = new mongoose.Schema({
@@ -1495,14 +1495,14 @@ describe('model: findByIdAndUpdate:', function() {
14951495

14961496
Shift.create({
14971497
userId: 'tom',
1498-
records: [],
1499-
}, function(error, shift) {
1498+
records: []
1499+
}, function(error) {
15001500
assert.ifError(error);
15011501
Shift.findOneAndUpdate({userId: 'tom'}, {
1502-
records: [{kind: 'kind1', amount: NaN}],
1502+
records: [{kind: 'kind1', amount: NaN}]
15031503
}, {
1504-
'new': true,
1505-
}, function(error, shift) {
1504+
'new': true
1505+
}, function(error) {
15061506
assert.ok(error);
15071507
assert.ok(error instanceof CastError);
15081508
db.close(done);

‎test/model.populate.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ describe('model: populate:', function() {
191191
Application.
192192
findById(id).
193193
populate([
194-
{ path: 'tasks', populate: { path: 'handler' } },
194+
{ path: 'tasks', populate: { path: 'handler' } }
195195
]).
196196
exec(function(error, doc) {
197197
assert.ifError(error);

0 commit comments

Comments
 (0)
Please sign in to comment.