Fix incompatible object/array property types (3 of 3) (#19510)

This commit is contained in:
Steve Repsher 2024-01-22 12:03:42 -05:00 committed by GitHub
parent 349344161a
commit 634122657c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
56 changed files with 95 additions and 76 deletions

View File

@ -27,7 +27,7 @@ export class StateHistoryChartLine extends LitElement {
@property({ attribute: false }) public data: LineChartEntity[] = [];
@property() public names?: Record<string, string>;
@property({ attribute: false }) public names?: Record<string, string>;
@property() public unit?: string;

View File

@ -25,7 +25,7 @@ export class StateHistoryChartTimeline extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() public names?: Record<string, string>;
@property({ attribute: false }) public names?: Record<string, string>;
@property() public unit?: string;

View File

@ -54,10 +54,9 @@ export class StateHistoryCharts extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() public names?: Record<string, string>;
@property({ attribute: false }) public names?: Record<string, string>;
@property({ type: Boolean, attribute: "virtualize", reflect: true })
public virtualize = false;
@property({ type: Boolean, reflect: true }) public virtualize = false;
@property({ attribute: false }) public endTime?: Date;

View File

@ -54,7 +54,7 @@ export class StatisticsChart extends LitElement {
StatisticsMetaData
>;
@property() public names?: Record<string, string>;
@property({ attribute: false }) public names?: Record<string, string>;
@property() public unit?: string;

View File

@ -12,9 +12,9 @@ import "../ha-checkbox";
@customElement("ha-form-boolean")
export class HaFormBoolean extends LitElement implements HaFormElement {
@property() public schema!: HaFormBooleanSchema;
@property({ attribute: false }) public schema!: HaFormBooleanSchema;
@property() public data!: HaFormBooleanData;
@property({ attribute: false }) public data!: HaFormBooleanData;
@property() public label!: string;

View File

@ -19,12 +19,14 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
@property({ type: Boolean }) public disabled = false;
@property() public computeLabel?: (
@property({ attribute: false }) public computeLabel?: (
schema: HaFormSchema,
data?: HaFormDataContainer
) => string;
@property() public computeHelper?: (schema: HaFormSchema) => string;
@property({ attribute: false }) public computeHelper?: (
schema: HaFormSchema
) => string;
protected render() {
return html`

View File

@ -26,12 +26,14 @@ export class HaFormGrid extends LitElement implements HaFormElement {
@property({ type: Boolean }) public disabled = false;
@property() public computeLabel?: (
@property({ attribute: false }) public computeLabel?: (
schema: HaFormSchema,
data?: HaFormDataContainer
) => string;
@property() public computeHelper?: (schema: HaFormSchema) => string;
@property({ attribute: false }) public computeHelper?: (
schema: HaFormSchema
) => string;
public async focus() {
await this.updateComplete;

View File

@ -35,9 +35,9 @@ const SHOW_ALL_ENTRIES_LIMIT = 6;
@customElement("ha-form-multi_select")
export class HaFormMultiSelect extends LitElement implements HaFormElement {
@property() public schema!: HaFormMultiSelectSchema;
@property({ attribute: false }) public schema!: HaFormMultiSelectSchema;
@property() public data!: HaFormMultiSelectData;
@property({ attribute: false }) public data!: HaFormMultiSelectData;
@property() public label!: string;

View File

@ -17,7 +17,7 @@ export class HaFormSelect extends LitElement implements HaFormElement {
@property({ attribute: false }) public schema!: HaFormSelectSchema;
@property() public data!: HaFormSelectData;
@property({ attribute: false }) public data!: HaFormSelectData;
@property() public label?: string;

View File

@ -45,24 +45,34 @@ export class HaForm extends LitElement implements HaFormElement {
@property({ attribute: false }) public schema!: readonly HaFormSchema[];
@property() public error?: Record<string, string>;
@property({ attribute: false }) public error?: Record<string, string>;
@property() public warning?: Record<string, string>;
@property({ attribute: false }) public warning?: Record<string, string>;
@property({ type: Boolean }) public disabled = false;
@property() public computeError?: (schema: any, error) => string;
@property({ attribute: false }) public computeError?: (
schema: any,
error
) => string;
@property() public computeWarning?: (schema: any, warning) => string;
@property({ attribute: false }) public computeWarning?: (
schema: any,
warning
) => string;
@property() public computeLabel?: (
@property({ attribute: false }) public computeLabel?: (
schema: any,
data: HaFormDataContainer
) => string;
@property() public computeHelper?: (schema: any) => string | undefined;
@property({ attribute: false }) public computeHelper?: (
schema: any
) => string | undefined;
@property() public localizeValue?: (key: string) => string;
@property({ attribute: false }) public localizeValue?: (
key: string
) => string;
protected getFormProperties(): Record<string, any> {
return {};

View File

@ -115,7 +115,7 @@ class HaHsColorPicker extends LitElement {
@property({ type: Number, attribute: false })
public renderSize?: number;
@property({ type: Number })
@property({ type: Array })
public value?: [number, number];
@property({ type: Number })

View File

@ -8,7 +8,8 @@ export class HaSelectorConstant extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() public localizeValue?: (key: string) => string;
@property({ attribute: false })
public localizeValue?: (key: string) => string;
protected render() {
if (this.disabled) {

View File

@ -25,7 +25,7 @@ export class HaIconSelector extends LitElement {
@property({ type: Boolean }) public required = true;
@property() public context?: {
@property({ attribute: false }) public context?: {
icon_entity?: string;
};

View File

@ -32,7 +32,8 @@ export class HaSelectSelector extends LitElement {
@property() public helper?: string;
@property() public localizeValue?: (key: string) => string;
@property({ attribute: false })
public localizeValue?: (key: string) => string;
@property({ type: Boolean }) public disabled = false;

View File

@ -21,7 +21,7 @@ export class HaSelectorState extends SubscribeMixin(LitElement) {
@property({ type: Boolean }) public required = true;
@property() public context?: {
@property({ attribute: false }) public context?: {
filter_attribute?: string;
filter_entity?: string;
};

View File

@ -71,7 +71,8 @@ export class HaSelector extends LitElement {
@property() public helper?: string;
@property() public localizeValue?: (key: string) => string;
@property({ attribute: false })
public localizeValue?: (key: string) => string;
@property() public placeholder?: any;
@ -79,7 +80,7 @@ export class HaSelector extends LitElement {
@property({ type: Boolean }) public required = true;
@property() public context?: Record<string, any>;
@property({ attribute: false }) public context?: Record<string, any>;
public async focus() {
await this.updateComplete;

View File

@ -24,7 +24,7 @@ export class HaSortable extends LitElement {
@property({ type: Boolean })
public disabled = false;
@property({ type: Boolean })
@property({ type: Array })
public path?: ItemPath;
@property({ type: Boolean, attribute: "no-style" })

View File

@ -43,9 +43,10 @@ export class HaTracePathDetails extends LitElement {
@property({ attribute: false }) public selected!: NodeInfo;
@property() public renderedNodes: Record<string, any> = {};
@property({ attribute: false })
public renderedNodes: Record<string, any> = {};
@property() public trackedNodes!: Record<string, any>;
@property({ attribute: false }) public trackedNodes!: Record<string, any>;
@state() private _view: (typeof TRACE_PATH_TABS)[number] = "step_config";

View File

@ -19,7 +19,7 @@ class HaUserPicker extends LitElement {
@property() public value = "";
@property() public users?: User[];
@property({ attribute: false }) public users?: User[];
@property({ type: Boolean }) public disabled = false;

View File

@ -13,7 +13,7 @@ import "./ha-user-picker";
class HaUsersPickerLight extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public value?: string[];
@property({ attribute: false }) public value?: string[];
@property({ attribute: "picked-user-label" })
public pickedUserLabel?: string;

View File

@ -19,7 +19,7 @@ class FlowPreviewGroup extends LitElement {
@property() public flowId!: string;
@property() public stepData!: Record<string, any>;
@property({ attribute: false }) public stepData!: Record<string, any>;
@state() private _preview?: HassEntity;

View File

@ -24,7 +24,7 @@ class FlowPreviewTemplate extends LitElement {
@property() public flowId!: string;
@property() public stepData!: Record<string, any>;
@property({ attribute: false }) public stepData!: Record<string, any>;
@state() private _preview?: HassEntity;

View File

@ -26,7 +26,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
@property({ attribute: false }) public stateObj?: LightEntity;
@property() color!: LightColor;
@property({ attribute: false }) color!: LightColor;
@query("ha-outlined-icon-button", true)
private _button?: HaOutlinedIconButton;

View File

@ -11,7 +11,8 @@ import "./notification-item-template";
export class HuiConfiguratorNotificationItem extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: PersitentNotificationEntity;
@property({ attribute: false })
public notification?: PersitentNotificationEntity;
protected render() {
if (!this.hass || !this.notification) {

View File

@ -10,7 +10,8 @@ import "./persistent-notification-item";
export class HuiNotificationItem extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: HassEntity | PersistentNotification;
@property({ attribute: false })
public notification?: HassEntity | PersistentNotification;
protected shouldUpdate(changedProps: PropertyValues): boolean {
if (!this.hass || !this.notification || changedProps.has("notification")) {

View File

@ -13,7 +13,7 @@ import "./notification-item-template";
export class HuiPersistentNotificationItem extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: PersistentNotification;
@property({ attribute: false }) public notification?: PersistentNotification;
protected render() {
if (!this.hass || !this.notification) {

View File

@ -116,7 +116,7 @@ export class HaTabsSubpageDataTable extends LitElement {
* Function to call when the back button is pressed.
* @type {() => void}
*/
@property() public backCallback?: () => void;
@property({ attribute: false }) public backCallback?: () => void;
/**
* String to show when there are no records in the data table.
@ -136,7 +136,7 @@ export class HaTabsSubpageDataTable extends LitElement {
* Array of tabs to show on the page.
* @type {Array}
*/
@property() public tabs: PageNavigation[] = [];
@property({ attribute: false }) public tabs: PageNavigation[] = [];
/**
* Force hides the filter menu.

View File

@ -45,7 +45,7 @@ class HassTabsSubpage extends LitElement {
@property({ type: String, attribute: "back-path" }) public backPath?: string;
@property() public backCallback?: () => void;
@property({ attribute: false }) public backCallback?: () => void;
@property({ type: Boolean, attribute: "main-page" }) public mainPage = false;

View File

@ -39,7 +39,7 @@ export class RecurrenceRuleEditor extends LitElement {
@property() public value = "";
@property() public dtstart?: Date;
@property({ attribute: false }) public dtstart?: Date;
@property({ type: Boolean }) public allDay = false;

View File

@ -14,7 +14,7 @@ export class HaSceneAction extends LitElement implements ActionElement {
@property({ type: Boolean }) public disabled = false;
@property() public action!: SceneAction;
@property({ attribute: false }) public action!: SceneAction;
public static get defaultConfig(): SceneAction {
return {

View File

@ -54,7 +54,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
@property({ attribute: false }) public path?: ItemPath;
@property() public action!: ChooseAction;
@property({ attribute: false }) public action!: ChooseAction;
@state() private _showDefault = false;

View File

@ -18,7 +18,7 @@ export class HaConditionAction extends LitElement implements ActionElement {
@property({ type: Boolean }) public disabled = false;
@property() public action!: Condition;
@property({ attribute: false }) public action!: Condition;
public static get defaultConfig() {
return { condition: "state" };

View File

@ -16,7 +16,7 @@ export class HaEventAction extends LitElement implements ActionElement {
@property({ type: Boolean }) public disabled = false;
@property() public action!: EventAction;
@property({ attribute: false }) public action!: EventAction;
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;

View File

@ -10,7 +10,7 @@ import { ActionElement } from "../ha-automation-action-row";
export class HaStopAction extends LitElement implements ActionElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public action!: StopAction;
@property({ attribute: false }) public action!: StopAction;
@property({ type: Boolean }) public disabled = false;

View File

@ -87,7 +87,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
@property() public entityId: string | null = null;
@property() public automations!: AutomationEntity[];
@property({ attribute: false }) public automations!: AutomationEntity[];
@property({ type: Boolean }) public isWide = false;

View File

@ -79,7 +79,7 @@ class HaAutomationPicker extends LitElement {
@property({ attribute: false }) public route!: Route;
@property() public automations!: AutomationEntity[];
@property({ attribute: false }) public automations!: AutomationEntity[];
@state() private _activeFilters?: string[];

View File

@ -30,7 +30,7 @@ class HaConfigAutomation extends HassRouterPage {
@property({ type: Boolean }) public showAdvanced = false;
@property() public automations: AutomationEntity[] = [];
@property({ attribute: false }) public automations: AutomationEntity[] = [];
private _debouncedUpdateAutomations = debounce((pageEl) => {
const newAutomations = this._getAutomations(this.hass.states);

View File

@ -25,7 +25,8 @@ class HaConfigBlueprint extends HassRouterPage {
@property({ type: Boolean }) public showAdvanced = false;
@property() public blueprints: Record<string, Blueprints> = {};
@property({ attribute: false })
public blueprints: Record<string, Blueprints> = {};
protected routerOptions: RouterOptions = {
defaultPage: "dashboard",

View File

@ -36,7 +36,7 @@ export class HaDeviceEntitiesCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entities!: EntityRegistryStateEntry[];
@property({ attribute: false }) public entities!: EntityRegistryStateEntry[];
@property({ type: Boolean }) public showHidden = false;

View File

@ -66,13 +66,13 @@ export class HaConfigDeviceDashboard extends LitElement {
@property({ type: Boolean }) public isWide = false;
@property() public entries!: ConfigEntry[];
@property({ attribute: false }) public entries!: ConfigEntry[];
@state()
@consume({ context: fullEntitiesContext, subscribe: true })
entities!: EntityRegistryEntry[];
@property() public manifests!: IntegrationManifest[];
@property({ attribute: false }) public manifests!: IntegrationManifest[];
@property({ attribute: false }) public route!: Route;

View File

@ -36,7 +36,7 @@ import type { EntityRegistrySettingsEditor } from "../../entity-registry-setting
export class EntitySettingsHelperTab extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entry!: ExtEntityRegistryEntry;
@property({ attribute: false }) public entry!: ExtEntityRegistryEntry;
@state() private _error?: string;

View File

@ -141,7 +141,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() public helperConfigEntry?: ConfigEntry;
@property({ attribute: false }) public helperConfigEntry?: ConfigEntry;
@state() private _name!: string;

View File

@ -24,9 +24,9 @@ import "../../../components/ha-list-item";
export class HaConfigFlowCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public flow!: DataEntryFlowProgressExtended;
@property({ attribute: false }) public flow!: DataEntryFlowProgressExtended;
@property() public manifest?: IntegrationManifest;
@property({ attribute: false }) public manifest?: IntegrationManifest;
protected render(): TemplateResult {
const attention = ATTENTION_SOURCES.includes(this.flow.context.source);

View File

@ -116,7 +116,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
@property({ type: Boolean }) public showAdvanced = false;
@property() public configEntries?: ConfigEntry[];
@property({ attribute: false }) public configEntries?: ConfigEntry[];
@property({ attribute: false })
public configEntriesInProgress: DataEntryFlowProgressExtended[] = [];

View File

@ -16,9 +16,9 @@ import "./ha-integration-action-card";
export class HaDisabledConfigEntryCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entry!: ConfigEntryExtended;
@property({ attribute: false }) public entry!: ConfigEntryExtended;
@property() public manifest?: IntegrationManifest;
@property({ attribute: false }) public manifest?: IntegrationManifest;
protected render(): TemplateResult {
return html`

View File

@ -13,9 +13,9 @@ import "../../../components/ha-button";
export class HaIgnoredConfigEntryCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entry!: ConfigEntryExtended;
@property({ attribute: false }) public entry!: ConfigEntryExtended;
@property() public manifest?: IntegrationManifest;
@property({ attribute: false }) public manifest?: IntegrationManifest;
protected render(): TemplateResult {
return html`

View File

@ -22,7 +22,7 @@ export class HaIntegrationActionCard extends LitElement {
@property() public label!: string;
@property() public manifest?: IntegrationManifest;
@property({ attribute: false }) public manifest?: IntegrationManifest;
protected render(): TemplateResult {
return html`

View File

@ -52,7 +52,7 @@ export class HaIntegrationCard extends LitElement {
@property({ type: Boolean }) public supportsDiagnostics = false;
@property() public logInfo?: IntegrationLogInfo;
@property({ attribute: false }) public logInfo?: IntegrationLogInfo;
@queryAsync("mwc-ripple") private _ripple!: Promise<Ripple | null>;

View File

@ -10,9 +10,9 @@ import "../../../../components/ha-form/ha-form";
export class AssistPipelineDetailConfig extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public data?: Partial<AssistPipeline>;
@property({ attribute: false }) public data?: Partial<AssistPipeline>;
@property() public supportedLanguages?: string[];
@property({ type: Array }) public supportedLanguages?: string[];
public async focus() {
await this.updateComplete;

View File

@ -11,7 +11,7 @@ import { fireEvent } from "../../../../common/dom/fire_event";
export class AssistPipelineDetailConversation extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public data?: Partial<AssistPipeline>;
@property({ attribute: false }) public data?: Partial<AssistPipeline>;
@state() private _supportedLanguages?: "*" | string[];

View File

@ -10,7 +10,7 @@ import "../../../../components/ha-form/ha-form";
export class AssistPipelineDetailSTT extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public data?: Partial<AssistPipeline>;
@property({ attribute: false }) public data?: Partial<AssistPipeline>;
@state() private _supportedLanguages?: string[];

View File

@ -12,7 +12,7 @@ import { HomeAssistant } from "../../../../types";
export class AssistPipelineDetailTTS extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public data?: Partial<AssistPipeline>;
@property({ attribute: false }) public data?: Partial<AssistPipeline>;
@state() private _supportedLanguages?: string[];

View File

@ -20,7 +20,7 @@ import { fireEvent } from "../../../../common/dom/fire_event";
export class AssistPipelineDetailWakeWord extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public data?: Partial<AssistPipeline>;
@property({ attribute: false }) public data?: Partial<AssistPipeline>;
@state() private _wakeWords?: WakeWord[];

View File

@ -13,7 +13,7 @@ import "./assist-render-pipeline-run";
export class AssistPipelineEvents extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public events!: PipelineRunEvent[];
@property({ attribute: false }) public events!: PipelineRunEvent[];
private _processEvents = memoizeOne(
(events: PipelineRunEvent[]): PipelineRun | undefined => {

View File

@ -138,7 +138,7 @@ const dataMinusKeysRender = (
export class AssistPipelineDebug extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public pipelineRun!: PipelineRun;
@property({ attribute: false }) public pipelineRun!: PipelineRun;
protected render(): TemplateResult {
const lastRunStage: string = this.pipelineRun

View File

@ -40,7 +40,6 @@
// Binding types
"no-incompatible-type-binding": "warning",
// LitElement
"no-incompatible-property-type": "warning",
"no-property-visibility-mismatch": "error",
// CSS
"no-invalid-css": "off", // warning does not work