Skip to content

Commit b550d32

Browse files
author
Walker Leite
committed
fix(lint): fix lint errors
1 parent 97a2062 commit b550d32

File tree

18 files changed

+48
-30
lines changed

18 files changed

+48
-30
lines changed

template/.eslintrc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@
1515
"vue"
1616
],
1717
"rules": {
18-
"import/no-unresolved": "off"
18+
"import/no-unresolved": "off",
19+
"import/no-extraneous-dependencies": [
20+
"error",
21+
{
22+
"devDependencies": [
23+
"test/**/*.js",
24+
"test/**/*.js",
25+
"gulp-tasks/**/*.js"
26+
]
27+
}
28+
]
1929
},
2030
"globals": {
2131
"expect": true,

template/client/store/modules/auth/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import loopback from '@/services/loopback';
2-
import router from '@/router.js';
2+
import router from '@/router';
33

44
/**
55
* Sync loopback token with current state

template/client/store/modules/auth/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as actions from './actions.js';
2-
import * as mutations from './mutations.js';
1+
import * as actions from './actions';
2+
import * as mutations from './mutations';
33

44
export default {
55
namespaced: true,

template/gulp-tasks/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import babelify from 'babelify';
88
import modulesify from 'css-modulesify';
99
import source from 'vinyl-source-stream';
1010
import buffer from 'vinyl-buffer';
11-
import {dirs} from './config.js';
12-
import {customSass} from './compilers.js';
11+
import {dirs} from './config';
12+
import {customSass} from './compilers';
1313

1414
gulp.task('build:test', () => gulp.src([
1515
path.resolve(dirs.test, '**/*.test.js'),

template/gulp-tasks/compilers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import sass from 'vueify/lib/compilers/sass';
3-
import {dirs} from './config.js';
3+
import {dirs} from './config';
44

55
function replaceCuringas(content) {
66
// FIXME: Not working

template/gulp-tasks/copy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import gulp from 'gulp';
22
import path from 'path';
3-
import {dirs} from './config.js';
3+
import {dirs} from './config';
44

55
gulp.task('copy:client:fa', () => gulp.src(path.resolve(dirs.modules, 'font-awesome/fonts/*'))
66
.pipe(gulp.dest(path.resolve(dirs.buildClient, 'static/fonts'))));

template/gulp-tasks/serve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import gulp from 'gulp';
22
import gutil from 'gulp-util';
33
import connect from 'gulp-connect';
44
import historyApiFallback from 'connect-history-api-fallback';
5-
import {dirs} from './config.js';
6-
import server from '../server/server.js';
5+
import {dirs} from './config';
6+
import server from '../server/server';
77

88
gulp.task('reload:server', ['build:server'], () => {
99
gutil.log('Reloading server');

template/gulp-tasks/tasks.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// This file just export the entire contents of this directory
2-
export * from './serve.js';
3-
export * from './default.js';
4-
export * from './build.js';
5-
export * from './test.js';
6-
export * from './copy.js';
1+
// This file just import the entire contents of this directory
2+
import './serve';
3+
import './default';
4+
import './build';
5+
import './test';
6+
import './copy';

template/gulp-tasks/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import gulp from 'gulp';
22
import mocha from 'gulp-mocha';
33
import {Server} from 'karma';
44
import path from 'path';
5-
import {dirs} from './config.js';
5+
import {dirs} from './config';
66

77
gulp.task('test:server', () => gulp.src(path.resolve(dirs.testServer, '**/*.spec.js'))
88
.pipe(mocha({

template/gulpfile.babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// Search for gulp tasks in gulp-tasks directory
2-
import './gulp-tasks/tasks.js';
2+
import './gulp-tasks/tasks';

template/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import app from './server/server';
21
import express from 'express';
2+
import app from './server/server';
33

44
app.use(express.static('client'));
55
app.on('started', () => {

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"cors": "^2.5.2",
2121
"helmet": "^1.3.0",
2222
"http-server": "^0.11.1",
23+
"express": "^4.16.2",
2324
"loopback": "^3.16.2",
2425
"loopback-boot": "^2.27.0",
2526
"loopback-component-explorer": "^4.0.0",

template/server/boot/add-initial-data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
// import initialProf from '../../server/initial-data/example1-teacher';
23
// import initialClassroom from '../../server/initial-data/example1-classroom';
34
// import initialStudent from '../../server/initial-data/example1-student';

template/server/boot/create-admin.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import initialAccount from '../initial-data/maintenance-account';
1+
import initialAccount from '../initial-data/maintenance-account.json';
22

33
export const email = initialAccount.email;
44
export const password = initialAccount.password;
@@ -17,6 +17,7 @@ export default function createAdmin(server) {
1717
if (accounts.length < 1) {
1818
return Account.create({email, password});
1919
}
20+
return null
2021
})
2122
.then((account) => {
2223
if (account) {
@@ -36,16 +37,19 @@ export default function createAdmin(server) {
3637
({account, role})
3738
);
3839
}
40+
return null
3941
})
4042
.then((payload) => { // get account and role from payload
4143
if (payload && payload.account && payload.role) {
42-
return payload.role.principals.create({
44+
const myPayload = {...payload}
45+
return myPayload.role.principals.create({
4346
principalType: RoleMapping.USER,
44-
principalId: payload.account.id,
47+
principalId: myPayload.account.id,
4548
}).then((principal) => {
46-
payload.principal = principal;
47-
return payload;
49+
myPayload.principal = principal;
50+
return myPayload;
4851
});
4952
}
53+
return null
5054
});
5155
}

template/server/models/account.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function(Account) {
1515
}, (err) => {
1616
if (err) return console.log(err);
1717
console.log('> sending password reset email to:', info.email);
18+
return
1819
});
1920
});
2021
}

template/test/client/app.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import Vue from 'vue';
22
import App from '@/App.vue';
33

44
describe('App.vue', () => {
5-
let Constructor, vm;
5+
let Constructor;
6+
let vm;
67
{{#extended}}
78
const routerView = {
89
render: r => r('div', 'mocked component'),
910
};
1011
{{/extended}}
1112

12-
beforeEach(done => {
13+
beforeEach((done) => {
1314
Constructor = Vue.extend(App);
1415
vm = new Constructor({
1516
mounted: () => done(),

template/test/server/account.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Account', () => {
1111
return appStarted.then(() => Account
1212
.create({email, password: 'IuhEW7HI#&HUH3'})
1313
.then((acc) => {
14-
testAccount = acc
14+
testAccount = acc;
1515
}));
1616
});
1717

template/test/server/boot.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('boot process', () => {
6262
});
6363

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

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

8585
it('should create RoleMapping entry for admin', () => {
8686
const RoleMapping = server.models.RoleMapping;
87-
return RoleMapping.find().then(res => {
87+
return RoleMapping.find().then((res) => {
8888
expect(res).to.have.lengthOf(1);
8989
expect(res[0].id).to.equal(1);
9090
expect(res[0].roleId).to.equal(1);

0 commit comments

Comments
 (0)