diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index c24743d0..00000000 --- a/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -[*.{js,jsx,ts,tsx,vue}] -indent_style = space -indent_size = 2 -end_of_line = lf -trim_trailing_whitespace = true -insert_final_newline = true -max_line_length = 100 diff --git a/.eslintrc.js b/.eslintrc.js index dcbf985c..432fe7d7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,27 +3,22 @@ module.exports = { env: { node: true, }, - extends: ['plugin:vue/essential', '@vue/airbnb', 'plugin:prettier/recommended'], - plugins: ['prettier'], + extends: ['@weni/eslint-config/vue2'], parserOptions: { parser: '@babel/eslint-parser', }, rules: { - 'prettier/prettier': [ - 'error', - { - endOfLine: 'auto', - }, - ], 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'import/extensions': 'off', 'no-shadow': 'off', - camelcase: 'off', }, overrides: [ { - files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'], + files: [ + '**/__tests__/*.{j,t}s?(x)', + '**/tests/unit/**/*.spec.{j,t}s?(x)', + ], env: { jest: true, }, diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml new file mode 100644 index 00000000..cdc7f977 --- /dev/null +++ b/.github/workflows/test-and-build.yml @@ -0,0 +1,28 @@ +name: Run Unit Tests, Lint Files and Build Project +on: push +jobs: + lint-test-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node 18 + uses: actions/setup-node@v2 + with: + node-version: '18' + - name: Install dependencies + run: | + npm install -g yarn + yarn install + - name: Run build translations + run: yarn translations:build + - name: Run lint + run: yarn lint + - name: Run tests + run: yarn test:unit + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Build application + run: yarn build diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index a20502b7..00000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "all" -} diff --git a/README.md b/README.md index 24f71c91..8d66c63e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@
- + + +[![Run Unit Tests, Lint Files and Build Project](https://github.com/weni-ai/chats-webapp/actions/workflows/test-and-build.yml/badge.svg?branch=main)](https://github.com/weni-ai/chats-webapp/actions/workflows/test-and-build.yml) +[![codecov](https://codecov.io/gh/weni-ai/chats-webapp/graph/badge.svg?token=4G62T5ER2Z)](https://codecov.io/gh/weni-ai/chats-webapp) _This project is a module of [Weni](https://github.com/weni-ai) integrated inside [Weni WebApp (Connect)](https://github.com/weni-ai/weni-webapp)_
-# CHATS +# Weni Chats Chats is the official human service module of the Weni platform. diff --git a/package.json b/package.json index 71a544b2..179f05a0 100644 --- a/package.json +++ b/package.json @@ -44,18 +44,19 @@ "@vue/eslint-config-airbnb": "^6.0.0", "@vue/test-utils": "^1.1.3", "@vue/vue2-jest": "^27.0.0-alpha.2", + "@weni/eslint-config": "^1.0.1", "babel-jest": "^27.0.6", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.5.0", + "eslint": "^7.0.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^8.0.3", + "eslint-plugin-vue": "^9.22.0", "eslint-plugin-vuejs-accessibility": "^1.1.0", "jest": "^27.0.5", - "prettier": "^2.6.0", "sass": "^1.32.7", "sass-loader": "^12.0.0", "unified-translations": "^1.1.1", + "vue-eslint-parser": "^9.4.2", "vue-template-compiler": "^2.6.14" } } diff --git a/src/App.vue b/src/App.vue index a5fdcdf2..bd2e3ab5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ @@ -41,7 +41,8 @@ export default { me: (state) => state.profile.me, viewedAgent: (state) => state.dashboard.viewedAgent, nextQuickMessages: (state) => state.chats.quickMessages.nextQuickMessages, - nextQuickMessagesShared: (state) => state.chats.quickMessagesShared.nextQuickMessagesShared, + nextQuickMessagesShared: (state) => + state.chats.quickMessagesShared.nextQuickMessagesShared, appToken: (state) => state.config.token, appProject: (state) => state.config.project, }), @@ -148,7 +149,9 @@ export default { }, async onboarding() { - const onboarded = localStorage.getItem('CHATS_USER_ONBOARDED') || (await Profile.onboarded()); + const onboarded = + localStorage.getItem('CHATS_USER_ONBOARDED') || + (await Profile.onboarded()); if (onboarded) { localStorage.setItem('CHATS_USER_ONBOARDED', true); return; diff --git a/src/components/ModalOnBoardingChats.vue b/src/components/ModalOnBoardingChats.vue index fc8aaf5f..31a200d5 100644 --- a/src/components/ModalOnBoardingChats.vue +++ b/src/components/ModalOnBoardingChats.vue @@ -8,7 +8,10 @@