From 47d07fdc21701d95d19a2dc5e1b43249c191557a Mon Sep 17 00:00:00 2001 From: mar77i Date: Sun, 20 Oct 2024 11:45:23 +0200 Subject: [PATCH] add jslint and more fixes --- .gitignore | 1 + .pre-commit-config.yaml | 17 +++ chat/apps.py | 1 + chat/static/chat/chat.html | 1 + chat/static/chat/chat.js | 233 ++++++++++++++++++++------------- chat/static/chat/underscore.js | 82 +++++++----- chat/websocket.py | 32 +++-- pyjslint.py | 125 ++++++++++++++++++ setup_venv.sh | 2 +- 9 files changed, 364 insertions(+), 130 deletions(-) create mode 100755 pyjslint.py diff --git a/.gitignore b/.gitignore index 7285869..78d5c6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ chat/settings_local.py .coverage .idea/ +jslint.js __pycache__/ staticfiles venv/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bc47c1..06d9357 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,3 +14,20 @@ repos: - id: ruff args: [ --fix, --extend-select, I ] - id: ruff-format +- repo: local + hooks: + - id: pyjslint + name: pyjslint + language: script + entry: pyjslint.py + files: "\\.js$" + args: [ + -o, "maxerr:20", + -o, "for:true", + -o, "devel:true", + -o, "browser:true", + -o, "this:true", + -g, _, + -g, WebSocket, + -j, jslint.js + ] diff --git a/chat/apps.py b/chat/apps.py index 580e57a..7bcedb3 100644 --- a/chat/apps.py +++ b/chat/apps.py @@ -6,6 +6,7 @@ from .utils import get_app_configs class ChatConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" + name = __module__[: -len(".apps")] @staticmethod def autodiscover_models(): diff --git a/chat/static/chat/chat.html b/chat/static/chat/chat.html index c546f24..891af21 100644 --- a/chat/static/chat/chat.html +++ b/chat/static/chat/chat.html @@ -13,6 +13,7 @@