Skip to content

Commit

Permalink
fix(lint): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Walker Leite committed Feb 28, 2018
1 parent 97a2062 commit b550d32
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 30 deletions.
12 changes: 11 additions & 1 deletion template/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@
"vue"
],
"rules": {
"import/no-unresolved": "off"
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"test/**/*.js",
"test/**/*.js",
"gulp-tasks/**/*.js"
]
}
]
},
"globals": {
"expect": true,
Expand Down
2 changes: 1 addition & 1 deletion template/client/store/modules/auth/actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import loopback from '@/services/loopback';
import router from '@/router.js';
import router from '@/router';

/**
* Sync loopback token with current state
Expand Down
4 changes: 2 additions & 2 deletions template/client/store/modules/auth/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as actions from './actions.js';
import * as mutations from './mutations.js';
import * as actions from './actions';
import * as mutations from './mutations';

export default {
namespaced: true,
Expand Down
4 changes: 2 additions & 2 deletions template/gulp-tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import babelify from 'babelify';
import modulesify from 'css-modulesify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import {dirs} from './config.js';
import {customSass} from './compilers.js';
import {dirs} from './config';
import {customSass} from './compilers';

gulp.task('build:test', () => gulp.src([
path.resolve(dirs.test, '**/*.test.js'),
Expand Down
2 changes: 1 addition & 1 deletion template/gulp-tasks/compilers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import sass from 'vueify/lib/compilers/sass';
import {dirs} from './config.js';
import {dirs} from './config';

function replaceCuringas(content) {
// FIXME: Not working
Expand Down
2 changes: 1 addition & 1 deletion template/gulp-tasks/copy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import gulp from 'gulp';
import path from 'path';
import {dirs} from './config.js';
import {dirs} from './config';

gulp.task('copy:client:fa', () => gulp.src(path.resolve(dirs.modules, 'font-awesome/fonts/*'))
.pipe(gulp.dest(path.resolve(dirs.buildClient, 'static/fonts'))));
Expand Down
4 changes: 2 additions & 2 deletions template/gulp-tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import gulp from 'gulp';
import gutil from 'gulp-util';
import connect from 'gulp-connect';
import historyApiFallback from 'connect-history-api-fallback';
import {dirs} from './config.js';
import server from '../server/server.js';
import {dirs} from './config';
import server from '../server/server';

gulp.task('reload:server', ['build:server'], () => {
gutil.log('Reloading server');
Expand Down
12 changes: 6 additions & 6 deletions template/gulp-tasks/tasks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file just export the entire contents of this directory
export * from './serve.js';
export * from './default.js';
export * from './build.js';
export * from './test.js';
export * from './copy.js';
// This file just import the entire contents of this directory
import './serve';
import './default';
import './build';
import './test';
import './copy';
2 changes: 1 addition & 1 deletion template/gulp-tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gulp from 'gulp';
import mocha from 'gulp-mocha';
import {Server} from 'karma';
import path from 'path';
import {dirs} from './config.js';
import {dirs} from './config';

gulp.task('test:server', () => gulp.src(path.resolve(dirs.testServer, '**/*.spec.js'))
.pipe(mocha({
Expand Down
2 changes: 1 addition & 1 deletion template/gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Search for gulp tasks in gulp-tasks directory
import './gulp-tasks/tasks.js';
import './gulp-tasks/tasks';
2 changes: 1 addition & 1 deletion template/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import app from './server/server';
import express from 'express';
import app from './server/server';

app.use(express.static('client'));
app.on('started', () => {
Expand Down
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"cors": "^2.5.2",
"helmet": "^1.3.0",
"http-server": "^0.11.1",
"express": "^4.16.2",
"loopback": "^3.16.2",
"loopback-boot": "^2.27.0",
"loopback-component-explorer": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions template/server/boot/add-initial-data.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
// import initialProf from '../../server/initial-data/example1-teacher';
// import initialClassroom from '../../server/initial-data/example1-classroom';
// import initialStudent from '../../server/initial-data/example1-student';
Expand Down
14 changes: 9 additions & 5 deletions template/server/boot/create-admin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import initialAccount from '../initial-data/maintenance-account';
import initialAccount from '../initial-data/maintenance-account.json';

export const email = initialAccount.email;
export const password = initialAccount.password;
Expand All @@ -17,6 +17,7 @@ export default function createAdmin(server) {
if (accounts.length < 1) {
return Account.create({email, password});
}
return null
})
.then((account) => {
if (account) {
Expand All @@ -36,16 +37,19 @@ export default function createAdmin(server) {
({account, role})
);
}
return null
})
.then((payload) => { // get account and role from payload
if (payload && payload.account && payload.role) {
return payload.role.principals.create({
const myPayload = {...payload}
return myPayload.role.principals.create({
principalType: RoleMapping.USER,
principalId: payload.account.id,
principalId: myPayload.account.id,
}).then((principal) => {
payload.principal = principal;
return payload;
myPayload.principal = principal;
return myPayload;
});
}
return null
});
}
1 change: 1 addition & 0 deletions template/server/models/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function(Account) {
}, (err) => {
if (err) return console.log(err);
console.log('> sending password reset email to:', info.email);
return
});
});
}
5 changes: 3 additions & 2 deletions template/test/client/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import Vue from 'vue';
import App from '@/App.vue';

describe('App.vue', () => {
let Constructor, vm;
let Constructor;
let vm;
{{#extended}}
const routerView = {
render: r => r('div', 'mocked component'),
};
{{/extended}}

beforeEach(done => {
beforeEach((done) => {
Constructor = Vue.extend(App);
vm = new Constructor({
mounted: () => done(),
Expand Down
2 changes: 1 addition & 1 deletion template/test/server/account.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Account', () => {
return appStarted.then(() => Account
.create({email, password: 'IuhEW7HI#&HUH3'})
.then((acc) => {
testAccount = acc
testAccount = acc;
}));
});

Expand Down
6 changes: 3 additions & 3 deletions template/test/server/boot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('boot process', () => {
});

it('should create a default admin user', () => {
return server.models.Account.find().then(res => {
return server.models.Account.find().then((res) => {
expect(res).to.have.lengthOf(1);
expect(res[0]).to.have.property('createdAt');
expect(res[0]).to.have.property('updatedAt');
Expand All @@ -73,7 +73,7 @@ describe('boot process', () => {
});

it('should create a default admin role', () => {
return server.models.Role.find().then(res => {
return server.models.Role.find().then((res) => {
expect(res).to.have.lengthOf(1);
expect(res[0]).to.have.property('created');
expect(res[0]).to.have.property('modified');
Expand All @@ -84,7 +84,7 @@ describe('boot process', () => {

it('should create RoleMapping entry for admin', () => {
const RoleMapping = server.models.RoleMapping;
return RoleMapping.find().then(res => {
return RoleMapping.find().then((res) => {
expect(res).to.have.lengthOf(1);
expect(res[0].id).to.equal(1);
expect(res[0].roleId).to.equal(1);
Expand Down

0 comments on commit b550d32

Please sign in to comment.