Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
feat(core): use ES2015
Browse files Browse the repository at this point in the history
Use native ES2015 without transpilation: no modules and no webpack.
Update eslint configuration files.
Fix linter errors.
  • Loading branch information
albertosantini committed Dec 26, 2016
1 parent 5c7983b commit ee410ae
Show file tree
Hide file tree
Showing 81 changed files with 1,218 additions and 1,137 deletions.
144 changes: 137 additions & 7 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,144 @@
root: true

parserOptions:
ecmaVersion: 8

env:
es6: true
node: true

extends: "eslint"
extends:
"eslint:recommended"

rules:
consistent-return: 0
new-cap: [2, {capIsNew: false}]
no-use-before-define: [2, "nofunc"]
require-jsdoc: 0
space-before-function-paren: [2, {"anonymous": "always", "named": "never"}]
spaced-comment: [0, "always", { exceptions: ["-"]}]
array-callback-return: "error"
arrow-body-style: ["error", "as-needed"]
arrow-parens: ["error", "as-needed"]
arrow-spacing: "error"
indent: ["error", 4, {SwitchCase: 1}]
block-spacing: "error"
brace-style: ["error", "1tbs"]
camelcase: ["error", { properties: "never" }]
callback-return: ["error", ["cb", "callback", "next"]]
class-methods-use-this: "error"
comma-spacing: "error"
comma-style: ["error", "last"]
consistent-return: "error"
curly: ["error", "all"]
default-case: "error"
dot-notation: ["error", { allowKeywords: true }]
eol-last: "error"
eqeqeq: "error"
func-call-spacing: "error"
func-style: ["error", "declaration"]
generator-star-spacing: "error"
guard-for-in: "error"
key-spacing: ["error", { beforeColon: false, afterColon: true }]
keyword-spacing: "error"
lines-around-comment: ["error", {
beforeBlockComment: true,
afterBlockComment: false,
beforeLineComment: true,
afterLineComment: false
}]
new-cap: "error"
newline-after-var: "error"
new-parens: "error"
no-alert: "error"
no-array-constructor: "error"
no-caller: "error"
no-confusing-arrow: "error"
no-console: "error"
no-delete-var: "error"
no-eval: "error"
no-extend-native: "error"
no-extra-bind: "error"
no-fallthrough: "error"
no-floating-decimal: "error"
no-global-assign: "error"
no-implied-eval: "error"
no-invalid-this: "error"
no-iterator: "error"
no-label-var: "error"
no-labels: "error"
no-lone-blocks: "error"
no-loop-func: "error"
no-mixed-spaces-and-tabs: ["error", false]
no-multi-spaces: "error"
no-multi-str: "error"
no-native-reassign: "off"
no-nested-ternary: "error"
no-new: "error"
no-new-func: "error"
no-new-object: "error"
no-new-wrappers: "error"
no-octal: "error"
no-octal-escape: "error"
no-process-exit: "error"
no-proto: "error"
no-redeclare: "error"
no-return-assign: "error"
no-script-url: "error"
no-self-assign: "error"
no-sequences: "error"
no-shadow: "error"
no-shadow-restricted-names: "error"
no-tabs: "error"
no-trailing-spaces: "error"
no-undef: ["error", {typeof: true}]
no-undef-init: "error"
no-undefined: "error"
no-underscore-dangle: ["error", {allowAfterThis: true}]
no-unmodified-loop-condition: "error"
no-unused-expressions: "error"
no-unused-vars: ["error", {vars: "all", args: "after-used"}]
# no-use-before-define: "error"
no-use-before-define: ["error", "nofunc"]
no-useless-computed-key: "error"
no-useless-concat: "error"
no-useless-constructor: "error"
no-useless-escape: "error"
no-useless-return: "error"
no-with: "error"
no-var: "error"
object-curly-spacing: ["error", "always"]
object-shorthand: "error"
one-var-declaration-per-line: "error"
prefer-arrow-callback: "error"
prefer-const: "error"
prefer-template: "error"
quotes: ["error", "double"]
quote-props: ["error", "as-needed"]
radix: "error"
# require-jsdoc: "error"
require-jsdoc: "off"
semi: "error"
semi-spacing: ["error", {before: false, after: true}]
space-before-blocks: "error"
space-before-function-paren: ["error", "never"]
space-in-parens: "error"
space-infix-ops: "error"
space-unary-ops: ["error", {words: true, nonwords: false}]
spaced-comment: ["error", "always", { exceptions: ["-"]}]
strict: ["error", "global"]
template-curly-spacing: ["error", "never"]
valid-jsdoc: ["error", {
prefer: { "return": "returns"},
preferType: {
"String": "string",
"Number": "number",
"Boolean": "boolean",
"object": "Object",
"function": "Function"
}
}]
wrap-iife: "error"
yield-star-spacing: "error"
yoda: ["error", "never"]

# Previously on by default in node environment
no-catch-shadow: "off"
no-mixed-requires: "error"
no-new-require: "error"
no-path-concat: "error"
handle-callback-err: ["error", "err"]
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

module.exports = function (config) {
module.exports = config => {
config.set({

basePath: "",
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";

var electron = require("electron");
var app = electron.app;
var BrowserWindow = electron.BrowserWindow;
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;

var mainWindow;
let mainWindow;

function createWindow() {
mainWindow = new BrowserWindow({
Expand All @@ -19,7 +19,7 @@ function createWindow() {

mainWindow.loadURL("http://localhost:8000");

mainWindow.on("closed", function () {
mainWindow.on("closed", () => {
mainWindow = null;
});
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"devDependencies": {
"conventional-changelog-cli": "~1.2.0",
"eslint": "^3.12.2",
"eslint-config-eslint": "~3.0.0",
"eslint-plugin-angular": "~1.5.1",
"mocha": "~3.2.0",
"chai": "~3.5.0",
Expand Down
49 changes: 44 additions & 5 deletions src/client/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ env:
browser: true
mocha: true

rules:
angular/controller-name:
- 2
- "/[A-Z].*$/"

globals:
angular: false
d3: false
Expand All @@ -17,3 +12,47 @@ globals:

plugins:
- angular

rules:
angular/angularelement: "warn"
angular/controller-as: "error"
angular/controller-as-route: "error"
angular/controller-as-vm: ["error", "vm"]
angular/controller-name: ["error", "/[A-Z].*Controller$/"]
angular/deferred: "off"
angular/definedundefined: "error"
angular/di: ["error", "function"]
angular/di-order: ["off", true]
angular/directive-name: "off"
angular/component-limit: ["off", 1]
angular/document-service: "error"
angular/empty-controller: "off"
angular/file-name: "off"
angular/filter-name: "off"
angular/foreach: "off"
angular/function-type: "off"
angular/interval-service: "error"
angular/json-functions: "error"
angular/log: "error"
angular/module-getter: "error"
angular/module-name: "off"
angular/module-setter: "error"
angular/no-angular-mock: "off"
angular/no-controller: "off"
angular/no-cookiestore: "error"
angular/no-jquery-angularelement: "error"
angular/no-private-call: "error"
angular/no-service-method: "error"
angular/no-services: ["error", ["$http", "$resource", "Restangular"]]
angular/on-watch: "error"
angular/rest-service: "off"
angular/service-name: "error"
angular/timeout-service: "error"
angular/typecheck-array: "error"
angular/typecheck-date: "error"
angular/typecheck-function: "error"
angular/typecheck-number: "error"
angular/typecheck-object: "error"
angular/typecheck-string: "error"
angular/watchers-execution: ["off", "$digest"]
angular/window-service: "error"
6 changes: 3 additions & 3 deletions src/client/app/common/app.component.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";

(function () {
var app = {
{
const app = {
templateUrl: "app/common/app.html",
controller: "AppController"
};

angular
.module("common")
.component("app", app);
}());
}
16 changes: 8 additions & 8 deletions src/client/app/common/app.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"use strict";

(function () {
{
angular
.module("common")
.config(config);

config.$inject = ["$httpProvider", "$locationProvider"];
function config($httpProvider, $locationProvider) {
var interceptors = $httpProvider.interceptors;
const interceptors = $httpProvider.interceptors;

interceptors.push(["$q", "$rootScope", function ($q, $rootScope) {
var nLoadings = 0;
interceptors.push(["$q", "$rootScope", ($q, $rootScope) => {
let nLoadings = 0;

return {
request: function (request) {
request(request) {
nLoadings += 1;

$rootScope.isLoadingView = true;

return request;
},

"response": function (response) {
response(response) {
nLoadings -= 1;
if (nLoadings === 0) {
$rootScope.isLoadingView = false;
Expand All @@ -30,7 +30,7 @@
return response;
},

"responseError": function (response) {
responseError(response) {
nLoadings -= 1;
if (!nLoadings) {
$rootScope.isLoadingView = false;
Expand All @@ -44,4 +44,4 @@
$locationProvider.html5Mode(true);
}

}());
}
10 changes: 5 additions & 5 deletions src/client/app/common/app.controller.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
"use strict";

(function () {
{
angular
.module("common")
.controller("AppController", AppController);

AppController.$inject = [];
function AppController() {
var vm = this;
const vm = this;

vm.tabSelectedIndex = 0;

vm.next = function () {
vm.next = () => {
vm.tabSelectedIndex = Math.min(vm.tabSelectedIndex + 1, 6);
};
vm.previous = function () {
vm.previous = () => {
vm.tabSelectedIndex = Math.max(vm.tabSelectedIndex - 1, 0);
};
}

}());
}
6 changes: 3 additions & 3 deletions src/client/app/components/account/account.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

(function () {
{
angular
.module("components.account")
.component("account", {
Expand All @@ -10,9 +10,9 @@

Account.$inject = ["accountsService"];
function Account(accountService) {
var vm = this;
const vm = this;

vm.account = accountService.getAccount();
}

}());
}
7 changes: 2 additions & 5 deletions src/client/app/components/account/account.module.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
"use strict";

(function () {
angular
.module("components.account", []);

}());
angular
.module("components.account", []);
Loading

0 comments on commit ee410ae

Please sign in to comment.