Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
replace jshint with eslint + update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilWaldmann committed Jul 17, 2017
1 parent ec98fe9 commit 5e7c692
Show file tree
Hide file tree
Showing 272 changed files with 20,561 additions and 14,898 deletions.
42 changes: 42 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,42 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
extends: 'standard',

"env": {
"node": true,
"mocha": true
},

rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,

'space-before-blocks': 0,
'keyword-spacing': 0,
'no-multiple-empty-lines': 0,
'space-before-function-paren': [2, {anonymous: 'never', named: 'never' }],
'semi': [2, 'never']
},

globals: {
testMYSQL: true,
afterMYSQL: true,
beforeMYSQL: true,
beforePG: true,
afterPG: true,
testPG: true,
beforeSQLite: true,
afterSQLite: true,
testSQLite: true,
beforeActiveDirectory: true,
afterActiveDirectory: true,
testActiveDirectory: true,
LDAP_BASE: true
}
}
57 changes: 0 additions & 57 deletions .jshintrc

This file was deleted.

17 changes: 8 additions & 9 deletions examples/activedirectory-example.js
@@ -1,20 +1,19 @@
var OpenRecord = require('openrecord');
var OpenRecord = require('openrecord')

var store = new OpenRecord({
type: 'activedirectory',
url: 'ldaps://domain.lan',
user: 'Domain\\Administrator',
password: 'password',
base: 'dc=domain,dc=lan'
});
})


store.ready(function(){
var User = store.Model('User');
var User = store.Model('User')

User.find('cn=Administrator,cn=Users,dc=domain,dc=lan').include('groups').exec(function(admin){
console.log(admin);
process.exit(0);
});

});
console.log(admin)
process.exit(0)
})
})
22 changes: 11 additions & 11 deletions examples/exceptions-example.js
Expand Up @@ -3,27 +3,27 @@
* @example Model.then
*/
User.limit(1).then(function(){
//success
// success
}).catch(SQLError, function(e){
//handle exception
});
// handle exception
})

//or
// or

User.on('exception', function(e){
//handle exception
// handle exception
})

User.limit(1).then(function(){
//success
});
// success
})

//or
// or

store.on('exception', function(e){
//handle exception
// handle exception
})

User.limit(1).then(function(){
//success
});
// success
})
32 changes: 15 additions & 17 deletions examples/has-many-through-relation-example.js
Expand Up @@ -4,37 +4,35 @@
* @example Definition.belongsTo
*/
store.model('PostsCategory', function(){
this.belongsTo('post');
this.belongsTo('category');
});
this.belongsTo('post')
this.belongsTo('category')
})

/**
* Add relations for the junction table and
* for the category table via the junction table
* @example Definition.hasManyThrough
*/
store.model('Post', function(){
this.hasMany('posts_category');
this.hasMany('category', {through: 'posts_category'});
});
this.hasMany('posts_category')
this.hasMany('category', {through: 'posts_category'})
})

/**
* Add relations for the junction table and
* for the category table via the junction table
* @example Definition.hasManyThrough
*/
store.model('Category', function(){
this.hasMany('posts_category');
this.hasMany('post', {through: 'posts_category'});
});
this.hasMany('posts_category')
this.hasMany('post', {through: 'posts_category'})
})

/* Now create a post with categories (after creating your store): */
var Post = store.Model("Post");
var Category = store.Model("Category");

var post = new Post;
var c1 = new Category;
var c2 = new Category;
post.category = [c1, c2];

var Post = store.Model('Post')
var Category = store.Model('Category')

var post = new Post()
var c1 = new Category()
var c2 = new Category()
post.category = [c1, c2]
4 changes: 2 additions & 2 deletions examples/limit-example.js
Expand Up @@ -4,5 +4,5 @@
* @example Model.exec
*/
User.limit(1).exec(function(){
});

})
8 changes: 4 additions & 4 deletions examples/relation-example.js
Expand Up @@ -3,13 +3,13 @@
* @example Definition.hasMany
*/
store.model('User', function(){
this.hasMany('posts');
});
this.hasMany('posts')
})

/**
* Add a belongs to relation to the `Post` Model
* @example Definition.belongsTo
*/
store.model('Post', function(){
this.hasMany('users');
});
this.hasMany('users')
})
26 changes: 13 additions & 13 deletions examples/validation-example.js
Expand Up @@ -4,10 +4,10 @@
*/
store.model('MyModel', function(){
this.validates('my_attr', function(){
//your custom validation logic
return true; //true: validation passes, false: validation failes
});
});
// your custom validation logic
return true // true: validation passes, false: validation failes
})
})


/**
Expand All @@ -16,33 +16,33 @@ store.model('MyModel', function(){
*/
store.model('MyModel', function(){
this.validates('my_attr', function(next){
next(true);
});
});
next(true)
})
})


/**
* Use the `validatesPresenceOf` to validate multiple attributes
* @example Definition.validatesPresenceOf
*/
store.model('MyModel', function(){
this.validatesPresenceOf('my_attr', 'my_attr2');
});
this.validatesPresenceOf('my_attr', 'my_attr2')
})


/**
* Use the `validatesFormatOf` to validate an email address attribute
* @example Definition.validatesFormatOf
*/
store.model('MyModel', function(){
this.validatesFormatOf('my_email', 'email');
});
this.validatesFormatOf('my_email', 'email')
})


/**
* Use the `validatesConfirmationOf` to validate a password confirmation
* @example Definition.validatesConfirmationOf
*/
store.model('MyModel', function(){
this.validatesConfirmationOf('password');
});
this.validatesConfirmationOf('password')
})

0 comments on commit 5e7c692

Please sign in to comment.