-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add lit-analyzer, prettier and add missing closing tag #307
base: main
Are you sure you want to change the base?
Conversation
Test web with running |
"lint:prettier": "prettier \"src/**/*.{js,ts,json,css,md}\" --check", | ||
"format:prettier": "prettier \"src/**/*.{js,ts,json,css,md}\" --write", | ||
"lint:types": "tsc", | ||
"lint:lit": "lit-analyzer \"src/**/*.ts\"" |
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.
I don't see much need for these commands?
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.
My idea was to mimic actions that we have in HA Frontend and maybe add them in pre-commit. Especially prettier.
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.
In an ideal world, we have a pre-commit, and then run pre-commit in check mode in CI. Pre-commit is Python based, not sure if there is a JS variant or that we require people to have Python? (not the end of the world)
But if we do pre-commit, would we still need the tasks here? And we shouldn't add tasks unless we have pre-commit in place
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.
I think it's doable for JS too, using husky, I think is't already done in frontend: https://github.com/home-assistant/frontend/blob/dev/package.json#L19
Quick search: https://blog.nerdjfpb.com/how-to-add-eslint-prettier-and-husky-git-hook-in-react-js-2022/, https://www.stxnext.com/blog/eslint-prettier-husky/
So we should do ESLint, prettier, and lit-analyzer in pre-commit?
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.
yeah, let's mimic HA frontend 👍
I noticed that
device-card.ts
had a missingdiv
tag, this adds it, hopefully in the right place.Btw how to test web.esphome on dev machine?
I've also added additional tasks to package.json, they will allow formatting code and finding problems in lit (currently 20 problems in 11 files).