Skip to content

Commit

Permalink
style(lint): fix newly created lint fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Gh61 committed Jan 25, 2024
1 parent d727138 commit fa9d6cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
21 changes: 20 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
"linebreak-style": ["error", "unix"],
"@typescript-eslint/indent": ["error", 4],
"@typescript-eslint/comma-dangle": ["error", "never"],
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
// is not working very well, replace soon with https://typescript-eslint.io/rules/naming-convention/
"no-underscore-dangle": ["error", {
"allow": ["_containers", "_args", "_instance", "_isMouseDown", "_router", "__provider" ], // allow static members, private (field) getters
"allowAfterThis": true,
"enforceInMethodNames": true,
"allowFunctionParams": false
}],
"@typescript-eslint/no-unused-expressions": ["error", { "allowShortCircuit":true }],
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/keyword-spacing": ["error", {"overrides": { "this": { "before": false }}}],
Expand All @@ -35,6 +41,19 @@
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",

// allow private empty ctor
"@typescript-eslint/no-empty-function": [
"error",
{
"allow": [
"functions",
"methods",
"private-constructors",
"protected-constructors"
]
}
],

// unused variables for interface
"@typescript-eslint/no-unused-vars": [
"error",
Expand Down
12 changes: 6 additions & 6 deletions src/controls/big-switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class HueBigSwitch extends LitElement {
}
}

private _toggle() {
private toggle() {
if (this.disabled) return;
this.checked = !this.checked;
fireEvent(this, 'change');
Expand Down Expand Up @@ -116,9 +116,9 @@ export class HueBigSwitch extends LitElement {

this._mc.on('singletap', () => {
if (this.disabled) return;
this._toggle();
this.toggle();
});
this.addEventListener('keydown', this._keydown);
this.addEventListener('keydown', this.onKeydown);
}
}

Expand All @@ -127,15 +127,15 @@ export class HueBigSwitch extends LitElement {
this._mc.destroy();
this._mc = undefined;
}
this.removeEventListener('keydown', this._keydown);
this.removeEventListener('keydown', this.onKeydown);
}

private _keydown(ev: KeyboardEvent) {
private onKeydown(ev: KeyboardEvent) {
if (ev.key !== 'Enter' && ev.key !== ' ') {
return;
}
ev.preventDefault();
this._toggle();
this.toggle();
}

protected override render(): TemplateResult {
Expand Down
4 changes: 2 additions & 2 deletions src/controls/color-temp-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export class HueColorTempPicker extends LitElement {
this._isRendered = true;
}

protected override updated(_changedProperties: PropertyValues<HueColorTempPicker>): void {
if (_changedProperties.has('mode') && _changedProperties.get('mode')) {
protected override updated(changedProperties: PropertyValues<HueColorTempPicker>): void {
if (changedProperties.has('mode') && changedProperties.get('mode')) {
this.drawWheel();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/hass-text-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class StaticTextTemplate implements IHassTextTemplate {
this._text = text;
}

public resolveToString(_hass: HomeAssistant | null = null): string {
public resolveToString(): string {
return this._text;
}

Expand Down

0 comments on commit fa9d6cf

Please sign in to comment.