-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run prettier and lint #806
Changes from all commits
416cfa1
6cb21fa
a487280
87fce48
3e1b822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,10 @@ module.exports = { | |
"@typescript-eslint/camelcase": 0, | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rule exception was added to suppress the following
|
||
"@typescript-eslint/ban-ts-ignore": "off" | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Contributing | ||
|
||
Thank you for your interest in contributing to this project! | ||
|
||
## Building | ||
|
||
* Install Node.js (latest LTS release). | ||
* On Linux, macOS, or Windows WSL, consider using [nvm.sh](https://github.com/nvm-sh/nvm/blob/master/README.md) | ||
* On Windows native, see [Nodejs.org](https://nodejs.org/) | ||
* `git clone https://github.com/nielsfaber/scheduler-card.git` | ||
* `cd scheduler-card` | ||
* `npm install --no-package-lock` | ||
* `npm start` # To develop interactively | ||
* `npm run build` # Run lint, prettier, rollup (update 'dist/scheduler-card.js') | ||
|
||
|
||
## Codebase rewrite | ||
|
||
Please note that a major rewrite of the codebase is ongoing as of March 2024. If you are | ||
planning on submitting a significant contribution, get in touch to request a branch for | ||
the new version to be published so that you can rebase your work on it. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,12 @@ export class TimeslotEditor extends LitElement { | |
if (!!icons) { | ||
return html` | ||
<span style="margin-left: auto; margin-right: auto"> | ||
${icons.map((icon) => html`<ha-icon icon="${icon}"></ha-icon>`)} | ||
${icons.map( | ||
icon => | ||
html` | ||
<ha-icon icon="${icon}"></ha-icon> | ||
` | ||
)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to this file are a result of running |
||
</span> | ||
`; | ||
} | ||
|
@@ -170,8 +175,7 @@ export class TimeslotEditor extends LitElement { | |
</div> | ||
` | ||
: ''} | ||
${i > 0 ? this.renderTooltip(i) : ''} | ||
${content} | ||
${i > 0 ? this.renderTooltip(i) : ''} ${content} | ||
</div> | ||
`; | ||
}); | ||
|
@@ -258,29 +262,30 @@ export class TimeslotEditor extends LitElement { | |
if (!entry.actions) return; | ||
|
||
return unique( | ||
entry.actions.map(action => { | ||
const actionConfig = this.actions.find(e => compareActions(e, action, true)); | ||
if (!actionConfig) return []; | ||
|
||
if ( | ||
actionConfig.variables && | ||
Object.keys(actionConfig.variables).some(field => action.service_data && field in action.service_data) | ||
) { | ||
return Object.entries(actionConfig.variables) | ||
.filter(([field]) => action.service_data && field in action.service_data) | ||
.map(([field, variable]) => { | ||
const value = action.service_data![field]; | ||
if (variable.type == EVariableType.List) { | ||
variable = variable as ListVariable; | ||
const listItem = variable.options.find(e => e.value == value); | ||
return listItem?.icon; | ||
} else return undefined; | ||
}); | ||
} | ||
return [actionConfig.icon]; | ||
}) | ||
.reduce((prev, icons) => [...prev, ...icons], []) | ||
.filter((icon) => !!icon) | ||
entry.actions | ||
.map(action => { | ||
const actionConfig = this.actions.find(e => compareActions(e, action, true)); | ||
if (!actionConfig) return []; | ||
|
||
if ( | ||
actionConfig.variables && | ||
Object.keys(actionConfig.variables).some(field => action.service_data && field in action.service_data) | ||
) { | ||
return Object.entries(actionConfig.variables) | ||
.filter(([field]) => action.service_data && field in action.service_data) | ||
.map(([field, variable]) => { | ||
const value = action.service_data![field]; | ||
if (variable.type == EVariableType.List) { | ||
variable = variable as ListVariable; | ||
const listItem = variable.options.find(e => e.value == value); | ||
return listItem?.icon; | ||
} else return undefined; | ||
}); | ||
} | ||
return [actionConfig.icon]; | ||
}) | ||
.reduce((prev, icons) => [...prev, ...icons], []) | ||
.filter(icon => !!icon) | ||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,14 +41,14 @@ export const parseVariable = ( | |
const res = | ||
'template' in config && isDefined(config.template) | ||
? { ...omit(config, 'template'), ...config.template(stateObj, hass) } | ||
: <ListVariableConfig | LevelVariableConfig | TextVariableConfig>{ ...config }; | ||
: ({ ...config } as ListVariableConfig | LevelVariableConfig | TextVariableConfig); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to this file were done “manually” by me, in order to address the following
|
||
|
||
if ('options' in res) { | ||
return parseListVariable(res, stateObj); | ||
} else if ('min' in res && 'max' in res) { | ||
return parseLevelVariable(res, stateObj); | ||
} else { | ||
return <TextVariableConfig>res; | ||
return res as TextVariableConfig; | ||
} | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule exception was added to suppress the following
npm run lint
errors: