mbi / django-rosetta

Rosetta is a Django application that eases the translation process of your Django projects
MIT License
1.07k stars 195 forks source link

Auto-format css/js/html and add eslint #294

Closed balazs-endresz closed 1 month ago

balazs-endresz commented 2 months ago

Tests passed locally with tox and I these shouldn't require any test or docs changes. Also tested manually with the testproject.


This PR adds auto formatting with pre-commit for js/css/html, and some minor linting tweaks:

I tried to stick to the defaults mostly, but I'm happy to redo this with different settings if needed.

balazs-endresz commented 1 month ago

Rebased and added some minor ruff fixes that came up after pre-commit run --all-files. (I guess those went unnoticed after adding ruff because pre-commit checks only modified files by default.)

mbi commented 1 month ago

Hello @balazs-endresz

Trying to run pre-commit yields this error. Could you please provide a minimal config file, ideally as a hidden dotfile in the root of the project?

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find a configuration file. To set up a configuration file for this project, please run:

npm init @eslint/config

ESLint looked for configuration files in /home/marco/Code/django-rosetta/rosetta/static/admin/rosetta/js and its ancestors. If it found none, it then looked in your home directory.

If you think you already have a configuration file or if you need more help, please stop by the ESLint Discord server: https://eslint.org/chat

balazs-endresz commented 1 month ago

Turns out it worked for me because I had a default eslint config file in my home directory. I tried again with eslint version 9 but still couldn't get that working with ~prettier~ pre-commit, but at least the older v8 config file should work now with a new .eslintrc.js file added to the first commit.

mbi commented 1 month ago

Thank you, merged!