diff --git a/.editorconfig b/.editorconfig index 3ee22e5d3..18810d5e3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,7 +6,7 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true diff --git a/client/auth/index.js b/client/auth/index.js index 57dd5f4ef..2bd8c57de 100644 --- a/client/auth/index.js +++ b/client/auth/index.js @@ -1 +1 @@ -export * from './src/auth' +export * from './src/auth'; diff --git a/client/auth/src/auth.js b/client/auth/src/auth.js index b6ea0475f..03062dac6 100644 --- a/client/auth/src/auth.js +++ b/client/auth/src/auth.js @@ -1,4 +1,4 @@ export * from './module'; import './config'; -export {component as Login} from './login/login' +export {component as Login} from './login/login'; diff --git a/client/auth/src/login/login.js b/client/auth/src/login/login.js index 07702ad76..5a44eb540 100644 --- a/client/auth/src/login/login.js +++ b/client/auth/src/login/login.js @@ -7,8 +7,8 @@ export const component = { }; module.component('vnLogin', component); -controller.$inject = ['$http', '$element']; -function controller($http, $element) { +controller.$inject = ['$http', '$element', '$window']; +function controller($http, $element, $window) { Object.assign(this, { submit: function() { let model = this.model; @@ -19,16 +19,16 @@ function controller($http, $element) { } this.loading = true; - model.appId = window.location.href; + model.appId = $window.location.href; $http.post('/auth', this.model).then( - (json) => this.onLoginOk(json), - (json) => this.onLoginErr(json) + json => this.onLoginOk(json), + json => this.onLoginErr(json) ); }, onLoginOk: function(json) { this.loading = false; let data = json.data; - window.location = `${data.location}?access_token=${data.location}`; + $window.location = `${data.location}?access_token=${data.location}`; }, onLoginErr: function(json) { this.loading = false; @@ -37,14 +37,14 @@ function controller($http, $element) { let message; switch (json.status) { - case 401: - message = 'Invalid credentials'; - break; - case -1: - message = 'Can\'t contact with server'; - break; - default: - message = 'Something went wrong'; + case 401: + message = 'Invalid credentials'; + break; + case -1: + message = 'Can\'t contact with server'; + break; + default: + message = 'Something went wrong'; } this.showMessage(message); diff --git a/client/client/index.js b/client/client/index.js index 8c2e02b72..cf9881312 100644 --- a/client/client/index.js +++ b/client/client/index.js @@ -1 +1 @@ -export * from './src/client'; \ No newline at end of file +export * from './src/client'; diff --git a/client/core/index.js b/client/core/index.js index 064800130..59d36b6af 100644 --- a/client/core/index.js +++ b/client/core/index.js @@ -1,2 +1 @@ -export * from './src/core' - +export * from './src/core'; diff --git a/gulpfile.js b/gulpfile.js index 1985ad9dc..624463a67 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,3 @@ -var path = require('path'); var gulp = require('gulp'); var gutil = require('gulp-util'); var wrap = require('gulp-wrap'); @@ -12,7 +11,7 @@ var WebpackDevServer = require('webpack-dev-server'); // Configuration -var srcDir = './client' +var srcDir = './client'; var buildDir = './services/nginx/static'; var langs = ['es', 'en']; @@ -33,21 +32,21 @@ gulp.task('spliting', function() { var importTpl = fs.readFileSync('./spliting/import.tpl.js', 'utf8'); var requireTpl = fs.readFileSync('./spliting/require.tpl.js', 'utf8'); - for(var modName in modules) { + for (var modName in modules) { var deps = modules[modName]; var splitFile = `${srcDir}/${modName}/src/spliting.js`; try { fs.unlinkSync(splitFile); - } - catch(e) {} + } catch (e) {} fs.appendFileSync(splitFile, importTpl); var i = deps.length; - while(i--) + while (i--) { fs.appendFileSync(splitFile, requireTpl.replace(/\$module/g, deps[i])); + } } }); @@ -67,12 +66,13 @@ gulp.task('webpack', ['spliting'], function(callback) { gulp.task('webpack-dev-server', ['spliting'], function(callback) { var configCopy = Object.create(webpackConfig); - for (var entry in configCopy.entry) + for (var entry in configCopy.entry) { configCopy.entry[entry] .unshift('webpack-dev-server/client?http://0.0.0.0:8081/'); + } var compiler = webpack(configCopy); - var devServer = new WebpackDevServer(compiler, { + new WebpackDevServer(compiler, { publicPath: '/', contentBase: buildDir, quiet: false, @@ -100,12 +100,13 @@ var localeFiles = `./${srcDir}/**/locale/*.json`; gulp.task('locales', function() { var streams = []; - for(var mod in modules) - for(var lang of langs) { - var localeFiles = `./client/${mod}/**/locale/${lang}.json`; - streams.push(gulp.src(localeFiles) - .pipe(extend(`${lang}.json`)) - .pipe(gulp.dest(`${buildDir}/locale/${mod}`))); + for (var mod in modules) { + for (var lang of langs) { + var localeFiles = `./client/${mod}/**/locale/${lang}.json`; + streams.push(gulp.src(localeFiles) + .pipe(extend(`${lang}.json`)) + .pipe(gulp.dest(`${buildDir}/locale/${mod}`))); + } } return merge(streams); diff --git a/package.json b/package.json index 8c2bdb97c..6f6e82520 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,10 @@ "cors": "^2.8.1", "css-loader": "^0.25.0", "del": "^2.2.2", - "eslint": "^3.7.1", + "eslint": "^3.16.1", "eslint-config-angular": "^0.5.0", "eslint-config-google": "^0.6.0", + "eslint-config-xo": "^0.17.0", "eslint-plugin-angular": "^1.4.1", "file-loader": "^0.9.0", "gulp": "^3.9.1", diff --git a/services/auth/.editorconfig b/services/auth/.editorconfig deleted file mode 100644 index 3ee22e5d3..000000000 --- a/services/auth/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/services/auth/.eslintignore b/services/auth/.eslintignore deleted file mode 100644 index 44f397018..000000000 --- a/services/auth/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/client/ \ No newline at end of file diff --git a/services/auth/.eslintrc b/services/auth/.eslintrc deleted file mode 100644 index a6e52975a..000000000 --- a/services/auth/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "loopback" -} \ No newline at end of file diff --git a/services/client/.editorconfig b/services/client/.editorconfig deleted file mode 100644 index 3ee22e5d3..000000000 --- a/services/client/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/services/client/.eslintignore b/services/client/.eslintignore deleted file mode 100644 index 44f397018..000000000 --- a/services/client/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/client/ \ No newline at end of file diff --git a/services/client/.eslintrc b/services/client/.eslintrc deleted file mode 100644 index a6e52975a..000000000 --- a/services/client/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "loopback" -} \ No newline at end of file diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 38d8effee..0e8e2caac 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -80,7 +80,6 @@ "description": "Send invoices by email" } }, - "validations": [], "relations": { "account": { "type": "hasOne", @@ -98,6 +97,7 @@ "where": {"name": "Verdnatura"} } }, + "validations": [], "acls": [], "methods": {} } diff --git a/services/salix/.editorconfig b/services/salix/.editorconfig deleted file mode 100644 index 3ee22e5d3..000000000 --- a/services/salix/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/services/salix/.eslintignore b/services/salix/.eslintignore deleted file mode 100644 index 44f397018..000000000 --- a/services/salix/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/client/ \ No newline at end of file diff --git a/services/salix/.eslintrc b/services/salix/.eslintrc deleted file mode 100644 index a6e52975a..000000000 --- a/services/salix/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "loopback" -} \ No newline at end of file