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 b550d32 commit b7d673a
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 36 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test-project
template
template
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"require": true,
"request": true
}
}
}
4 changes: 3 additions & 1 deletion template/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"gulp-tasks/**/*.js"
]
}
]
],
"import/extensions": "off",
"no-param-reassign": "off"
},
"globals": {
"expect": true,
Expand Down
8 changes: 4 additions & 4 deletions template/client/store/modules/auth/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export function syncToken({commit, dispatch}) {
/**
* Sync router for auth
*/
export function syncRouter({state, dispatch}, router) {
export function syncRouter({state, dispatch}, myRouter) {
dispatch('syncToken');

router.beforeEach((to, from, next) => {
myRouter.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
// this route requires auth, check if logged in
// if not, redirect to login page (except when it's profile route and
Expand Down Expand Up @@ -103,7 +103,7 @@ export function loadAccount({commit}, userId) {
* @param {String} newPassword new password
* @return {Promise} promise of the password reset
*/
export function resetPassword({commit, state}, {oldPassword, newPassword}) {
export function resetPassword(ctx, {oldPassword, newPassword}) {
return loopback
.post(
'/Accounts/change-password',
Expand All @@ -117,7 +117,7 @@ export function resetPassword({commit, state}, {oldPassword, newPassword}) {
* @param {String} email user email
* @return {Promise} promise of the sent email
*/
export function rememberPassword({commit}, email) {
export function rememberPassword(ctx, email) {
return loopback
.post('/Accounts/reset', {email});
}
1 change: 1 addition & 0 deletions template/client/view/mixins/notification.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
export default {
methods: {
notifySuccess(msg) {
Expand Down
1 change: 1 addition & 0 deletions template/common/models/message.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
export default function(Message) {
Message.greet = (msg, cb) => {
process.nextTick(() => {
Expand Down
12 changes: 7 additions & 5 deletions template/gulp-tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ gulp.task('build:client', ['copy:client'], () => {
.pipe(gulp.dest(dirs.buildClient));
});

gulp.task('build:common', () => gulp.src(path.resolve(dirs.srcCommon, '**/*.js'))
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dirs.buildCommon)));
gulp.task('build:common', () => {
return gulp.src(path.resolve(dirs.srcCommon, '**/*.js'))
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dirs.buildCommon));
})

gulp.task('build:server', ['copy:server'], () => gulp.src([
path.resolve(dirs.srcServer, '**/*.js'),
Expand Down
8 changes: 5 additions & 3 deletions template/gulp-tasks/compilers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint no-useless-escape: 0, import/prefer-default-export: 0 */
import path from 'path';
import sass from 'vueify/lib/compilers/sass';
import {dirs} from './config';
Expand All @@ -12,19 +13,20 @@ function replaceCuringas(content) {
}

export function customSass(content, callback, compiler, filePath) {
let myContent = content
const relativePath = path.relative(
path.dirname(filePath),
path.resolve(dirs.srcClient, 'style/global.scss')
);

// Global SCSS
//
content = `@import "${relativePath}";${content}`;
myContent = `@import "${relativePath}";${myContent}`;

content = replaceCuringas(content);
myContent = replaceCuringas(myContent);

sass(
content,
myContent,
callback,
compiler,
filePath
Expand Down
1 change: 1 addition & 0 deletions template/gulp-tasks/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/prefer-default-export */
import path from 'path';

export const dirs = {};
Expand Down
26 changes: 18 additions & 8 deletions template/gulp-tasks/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ import gulp from 'gulp';
import path from 'path';
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'))));
gulp.task('copy:client:fa', () => {
return gulp
.src(path.resolve(dirs.modules, 'font-awesome/fonts/*'))
.pipe(gulp.dest(path.resolve(dirs.buildClient, 'static/fonts')));
})

gulp.task('copy:client', ['copy:client:fa'], () => gulp.src(`${dirs.srcClient}/**/!(*.vue|*.js)`)
.pipe(gulp.dest(path.resolve(dirs.buildClient))));
gulp.task('copy:client', ['copy:client:fa'], () => {
return gulp
.src(`${dirs.srcClient}/**/!(*.vue|*.js)`)
.pipe(gulp.dest(path.resolve(dirs.buildClient)));
})

gulp.task('copy:package', () => gulp.src(`${dirs.root}/package.json`)
.pipe(gulp.dest(path.resolve(dirs.build))));
gulp.task('copy:package', () => {
return gulp.src(`${dirs.root}/package.json`)
.pipe(gulp.dest(path.resolve(dirs.build)));
})

gulp.task('copy:server', () => gulp.src(`${dirs.srcServer}/**/*.json`)
.pipe(gulp.dest(path.resolve(dirs.buildServer))));
gulp.task('copy:server', () => {
return gulp.src(`${dirs.srcServer}/**/*.json`)
.pipe(gulp.dest(path.resolve(dirs.buildServer)));
})
2 changes: 1 addition & 1 deletion template/gulp-tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ gulp.task('serve:client', ['build:client', 'watch:client'], () => {
name: 'Client App',
root: dirs.buildClient,
livereload: true,
middleware: (connect, opt) => [historyApiFallback()],
middleware: () => [historyApiFallback()],
});
});

Expand Down
14 changes: 9 additions & 5 deletions template/gulp-tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import {Server} from 'karma';
import path from 'path';
import {dirs} from './config';

gulp.task('test:server', () => gulp.src(path.resolve(dirs.testServer, '**/*.spec.js'))
.pipe(mocha({
compilers: 'js:babel-core/register',
require: path.resolve(dirs.test, 'mocha.conf.js'),
})));
gulp.task(
'test:server',
() =>
gulp.src(path.resolve(dirs.testServer, '**/*.spec.js'))
.pipe(mocha({
compilers: 'js:babel-core/register',
require: path.resolve(dirs.test, 'mocha.conf.js'),
}))
);

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

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

0 comments on commit b7d673a

Please sign in to comment.