From bd40978deecacb5467cb1ada402fe2bb57074b7d Mon Sep 17 00:00:00 2001 From: allburov Date: Sat, 25 Nov 2023 19:56:32 +0700 Subject: [PATCH] [core] Apply prettier to other files too --- .eslintrc.js | 47 ++++++++++----------- .github/ISSUE_TEMPLATE/bug_report.md | 33 +++++++++------ .github/ISSUE_TEMPLATE/feature_request.md | 19 +++++---- .github/workflows/build.yaml | 50 +++++++++++------------ .pre-commit-config.yaml | 6 +-- CHANGELOG.md | 4 +- docker-compose.yaml | 6 +-- examples/python/README.md | 50 ++++++++++++++--------- nest-cli.json | 4 +- tsconfig.build.json | 7 +--- tsconfig.json | 2 +- 11 files changed, 123 insertions(+), 105 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5efe2ba4..26246e07 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,34 +1,35 @@ module.exports = { - parser: "@typescript-eslint/parser", + parser: '@typescript-eslint/parser', parserOptions: { - project: "tsconfig.json", - sourceType: "module" + project: 'tsconfig.json', + sourceType: 'module', }, - plugins: [ - "@typescript-eslint/eslint-plugin", - "simple-import-sort" - ], + plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort'], extends: [ - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier", - "prettier/@typescript-eslint" + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + 'prettier/@typescript-eslint', ], root: true, env: { node: true, - jest: true + jest: true, }, rules: { - "simple-import-sort/imports": "error", - "simple-import-sort/exports": "error", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/ban-ts-ignore": "off", - "@typescript-eslint/ban-ts-comment": "off", - 'lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }], - } + 'simple-import-sort/imports': 'error', + 'simple-import-sort/exports': 'error', + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-inferrable-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + 'lines-between-class-members': [ + 'error', + 'always', + { exceptAfterSingleLine: true }, + ], + }, }; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4e571ce6..4277afa7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,17 +1,18 @@ --- name: Bug report about: Create a report to help us improve -title: "[BUG][WEBJS] - " +title: '[BUG][WEBJS] - ' labels: bug assignees: '' - --- **Describe the bug** -> A clear and concise description of what the bug is. -> Feel free to remove sections that you don't feel to make the text shorter! + +> A clear and concise description of what the bug is. Feel free to remove +> sections that you don't feel to make the text shorter! **Version** + ```json { "version": "2023.11.1", @@ -20,33 +21,41 @@ assignees: '' "browser": "/usr/bin/google-chrome-stable" } ``` -> You can get the WAHA version by calling `GET /api/version` -> Try to update to [the latest version](https://github.com/devlikeapro/whatsapp-http-api/releases) before creating an issue! +> You can get the WAHA version by calling `GET /api/version` Try to update to +> [the latest version](https://github.com/devlikeapro/whatsapp-http-api/releases) +> before creating an issue! + +**To Reproduce** Steps to reproduce the behavior: -**To Reproduce** -Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** + > A clear and concise description of what you expected to happen. -**Engine** -I'm using **WEBJS** engine. -> If you set `WHATSAPP_DEFAULT_ENGINE` explicitly to [one of the engine](https://waha.devlike.pro/docs/how-to/engines/) - please provide that information here and in the issue title. +**Engine** I'm using **WEBJS** engine. + +> If you set `WHATSAPP_DEFAULT_ENGINE` explicitly to +> [one of the engine](https://waha.devlike.pro/docs/how-to/engines/) - please +> provide that information here and in the issue title. **Requests - Responses** + > Please attach all sent requests, responses that you sent. **Docker Logs** -> Collect and attach related docker logs if you have any + +> Collect and attach related docker logs if you have any > https://waha.devlike.pro/docs/how-to/deploy/#viewing-the-logs **Screenshots** + > If applicable, add screenshots to help explain your problem. **Additional context** + > Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a7d659dc..d4def561 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,21 +1,24 @@ --- name: Feature request about: Suggest an idea for this project -title: "[Feature Request]" +title: '[Feature Request]' labels: '' assignees: '' - --- -**Is your feature request related to a problem? Please describe.** -I'm always frustrated when [...] -> A clear and concise description of what the problem is. Ex. +**Is your feature request related to a problem? Please describe.** I'm always +frustrated when [...] + +> A clear and concise description of what the problem is. Ex. **Describe the solution you'd like** + > A clear and concise description of what you want to happen. **Describe alternatives you've considered** -> A clear and concise description of any alternative solutions or features you've considered. -**Additional context** -Add any other context or screenshots about the feature request here. +> A clear and concise description of any alternative solutions or features +> you've considered. + +**Additional context** Add any other context or screenshots about the feature +request here. diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 46827d12..1861f94a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - "*" + - '*' jobs: docker-build: @@ -13,33 +13,33 @@ jobs: matrix: include: # Chromium - - runner: "buildjet-4vcpu-ubuntu-2204" - tag: "latest" - platform: "amd64" - browser: "chromium" - - runner: "buildjet-4vcpu-ubuntu-2204-arm" - tag: "arm" - platform: "linux/arm64" - browser: "chromium" + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'latest' + platform: 'amd64' + browser: 'chromium' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'arm' + platform: 'linux/arm64' + browser: 'chromium' # Chrome - - runner: "buildjet-4vcpu-ubuntu-2204" - tag: "chrome" - platform: "amd64" - browser: "chrome" + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'chrome' + platform: 'amd64' + browser: 'chrome' # Chrome is not supported on arm64 -# - runner: "buildjet-4vcpu-ubuntu-2204-arm" -# tag: "chrome-arm" -# platform: "linux/arm64" -# browser: "chrome" + # - runner: "buildjet-4vcpu-ubuntu-2204-arm" + # tag: "chrome-arm" + # platform: "linux/arm64" + # browser: "chrome" # No browser - - runner: "buildjet-4vcpu-ubuntu-2204" - tag: "noweb" - platform: "amd64" - browser: "none" - - runner: "buildjet-4vcpu-ubuntu-2204-arm" - tag: "noweb-arm" - platform: "linux/arm64" - browser: "none" + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'noweb' + platform: 'amd64' + browser: 'none' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'noweb-arm' + platform: 'linux/arm64' + browser: 'none' steps: - name: Checkout diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad7e29a1..e22e4455 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,10 +15,10 @@ repos: rev: 'v3.1.0' hooks: - id: prettier - types_or: [ javascript, ts ] - files: | + exclude: | (?x)^( - src/.*| + docs/.*| + README.md| )$ - repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs rev: v1.1.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0011fbbb..69007775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,4 @@ # Changelog -You can find changelog on [the changelog page](https://waha.devlike.pro/docs/help/changelog/) + +You can find changelog on +[the changelog page](https://waha.devlike.pro/docs/help/changelog/) diff --git a/docker-compose.yaml b/docker-compose.yaml index b7273291..23fe3830 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,7 +4,7 @@ services: image: devlikeapro/whatsapp-http-api container_name: whatsapp-http-api ports: - - "3000:3000/tcp" + - '3000:3000/tcp' environment: # Environment variables from https://waha.devlike.pro/docs/how-to/config/ - WHATSAPP_HOOK_URL=https://httpbin.org/post @@ -16,9 +16,9 @@ services: image: devlikeapro/whatsapp-http-api-plus container_name: whatsapp-http-api-plus ports: - - "3000:3000/tcp" + - '3000:3000/tcp' volumes: - - "./.sessions:/app/.sessions" + - './.sessions:/app/.sessions' environment: # Environment variables from https://waha.devlike.pro/docs/how-to/config/ - WHATSAPP_RESTART_ALL_SESSIONS=True diff --git a/examples/python/README.md b/examples/python/README.md index 7e045513..ea110aa9 100644 --- a/examples/python/README.md +++ b/examples/python/README.md @@ -9,10 +9,11 @@ We assume that you have installed software: ### Download and start image -First of all, you must run WhatsApp HTTP API locally (which under the hood it runs real WhatsApp Web instance and expose -HTTP API for interaction). +First of all, you must run WhatsApp HTTP API locally (which under the hood it +runs real WhatsApp Web instance and expose HTTP API for interaction). -Here are the steps from [Quick Start](https://waha.devlike.pro/docs/overview/quick-start/): +Here are the steps from +[Quick Start](https://waha.devlike.pro/docs/overview/quick-start/): Download and start WhatsApp HTTP API docker container @@ -28,9 +29,11 @@ docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bo #### Download image - ARM -If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following commands to download the image +If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following +commands to download the image ![](/images/versions/core.png) For Core version the command is + ```bash # Download the image docker pull devlikeapro/whatsapp-http-api:arm @@ -47,12 +50,16 @@ docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bo 2. Open Swagger API in the browser http://localhost:3000/ 3. Start session and scan QR code in swagger - 1. Find `POST /api/session/start` request press **Try it out** and **Execute** it with `default` session name - 2. Find `GET /api/screenshot` and execute it - it must show QR code - 3. Scan QR code on your mobile WhatsApp application (that installed on your phone) - 4. Execute `GET /api/screenshot` once again - it must show the screenshot from WhatsApp Web. -4. Send test text message - find `POST /api/sendText` and execute it with payload (change `12132132130` in the `chatId` - to phone number that is registered in WhatsApp). + 1. Find `POST /api/session/start` request press **Try it out** and + **Execute** it with `default` session name + 2. Find `GET /api/screenshot` and execute it - it must show QR code + 3. Scan QR code on your mobile WhatsApp application (that installed on your + phone) + 4. Execute `GET /api/screenshot` once again - it must show the screenshot + from WhatsApp Web. +4. Send test text message - find `POST /api/sendText` and execute it with + payload (change `12132132130` in the `chatId` to phone number that is + registered in WhatsApp). ```json { @@ -66,9 +73,9 @@ If you see **Hi there!** message then you're ready to run bots! ## WhatsApp Echo Bot -The WhatsApp Echo Bot is a sample flask webhook server application that echoes back to you whatever you send it. It can -serve -as a basic reference for how to set up webhooks and reply to incoming messages. +The WhatsApp Echo Bot is a sample flask webhook server application that echoes +back to you whatever you send it. It can serve as a basic reference for how to +set up webhooks and reply to incoming messages. ```bash # Clone the git repository with example @@ -81,16 +88,19 @@ python -mpip install -r requirements.txt FLASK_APP=whatsapp_echo_bot.py flask run ``` -Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then the bot is ready to receive message! +Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then +the bot is ready to receive message! -Send message to the WhatsApp (that you used to scan QR code) and it'll echo text back to you! +Send message to the WhatsApp (that you used to scan QR code) and it'll echo text +back to you! ## WhatsApp Download Files Bot -The WhatsApp Download Image Bot downloads all files people send to your WhatsApp and log the path for the file. +The WhatsApp Download Image Bot downloads all files people send to your WhatsApp +and log the path for the file. -**The bot works only with WAHA Plus version** available with donations. -Visit [read more about difference between Core and Plus versions](https://waha.devlike.pro/docs/how-to/plus-version/). +**The bot works only with WAHA Plus version** available with donations. Visit +[read more about difference between Core and Plus versions](https://waha.devlike.pro/docs/how-to/plus-version/). Download **WAHA Plus** version: @@ -114,5 +124,5 @@ python -mpip install -r requirements.txt FLASK_APP=whatsapp_download_files_bot.py flask run ``` -Open http://127.0.0.1:5000/bot - if you see **WhatsApp Download Files Bot!** then the bot is ready to receive message -with files! +Open http://127.0.0.1:5000/bot - if you see **WhatsApp Download Files Bot!** +then the bot is ready to receive message with files! diff --git a/nest-cli.json b/nest-cli.json index 2667156d..6e477fdd 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -2,8 +2,6 @@ "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": { - "plugins": [ - "@nestjs/swagger" - ] + "plugins": ["@nestjs/swagger"] } } diff --git a/tsconfig.build.json b/tsconfig.build.json index 4912473b..64f86c6b 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,9 +1,4 @@ { "extends": "./tsconfig.json", - "exclude": [ - "node_modules", - "test", - "dist", - "**/*spec.ts" - ] + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 535da064..ec7c754e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,6 @@ "baseUrl": "./", "incremental": true, "resolveJsonModule": true, - "skipLibCheck": true, + "skipLibCheck": true } }