-
Notifications
You must be signed in to change notification settings - Fork 11
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
Lint templates #597
Lint templates #597
Conversation
@SilvanVerhoeven I removed prettier, as it kept messing with the indention that djhtml did and created an endless loop of reformatting. Could you please have a look if you can restrict prettier to only handle pure js files? |
f68309c
to
6fc0eda
Compare
Seems like we try to lint the same file types here. I think we need to make a decision which formatter should do what. At least for JS I have a slight preference for prettier, as that has proper IDE support, thus allows format on save. Maybe DjLint could be the perfect fit? It seems to have support for django plus IDE extensions |
Just a pointer that pre-commit's |
In my understanding from monday we agreed that prettier should only lint pure .js files and djhtml should lint the templates. I strongly favor djhtml for linting the templates as it properly understands django syntax and lints inline js and css. Djhtml does not lint .js files.
I have no experience with DjLint and am used to djhtml, but that shouldn't be the problem here. But I'm not sure whether this solves the problem at hand, which is prettier messing with the templates, as DjLint also only lints templates according to their docs. |
I understood the same :) We never talked about
I just tested it – due to
I cannot recreate this – with the following config,
It makes writing JS/CSS (and even templates) much easier for me, as I don't need to care about indentation/can let the IDE clean up everything after I wrote a bit – and then directly proceed coding from a "clean" state.
I would never argue against the pre-commit hook, it is very good :) But I'd very much appreciate the option to have "format on save".
Only after installing an extension for that and configuring it to run a command – and it seems running that command in a venv is a further headache.
Mhh, to me it seems like they also have a formatter? |
20a2117
to
b9b5abf
Compare
So my proposal is this:
Advantages:
What do you think of this setup? |
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.
apart from the loops I'm fine with this setup (can't approve as this is my PR)
5555527
to
cb4cc09
Compare
cb4cc09
to
8e3fac4
Compare
closes #586 closes #580