diff --git a/demo/src/custom-cards/cast-demo-row.ts b/demo/src/custom-cards/cast-demo-row.ts index e948d85a7c28..a011cb756edf 100644 --- a/demo/src/custom-cards/cast-demo-row.ts +++ b/demo/src/custom-cards/cast-demo-row.ts @@ -46,7 +46,6 @@ class CastDemoRow extends LitElement implements LovelaceRow { this.requestUpdate(); }); mgr.castContext.addEventListener( - // eslint-disable-next-line no-undef cast.framework.CastContextEventType.SESSION_STATE_CHANGED, (ev) => { // On Android, opening a new session always results in SESSION_RESUMED. diff --git a/eslint.config.mjs b/eslint.config.mjs index deb3af0a2d00..4bc8a57fc3c4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -114,13 +114,7 @@ export default [ "@typescript-eslint/no-shadow": ["error"], "@typescript-eslint/naming-convention": [ - "off", - { - selector: "default", - format: ["camelCase", "snake_case"], - leadingUnderscore: "allow", - trailingUnderscore: "allow", - }, + "warn", { selector: ["variable"], format: ["camelCase", "snake_case", "UPPER_CASE"], @@ -131,6 +125,18 @@ export default [ selector: "typeLike", format: ["PascalCase"], }, + { + selector: "method", + modifiers: ["public"], + format: ["camelCase"], + leadingUnderscore: "forbid", + }, + { + selector: "method", + modifiers: ["private"], + format: ["camelCase"], + leadingUnderscore: "require", + }, ], "@typescript-eslint/no-unused-vars": "off", diff --git a/gallery/src/pages/automation/editor-condition.ts b/gallery/src/pages/automation/editor-condition.ts index e30a1044043f..22f83d774478 100644 --- a/gallery/src/pages/automation/editor-condition.ts +++ b/gallery/src/pages/automation/editor-condition.ts @@ -1,4 +1,3 @@ -/* eslint-disable lit/no-template-arrow */ import type { TemplateResult } from "lit"; import { LitElement, html, css } from "lit"; import { customElement, state } from "lit/decorators"; diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts index 08556fc12c0e..a63348539617 100644 --- a/gallery/src/pages/components/ha-selector.ts +++ b/gallery/src/pages/components/ha-selector.ts @@ -1,4 +1,3 @@ -/* eslint-disable lit/no-template-arrow */ import "@material/mwc-button"; import type { TemplateResult } from "lit"; import { css, html, LitElement } from "lit"; diff --git a/src/common/dom/fire_event.ts b/src/common/dom/fire_event.ts index a72bb67ea529..d1f71b8bc343 100644 --- a/src/common/dom/fire_event.ts +++ b/src/common/dom/fire_event.ts @@ -29,7 +29,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. declare global { - // eslint-disable-next-line interface HASSDomEvents {} } diff --git a/src/common/dom/scroll-to-target.ts b/src/common/dom/scroll-to-target.ts index 3feabad86c8e..f351028747a8 100644 --- a/src/common/dom/scroll-to-target.ts +++ b/src/common/dom/scroll-to-target.ts @@ -14,10 +14,8 @@ export default function scrollToTarget(element, target) { const top = 0; const scroller = target; const easingFn = function easeOutQuad(t, b, c, d) { - /* eslint-disable no-param-reassign, space-infix-ops, no-mixed-operators */ t /= d; return -c * t * (t - 2) + b; - /* eslint-enable no-param-reassign, space-infix-ops, no-mixed-operators */ }; const animationId = Math.random(); const duration = 200; diff --git a/src/components/ha-ansi-to-html.ts b/src/components/ha-ansi-to-html.ts index 5956303ab415..78617ab9be6a 100644 --- a/src/components/ha-ansi-to-html.ts +++ b/src/components/ha-ansi-to-html.ts @@ -183,7 +183,7 @@ export class HaAnsiToHtml extends LitElement { /* eslint-disable no-cond-assign */ let match; - // eslint-disable-next-line + while ((match = re.exec(line)) !== null) { const j = match!.index; const substring = line.substring(i, j); diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index 18cf44a0a894..bc20aff73722 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -1,4 +1,3 @@ -/* eslint-disable lit/prefer-static-styles */ import { mdiEye, mdiEyeOff } from "@mdi/js"; import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { LitElement, css, html, nothing } from "lit"; diff --git a/src/components/ha-navigation-picker.ts b/src/components/ha-navigation-picker.ts index 640a036067eb..40967c5a3adc 100644 --- a/src/components/ha-navigation-picker.ts +++ b/src/components/ha-navigation-picker.ts @@ -20,7 +20,6 @@ type NavigationItem = { const DEFAULT_ITEMS: NavigationItem[] = []; -// eslint-disable-next-line lit/prefer-static-styles const rowRenderer: ComboBoxLitRenderer = (item) => html` diff --git a/src/data/onboarding.ts b/src/data/onboarding.ts index 0df2891bbf38..cfdf7fd21eb3 100644 --- a/src/data/onboarding.ts +++ b/src/data/onboarding.ts @@ -10,7 +10,6 @@ export interface InstallationType { | "Unknown"; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface OnboardingCoreConfigStepResponse {} export interface OnboardingUserStepResponse { @@ -21,7 +20,6 @@ export interface OnboardingIntegrationStepResponse { auth_code: string; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface OnboardingAnalyticsStepResponse {} export interface OnboardingResponses { diff --git a/src/dialogs/restart/show-dialog-restart.ts b/src/dialogs/restart/show-dialog-restart.ts index 794209818e06..d78633b81b9e 100644 --- a/src/dialogs/restart/show-dialog-restart.ts +++ b/src/dialogs/restart/show-dialog-restart.ts @@ -1,6 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface RestartDialogParams {} export const loadRestartDialog = () => import("./dialog-restart"); diff --git a/src/entrypoints/service-worker.ts b/src/entrypoints/service-worker.ts index 889efdde1df7..70413a8c4950 100644 --- a/src/entrypoints/service-worker.ts +++ b/src/entrypoints/service-worker.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/triple-slash-reference */ -// eslint-disable-next-line spaced-comment + /// /* eslint-env serviceworker */ import type { RouteHandler } from "workbox-core"; diff --git a/src/layouts/home-assistant-main.ts b/src/layouts/home-assistant-main.ts index 71b7535e68ba..5445fa9c5883 100644 --- a/src/layouts/home-assistant-main.ts +++ b/src/layouts/home-assistant-main.ts @@ -1,4 +1,3 @@ -/* eslint-disable lit/prefer-static-styles */ import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; diff --git a/src/panels/config/cloud/account/cloud-remote-pref.ts b/src/panels/config/cloud/account/cloud-remote-pref.ts index 3bf946b05734..1b0cd900f606 100644 --- a/src/panels/config/cloud/account/cloud-remote-pref.ts +++ b/src/panels/config/cloud/account/cloud-remote-pref.ts @@ -13,7 +13,7 @@ import "../../../../components/ha-radio"; import "../../../../components/ha-settings-row"; import "../../../../components/ha-switch"; import "../../../../components/ha-textfield"; -// eslint-disable-next-line + import { formatDate } from "../../../../common/datetime/format_date"; import type { HaSwitch } from "../../../../components/ha-switch"; import type { CloudStatusLoggedIn } from "../../../../data/cloud"; diff --git a/src/panels/lovelace/cards/hui-card.ts b/src/panels/lovelace/cards/hui-card.ts index 8692e34dd1d5..f254bd28f347 100644 --- a/src/panels/lovelace/cards/hui-card.ts +++ b/src/panels/lovelace/cards/hui-card.ts @@ -87,7 +87,7 @@ export class HuiCard extends ReactiveElement { } if (this._element.getLayoutOptions) { // Disabled for now to avoid spamming the console, need to be re-enabled when hui-card performance are fixed - // eslint-disable-next-line no-console + // console.warn( // `This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead` // ); diff --git a/src/panels/lovelace/cards/hui-empty-state-card.ts b/src/panels/lovelace/cards/hui-empty-state-card.ts index 3b8671d58490..87928ffab315 100644 --- a/src/panels/lovelace/cards/hui-empty-state-card.ts +++ b/src/panels/lovelace/cards/hui-empty-state-card.ts @@ -15,9 +15,7 @@ export class HuiEmptyStateCard extends LitElement implements LovelaceCard { return 2; } - public setConfig(_config: EmptyStateCardConfig): void { - // eslint-disable-next-line - } + public setConfig(_config: EmptyStateCardConfig): void {} protected render() { if (!this.hass) { diff --git a/src/panels/lovelace/cards/hui-starting-card.ts b/src/panels/lovelace/cards/hui-starting-card.ts index 0c6058abaee3..1fd1f3526dc6 100644 --- a/src/panels/lovelace/cards/hui-starting-card.ts +++ b/src/panels/lovelace/cards/hui-starting-card.ts @@ -18,9 +18,7 @@ export class HuiStartingCard extends LitElement implements LovelaceCard { return 2; } - public setConfig(_config: LovelaceCardConfig): void { - // eslint-disable-next-line - } + public setConfig(_config: LovelaceCardConfig): void {} protected updated(changedProperties: PropertyValues) { super.updated(changedProperties); diff --git a/src/panels/lovelace/components/hui-marquee.ts b/src/panels/lovelace/components/hui-marquee.ts index a5f20adf1444..2f3a3afb10bd 100644 --- a/src/panels/lovelace/components/hui-marquee.ts +++ b/src/panels/lovelace/components/hui-marquee.ts @@ -14,13 +14,12 @@ class HuiMarquee extends LitElement { protected firstUpdated(changedProps) { super.firstUpdated(changedProps); - // eslint-disable-next-line wc/no-self-class this.addEventListener("mouseover", () => this.classList.add("hovering"), { // Capture because we need to run before a parent sets active on us. // Hovering will disable the overflow, allowing us to calc if we overflow. capture: true, }); - // eslint-disable-next-line wc/no-self-class + this.addEventListener("mouseout", () => this.classList.remove("hovering")); } diff --git a/src/panels/lovelace/elements/hui-image-element.ts b/src/panels/lovelace/elements/hui-image-element.ts index b55a48583520..e98ccae02fda 100644 --- a/src/panels/lovelace/elements/hui-image-element.ts +++ b/src/panels/lovelace/elements/hui-image-element.ts @@ -32,7 +32,6 @@ export class HuiImageElement extends LitElement implements LovelaceElement { this._config = { hold_action: { action: "more-info" }, ...config }; - // eslint-disable-next-line wc/no-self-class this.classList.toggle( "clickable", this._config.tap_action && this._config.tap_action.action !== "none" diff --git a/src/panels/media-browser/browser-media-player.ts b/src/panels/media-browser/browser-media-player.ts index 389aea2fa8c8..47de0f5969cf 100644 --- a/src/panels/media-browser/browser-media-player.ts +++ b/src/panels/media-browser/browser-media-player.ts @@ -99,7 +99,6 @@ export class BrowserMediaPlayer { supported_features: // eslint-disable-next-line no-bitwise MediaPlayerEntityFeature.PLAY | - // eslint-disable-next-line no-bitwise MediaPlayerEntityFeature.PAUSE | MediaPlayerEntityFeature.VOLUME_SET, }; diff --git a/src/state/hass-base-mixin.ts b/src/state/hass-base-mixin.ts index 5424ed3a6bbe..fc4c44d90d67 100644 --- a/src/state/hass-base-mixin.ts +++ b/src/state/hass-base-mixin.ts @@ -18,29 +18,18 @@ export class HassBaseEl extends LitElement { protected initializeHass(_auth: Auth, _conn: Connection) { // implemented in connection-mixin - // eslint-disable-next-line } // Exists so all methods can safely call super method - protected hassConnected() { - // eslint-disable-next-line - } + protected hassConnected() {} - protected hassReconnected() { - // eslint-disable-next-line - } + protected hassReconnected() {} - protected hassDisconnected() { - // eslint-disable-next-line - } + protected hassDisconnected() {} - protected panelUrlChanged(_newPanelUrl) { - // eslint-disable-next-line - } + protected panelUrlChanged(_newPanelUrl) {} - protected checkDataBaseMigration() { - // eslint-disable-next-line - } + protected checkDataBaseMigration() {} protected hassChanged(hass, _oldHass) { this.__provideHass.forEach((el) => { diff --git a/src/state/quick-bar-mixin.ts b/src/state/quick-bar-mixin.ts index 30a96e7e9366..a85f9ac528ef 100644 --- a/src/state/quick-bar-mixin.ts +++ b/src/state/quick-bar-mixin.ts @@ -65,11 +65,13 @@ export default >(superClass: T) => a: (ev) => this._showVoiceCommandDialog(ev), d: (ev) => this._showQuickBar(ev, QuickBarMode.Device), // Those are fallbacks for non-latin keyboards that don't have e, c, m keys (qwerty-based shortcuts) + /* eslint-disable @typescript-eslint/naming-convention */ KeyE: (ev) => this._showQuickBar(ev), KeyC: (ev) => this._showQuickBar(ev, QuickBarMode.Command), KeyM: (ev) => this._createMyLink(ev), KeyA: (ev) => this._showVoiceCommandDialog(ev), KeyD: (ev) => this._showQuickBar(ev, QuickBarMode.Device), + /* eslint-enable @typescript-eslint/naming-convention */ }); } diff --git a/src/types.ts b/src/types.ts index 9cea363824d1..f5373fdcf1a3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,7 +23,7 @@ import type { Themes } from "./data/ws-themes"; import type { ExternalMessaging } from "./external_app/external_messaging"; declare global { - /* eslint-disable no-var */ + /* eslint-disable no-var, @typescript-eslint/naming-convention */ var __DEV__: boolean; var __DEMO__: boolean; var __BUILD__: "modern" | "legacy"; @@ -32,7 +32,7 @@ declare global { var __BACKWARDS_COMPAT__: boolean; var __SUPERVISOR__: boolean; var __HASS_URL__: string; - /* eslint-enable no-var, no-redeclare */ + /* eslint-enable no-var, @typescript-eslint/naming-convention */ interface Window { // Custom panel entry point url @@ -70,6 +70,7 @@ declare global { // Intl.DurationFormat is not yet part of the TypeScript standard // eslint-disable-next-line @typescript-eslint/no-namespace namespace Intl { + // eslint-disable-next-line @typescript-eslint/naming-convention const DurationFormat: DurationFormatConstructor; } }