diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8c2ec1c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint + +on: + push: {} + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - name: Checkout Code Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d88067f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,33 @@ +default_stages: [pre-commit] + +default_language_version: + python: python3.12 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-json + - id: check-toml + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: detect-private-key + + - repo: https://github.com/pycontribs/mirrors-prettier + rev: v3.3.3 + hooks: + - id: prettier + args: ['--tab-width', '2', '--single-quote'] + exclude: '\.(js|jsx|ts|tsx|scss|css|html)$' + + - repo: https://github.com/Riverside-Healthcare/djLint + rev: v1.35.1 + hooks: + - id: djlint-reformat-django + - id: djlint-django diff --git a/README.MD b/README.MD index b180715..896a2ad 100644 --- a/README.MD +++ b/README.MD @@ -6,15 +6,19 @@ Django Allauth templates with basic DaisyUI styling. You can find a list of avai 1. Copy the contents of the templates directory into your templates folder. 2. If not done already, register the templates in your settings.py, e.g., with: - ``` - TEMPLATES = [ - { - "DIRS": [ - str(APPS_DIR / "templates"), - ], - "APP_DIRS": True, - ... - }, - ] - ``` -3. Make sure to adjust the entry template `base.html` in `templates/allauth/layouts/entrance.html` and `templates/allauth/layouts/manage.html` \ No newline at end of file + ``` + TEMPLATES = [ + { + "DIRS": [ + str(APPS_DIR / "templates"), + ], + "APP_DIRS": True, + ... + }, + ] + ``` +3. Make sure to adjust the entry template `base.html` in `templates/allauth/layouts/entrance.html` and `templates/allauth/layouts/manage.html` + +## Development + +This project uses `pre-commit`. Make sure to have it installed, e.g., in your python environment, to pass all checks. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5b9515 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +# ==== djLint ==== +[tool.djlint] +blank_line_after_tag = "load,extends" +close_void_tags = true +format_css = true +format_js = true +ignore = "H006,H030,H031" +include = "H017,H035" +indent = 2 +profile = "django" + +[tool.djlint.css] +indent_size = 2 + +[tool.djlint.js] +indent_size = 2