mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Update eslint config
This commit is contained in:
parent
11311809c1
commit
3af16b2650
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "airbnb/base",
|
||||
"extends": "airbnb-base",
|
||||
"globals": {
|
||||
"__DEV__": false,
|
||||
"__DEMO__": false
|
||||
|
@ -31,8 +31,9 @@
|
||||
"bower": "^1.7.9",
|
||||
"classnames": "^2.2.3",
|
||||
"eslint": "^2.8.0",
|
||||
"eslint-config-airbnb": "^7.0.0",
|
||||
"html-minifier": "^1.5.0",
|
||||
"eslint-config-airbnb-base": "^1.0.4",
|
||||
"eslint-plugin-import": "^1.6.1",
|
||||
"vulcanize": "^1.14.8",
|
||||
"webpack": "^1.13"
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ export default new Polymer({
|
||||
const newVal = ev.target.checked;
|
||||
|
||||
if (newVal && !this.isOn) {
|
||||
this._call_service(true);
|
||||
this.callService(true);
|
||||
} else if (!newVal && this.isOn) {
|
||||
this._call_service(false);
|
||||
this.callService(false);
|
||||
}
|
||||
},
|
||||
|
||||
@ -59,11 +59,11 @@ export default new Polymer({
|
||||
},
|
||||
|
||||
turnOn() {
|
||||
this._call_service(true);
|
||||
this.callService(true);
|
||||
},
|
||||
|
||||
turnOff() {
|
||||
this._call_service(false);
|
||||
this.callService(false);
|
||||
},
|
||||
|
||||
computeIsOn(stateObj) {
|
||||
@ -74,7 +74,7 @@ export default new Polymer({
|
||||
// with the state. It will be out of sync if our service call did not
|
||||
// result in the entity to be turned on. Since the state is not changing,
|
||||
// the resync is not called automatic.
|
||||
_call_service(turnOn) {
|
||||
callService(turnOn) {
|
||||
let domain;
|
||||
let service;
|
||||
|
||||
|
@ -53,25 +53,25 @@
|
||||
|
||||
<template>
|
||||
<div class='main'>
|
||||
<template is='dom-if' if='[[cards._badges]]'>
|
||||
<template is='dom-if' if='[[cards.badges]]'>
|
||||
<div class='badges'>
|
||||
<template is='dom-if' if='[[cards._demo]]'>
|
||||
<template is='dom-if' if='[[cards.demo]]'>
|
||||
<ha-demo-badge></ha-demo-badge>
|
||||
</template>
|
||||
|
||||
<ha-badges-card states='[[cards._badges]]'></ha-badges-card>
|
||||
<ha-badges-card states='[[cards.badges]]'></ha-badges-card>
|
||||
</div>
|
||||
</template>
|
||||
<template is='dom-if' if='[[!cards._badges]]'>
|
||||
<template is='dom-if' if='[[!cards.badges]]'>
|
||||
<div class='no-badges'> </div>
|
||||
</template>
|
||||
|
||||
<div class='horizontal layout center-justified'>
|
||||
<template is='dom-repeat' items='[[cards._columns]]' as='column'>
|
||||
<template is='dom-repeat' items='[[cards.columns]]' as='column'>
|
||||
<div class='column flex-1'>
|
||||
<template is='dom-repeat' items='[[column]]' as='card'>
|
||||
<div class='zone-card'>
|
||||
<ha-card-chooser card-data='[[computeCardDataOfCard(cards, card)]]'
|
||||
<ha-card-chooser card-data='[[card]]'
|
||||
></ha-card-chooser>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -76,13 +76,13 @@ export default new Polymer({
|
||||
const hasGroup = {};
|
||||
|
||||
const cards = {
|
||||
_demo: false,
|
||||
_badges: [],
|
||||
_columns: [],
|
||||
demo: false,
|
||||
badges: [],
|
||||
columns: [],
|
||||
};
|
||||
const entityCount = [];
|
||||
for (let idx = 0; idx < columns; idx++) {
|
||||
cards._columns.push([]);
|
||||
cards.columns.push([]);
|
||||
entityCount.push(0);
|
||||
}
|
||||
|
||||
@ -108,11 +108,10 @@ export default new Polymer({
|
||||
return minIndex;
|
||||
}
|
||||
if (showIntroduction) {
|
||||
cards._columns[getIndex(5)].push('ha-introduction');
|
||||
cards['ha-introduction'] = {
|
||||
cards.columns[getIndex(5)].push({
|
||||
cardType: 'introduction',
|
||||
showHideInstruction: states.size > 0 && !__DEMO__,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function addEntitiesCard(name, entities, groupEntity = false) {
|
||||
@ -139,35 +138,33 @@ export default new Polymer({
|
||||
const curIndex = getIndex(size);
|
||||
|
||||
if (other.length > 0) {
|
||||
cards._columns[curIndex].push(name);
|
||||
cards[name] = {
|
||||
cards.columns[curIndex].push({
|
||||
cardType: 'entities',
|
||||
states: other,
|
||||
groupEntity,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
owncard.forEach(entity => {
|
||||
cards._columns[curIndex].push(entity.entityId);
|
||||
cards[entity.entityId] = {
|
||||
cards.columns[curIndex].push({
|
||||
cardType: entity.domain,
|
||||
stateObj: entity,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
byDomain.keySeq().sortBy(domain => getPriority(domain))
|
||||
.forEach(domain => {
|
||||
if (domain === 'a') {
|
||||
cards._demo = true;
|
||||
cards.demo = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const priority = getPriority(domain);
|
||||
|
||||
if (priority >= 0 && priority < 10) {
|
||||
cards._badges.push.apply(
|
||||
cards._badges, filterGrouped(byDomain.get(domain)).sortBy(
|
||||
cards.badges.push.apply(
|
||||
cards.badges, filterGrouped(byDomain.get(domain)).sortBy(
|
||||
entitySortBy).toArray());
|
||||
} else if (domain === 'group') {
|
||||
byDomain.get(domain).sortBy(entitySortBy)
|
||||
@ -185,12 +182,8 @@ export default new Polymer({
|
||||
);
|
||||
|
||||
// Remove empty columns
|
||||
cards._columns = cards._columns.filter(val => val.length > 0);
|
||||
cards.columns = cards.columns.filter(val => val.length > 0);
|
||||
|
||||
return cards;
|
||||
},
|
||||
|
||||
computeCardDataOfCard(cards, card) {
|
||||
return cards[card];
|
||||
},
|
||||
});
|
||||
|
@ -35,11 +35,11 @@ export default new Polymer({
|
||||
},
|
||||
|
||||
attached() {
|
||||
this._interval = setInterval(this.updateRelative, UPDATE_INTERVAL);
|
||||
this.updateInterval = setInterval(this.updateRelative, UPDATE_INTERVAL);
|
||||
},
|
||||
|
||||
detached() {
|
||||
clearInterval(this._interval);
|
||||
clearInterval(this.updateInterval);
|
||||
},
|
||||
|
||||
datetimeChanged(newVal) {
|
||||
|
@ -39,10 +39,10 @@ export default new Polymer({
|
||||
|
||||
isLoadingHistoryData: {
|
||||
type: Boolean,
|
||||
computed: 'computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData)',
|
||||
computed: 'computeIsLoadingHistoryData(delayedDialogOpen, isLoadingEntityHistoryData)',
|
||||
},
|
||||
|
||||
_isLoadingHistoryData: {
|
||||
isLoadingEntityHistoryData: {
|
||||
type: Boolean,
|
||||
bindNuclear: entityHistoryGetters.isLoadingEntityHistory,
|
||||
},
|
||||
@ -71,7 +71,7 @@ export default new Polymer({
|
||||
observer: 'dialogOpenChanged',
|
||||
},
|
||||
|
||||
_delayedDialogOpen: {
|
||||
delayedDialogOpen: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
@ -83,8 +83,8 @@ export default new Polymer({
|
||||
* before the dialog is attached to the screen and is unable to determine
|
||||
* graph size resulting in scroll bars.
|
||||
*/
|
||||
computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData) {
|
||||
return !_delayedDialogOpen || _isLoadingHistoryData;
|
||||
computeIsLoadingHistoryData(delayedDialogOpen, isLoadingEntityHistoryData) {
|
||||
return !delayedDialogOpen || isLoadingEntityHistoryData;
|
||||
},
|
||||
|
||||
computeShowHistoryComponent(hasHistoryComponent, stateObj) {
|
||||
@ -116,10 +116,10 @@ export default new Polymer({
|
||||
|
||||
dialogOpenChanged(newVal) {
|
||||
if (newVal) {
|
||||
this.async(() => { this._delayedDialogOpen = true; }, 10);
|
||||
this.async(() => { this.delayedDialogOpen = true; }, 10);
|
||||
} else if (!newVal && this.stateObj) {
|
||||
this.async(() => moreInfoActions.deselectEntity(), 10);
|
||||
this._delayedDialogOpen = false;
|
||||
this.delayedDialogOpen = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ export default function NuclearObserver(reactor) {
|
||||
return {
|
||||
|
||||
attached() {
|
||||
this.__unwatchFns = Object.keys(this.properties).reduce(
|
||||
this.nuclearUnwatchFns = Object.keys(this.properties).reduce(
|
||||
(unwatchFns, key) => {
|
||||
if (!('bindNuclear' in this.properties[key])) {
|
||||
return unwatchFns;
|
||||
@ -20,8 +20,8 @@ export default function NuclearObserver(reactor) {
|
||||
},
|
||||
|
||||
detached() {
|
||||
while (this.__unwatchFns.length) {
|
||||
this.__unwatchFns.shift()();
|
||||
while (this.nuclearUnwatchFns.length) {
|
||||
this.nuclearUnwatchFns.shift()();
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user