Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Commit

Permalink
chore(lint): replace jscs and jshint with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Joseph committed Jun 5, 2016
1 parent ddd9a85 commit 108e74f
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 353 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage/
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
extends: "eslint-config-lob"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ node_modules

# Users Environment Variables
.lock-wscript

# SQLite databases
*.sqlite
131 changes: 0 additions & 131 deletions .jscsrc

This file was deleted.

37 changes: 0 additions & 37 deletions .jshintrc

This file was deleted.

12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: node_js
sudo: false
node_js:
- '0.10.32'
- '0.10.32'
before_script:
- npm i knex@0 bookshelf@0
- npm i knex@0 bookshelf@0
script:
- npm test
- npm run lint
- npm run enforce
after_script:
- npm run enforce
- npm run coveralls
- npm run coveralls
23 changes: 6 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var stylish = require('jshint-stylish');
'use strict';

var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();

var paths = {
sourceFiles: 'lib/**/*.js',
testFiles: 'test/**/*.js',
gulpFile: 'gulpfile.js'
};

gulp.task('style', function () {
return gulp.src([paths.sourceFiles, paths.testFiles, paths.gulpFile])
.pipe(plugins.jscs());
});

gulp.task('cover', function () {
return gulp.src(paths.sourceFiles)
.pipe(plugins.istanbul());
});

gulp.task('lint', function () {
return gulp.src([paths.sourceFiles, paths.testFiles, paths.gulpFile])
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter(stylish))
.pipe(plugins.jshint.reporter('fail'));
});

gulp.task('test', ['lint', 'style', 'cover'], function () {
gulp.task('test', ['cover'], function () {
gulp.src('./coverage')
.pipe(plugins.clean());

Expand Down Expand Up @@ -59,7 +48,7 @@ gulp.task('enforce', function () {
rootDirectory: '.'
}))
.on('error', function (error) {
console.log(error.message);
console.log(error.message); // eslint-disable-line no-console
process.exit(1);
})
.pipe(plugins.exit());
Expand Down
28 changes: 12 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var fs = require('fs');
var Joi = require('joi');
var glob = require('glob');
var path = require('path');
'use strict';

var fs = require('fs');
var Joi = require('joi');
var glob = require('glob');
var path = require('path');

exports.register = function (server, options, next) {

Expand Down Expand Up @@ -78,18 +80,12 @@ exports.register = function (server, options, next) {

for (var o = modelObjects.length - 1; o >= 0; o--) {
var model = modelObjects[o];

if (fs.lstatSync(model).isFile()) {
var modelDir = path.dirname(model);
var fileName = path.basename(model)
.replace(path.extname(model), '');
if (!/^\..*/.test(fileName)) {
var modelPath = path.resolve(path.join(modelDir, fileName));
var modelName = fileName[0].toUpperCase() + fileName.substr(1);
var modelDef = require(modelPath)(base, bookshelf);
bookshelf[type](modelName, modelDef);
}
}
var modelDir = path.dirname(model);
var fileName = path.basename(model).replace(path.extname(model), '');
var modelPath = path.resolve(path.join(modelDir, fileName));
var modelName = fileName[0].toUpperCase() + fileName.substr(1);
var modelDef = require(modelPath)(base, bookshelf);
bookshelf[type](modelName, modelDef);
}
}

Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"description": "Hapi Plugin to Register Bookshelf Models",
"main": "lib/index.js",
"scripts": {
"test": "gulp test",
"enforce": "gulp enforce",
"coveralls": "gulp coveralls",
"release:patch": "changelog -p && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version patch && git push origin && git push origin --tags",
"enforce": "gulp enforce",
"lint": "eslint .",
"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags",
"release:minor": "changelog -m && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version minor && git push origin && git push origin --tags",
"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags"
"release:patch": "changelog -p && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version patch && git push origin && git push origin --tags",
"test": "gulp test"
},
"repository": {
"type": "git",
Expand All @@ -35,21 +36,19 @@
},
"devDependencies": {
"chai": "^1.10.0",
"eslint": "^1.10.3",
"eslint-config-lob": "^1.0.1",
"generate-changelog": "^1.0.0",
"gulp": "^3.8.10",
"gulp-clean": "^0.3.1",
"gulp-coveralls": "^0.1.3",
"gulp-exit": "0.0.2",
"gulp-istanbul": "^0.5.0",
"gulp-istanbul-enforcer": "^1.0.3",
"gulp-jscs": "^1.4.0",
"gulp-jshint": "^1.9.0",
"gulp-load-plugins": "^0.8.0",
"gulp-mocha": "^2.0.0",
"hapi": "8.x.x || 9.x.x || 10.x.x",
"istanbul": "^0.3.5",
"jscs": "^1.10.0",
"jshint-stylish": "^1.0.0",
"mocha": "^2.1.0",
"sqlite3": "^3.0.4"
}
Expand Down
2 changes: 2 additions & 0 deletions test/collections/users.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = function (baseCollection, bookshelf) {
return baseCollection.extend({
model: bookshelf.model('User')
Expand Down
Loading

0 comments on commit 108e74f

Please sign in to comment.