diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..2008e8e --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,16 @@ +--- +root: true + +plugins: + - jest +env: + node: true + browser: false + +parser: "@babel/eslint-parser" + +extends: + - "plugin:jest/recommended" + +rules: + no-console: 0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e444d3..8f3a323 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: # - name: Setup db - name: Login to Docker Hub - run: echo "${{ services.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --pasword-stdin + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --pasword-stdin - name: Build docker image for codebattle bot run: make docker-build-chat-bot diff --git a/.husky/pre-commit b/.husky/pre-commit index 53e066f..40bbf89 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ +yarn run lint yarn test diff --git a/app/discord/index.js b/app/discord/index.js index 1725307..e26be7d 100644 --- a/app/discord/index.js +++ b/app/discord/index.js @@ -5,7 +5,6 @@ import logger from '../logger'; import socket from '../socket'; import commands from './commands'; -import { intersection } from 'lodash'; // https://github.com/discordjs/discord.js/tree/main/packages/discord.js#readme @@ -51,7 +50,7 @@ const setup = (params) => { if (!interaction.isChatInputCommand()) return; const callback = commands[interaction.commandName]?.callback || noop; - callback(intersection); + callback(interaction); }); client.login(token); diff --git a/app/socket/index.js b/app/socket/index.js index 8f2078d..7e13556 100644 --- a/app/socket/index.js +++ b/app/socket/index.js @@ -24,8 +24,7 @@ socket.onOpen(() => { socket.onError((err) => { logger.error( `Socket connection with codebattle server is closed with error: ${JSON.stringify( - err, - null, + err, null, 2, )}`, ); diff --git a/package.json b/package.json index a9dbed7..e13bcb6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start:health": "node dist/health.js", "build": "babel app -d dist", "prettier": "prettier --write app/**/*.js", - "lint": "eslint --cache --debug app/", + "lint": "eslint --cache app/", "lint:write": "eslint --write app/**/*.js", "setup": "yarn", "prepare": "husky",