Update and fix linting

This commit is contained in:
Paulus Schoutsen 2016-02-28 00:30:01 -08:00
parent 0b608c586c
commit c580a9eb89
11 changed files with 16 additions and 22 deletions

View File

@ -1,12 +1,7 @@
{ {
"parser": "babel-eslint",
"extends": "airbnb/base", "extends": "airbnb/base",
"globals": { "globals": {
"__DEV__": false, "__DEV__": false,
"__DEMO__": false "__DEMO__": false
},
"rules": {
"comma-dangle": [2, "always-multiline"],
"no-underscore-dangle": 0
} }
} }

View File

@ -20,18 +20,17 @@
"author": "Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> (http://paulusschoutsen.nl)", "author": "Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> (http://paulusschoutsen.nl)",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"home-assistant-js": "git+https://github.com/balloob/home-assistant-js.git#cd46830c19d3e9593d112def0202a832afa4d839", "home-assistant-js": "git+https://github.com/balloob/home-assistant-js.git#9a93089d0e3e41cecb3c6e99d5672341ca6d4152",
"lodash": "^4.5.0", "lodash": "^4.5.0",
"moment": "^2.11.2" "moment": "^2.11.2"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.5", "babel-core": "^6.5",
"babel-eslint": "^5.0.0",
"babel-loader": "^6.2", "babel-loader": "^6.2",
"babel-preset-es2015": "^6.3.13", "babel-preset-es2015": "^6.3.13",
"bower": "^1.7.7", "bower": "^1.7.7",
"eslint": "^1.10.3", "eslint": "^2.2.0",
"eslint-config-airbnb": "^5.0.0", "eslint-config-airbnb": "^6.0.2",
"html-minifier": "^1.2.0", "html-minifier": "^1.2.0",
"vulcanize": "^1.14.6", "vulcanize": "^1.14.6",
"webpack": "^1.12" "webpack": "^1.12"

View File

@ -62,7 +62,7 @@ export default new Polymer({
updateCards(columns, states, showIntroduction) { updateCards(columns, states, showIntroduction) {
this.debounce( this.debounce(
'updateCards', 'updateCards',
() => this.cards = this.computeCards(columns, states, showIntroduction), () => { this.cards = this.computeCards(columns, states, showIntroduction); },
0 0
); );
}, },
@ -147,7 +147,7 @@ export default new Polymer({
byDomain.get(domain).sortBy(entitySortBy) byDomain.get(domain).sortBy(entitySortBy)
.forEach(groupState => { .forEach(groupState => {
const entities = util.expandGroup(groupState, states); const entities = util.expandGroup(groupState, states);
entities.forEach(entity => hasGroup[entity.entityId] = true); entities.forEach(entity => { hasGroup[entity.entityId] = true; });
addEntitiesCard(groupState.entityId, entities.toArray(), groupState); addEntitiesCard(groupState.entityId, entities.toArray(), groupState);
} }
); );

View File

@ -55,7 +55,7 @@ export default new Polymer({
} }
this.mouseMoveIsThrottled = false; this.mouseMoveIsThrottled = false;
this.processColorSelect(ev.touches[0]); this.processColorSelect(ev.touches[0]);
this.async(() => this.mouseMoveIsThrottled = true, 100); this.async(() => { this.mouseMoveIsThrottled = true; }, 100);
}, },
onMouseMove(ev) { onMouseMove(ev) {
@ -64,7 +64,7 @@ export default new Polymer({
} }
this.mouseMoveIsThrottled = false; this.mouseMoveIsThrottled = false;
this.processColorSelect(ev); this.processColorSelect(ev);
this.async(() => this.mouseMoveIsThrottled = true, 100); this.async(() => { this.mouseMoveIsThrottled = true; }, 100);
}, },
processColorSelect(ev) { processColorSelect(ev) {

View File

@ -70,7 +70,9 @@ export default new Polymer({
if (stateInfo.length === 0) return; if (stateInfo.length === 0) return;
const entityDisplay = stateInfo[0].entityDisplay; const entityDisplay = stateInfo[0].entityDisplay;
/* eslint-disable prefer-const */
let newLastChanged; let newLastChanged;
/* eslint-enable prefer-const */
let prevState = null; let prevState = null;
let prevLastChanged = null; let prevLastChanged = null;

View File

@ -81,7 +81,7 @@ export default new Polymer({
googleApiLoaded() { googleApiLoaded() {
window.google.load('visualization', '1', { window.google.load('visualization', '1', {
packages: ['timeline', 'corechart'], packages: ['timeline', 'corechart'],
callback: () => this.apiLoaded = true, callback: () => { this.apiLoaded = true; },
}); });
}, },

View File

@ -116,7 +116,7 @@ export default new Polymer({
dialogOpenChanged(newVal) { dialogOpenChanged(newVal) {
if (newVal) { if (newVal) {
this.async(() => this._delayedDialogOpen = true, 10); this.async(() => { this._delayedDialogOpen = true; }, 10);
} else if (!newVal && this.stateObj) { } else if (!newVal && this.stateObj) {
this.async(() => moreInfoActions.deselectEntity(), 10); this.async(() => moreInfoActions.deselectEntity(), 10);
this._delayedDialogOpen = false; this._delayedDialogOpen = false;

View File

@ -58,10 +58,10 @@ export default new Polymer({
loadIcons() { loadIcons() {
// If the import fails, we'll try to import again, must be a server glitch // If the import fails, we'll try to import again, must be a server glitch
// Since HTML imports only resolve once, we import another url. // Since HTML imports only resolve once, we import another url.
const success = () => this.iconsLoaded = true; const success = () => { this.iconsLoaded = true; };
this.importHref(`/static/mdi-${this.icons}.html`, this.importHref(`/static/mdi-${this.icons}.html`,
success, success,
() => this.importHref(`/static/mdi.html`, success, success)); () => this.importHref('/static/mdi.html', success, success));
}, },
created() { created() {

View File

@ -140,9 +140,7 @@ export default new Polymer({
}, },
computeRefreshButtonClass(isFetching) { computeRefreshButtonClass(isFetching) {
if (isFetching) { return isFetching ? 'ha-spin' : '';
return 'ha-spin';
}
}, },
computeShowIntroduction(currentView, introductionLoaded, states) { computeShowIntroduction(currentView, introductionLoaded, states) {

View File

@ -57,6 +57,6 @@ export default new Polymer({
this.errorLog = 'Loading error log…'; this.errorLog = 'Loading error log…';
errorLogActions.fetchErrorLog().then( errorLogActions.fetchErrorLog().then(
log => this.errorLog = log || 'No errors have been reported.'); log => { this.errorLog = log || 'No errors have been reported.'; });
}, },
}); });

View File

@ -14,7 +14,7 @@ export default function dynamicContentUpdater(root, newElementTag, attributes) {
customEl = document.createElement(newElementTag); customEl = document.createElement(newElementTag);
} }
Object.keys(attributes).forEach(key => customEl[key] = attributes[key]); Object.keys(attributes).forEach(key => { customEl[key] = attributes[key]; });
if (customEl.parentNode === null) { if (customEl.parentNode === null) {
rootEl.appendChild(customEl); rootEl.appendChild(customEl);