Skip to content

Commit

Permalink
Fix tests (#17)
Browse files Browse the repository at this point in the history
* Create clean action.yml (#12)

* Create clean.yml

* Add contents:read

* Update modules

* fix issue

---------

Co-authored-by: Viktoriia <1>

* Fix tests and refactor code

* Update README file

* Add eslint

* Fix comment

* fix comments

* Update README

* Fix

* Prettier config

* Prettier format

---------

Co-authored-by: Viktoriia <1>
  • Loading branch information
VikDavydiuk committed Jul 17, 2023
1 parent ef2e9e7 commit b3e395c
Show file tree
Hide file tree
Showing 23 changed files with 24,947 additions and 24,360 deletions.
121 changes: 121 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
module.exports = {
extends: ['prettier'],
rules: {
'prettier/prettier': ['error'],
'no-process-env': 'error',
'no-multiple-empty-lines': [
'error',
{
max: 2,
maxBOF: 0,
maxEOF: 0,
},
],
'no-tabs': 'off',
'no-restricted-syntax': 'off',
'class-methods-use-this': 'off',
'no-underscore-dangle': [
'error',
{
allow: ['_id', '_v', '__v'],
},
],
'no-shadow': [
'error',
{
allow: ['err', 'error'],
},
],
'prefer-destructuring': [
'warn',
{
object: true,
array: false,
},
],
'no-param-reassign': [
'warn',
{
props: false,
},
],
'no-unused-vars': [
'warn',
{
args: 'after-used',
argsIgnorePattern: 'app|req|res|next|options|params|^_',
},
],
'arrow-parens': ['error', 'always'],
'arrow-body-style': [
'error',
'as-needed',
{ requireReturnForObjectLiteral: true },
],
'no-only-tests/no-only-tests': 'error',
},
plugins: ['import', 'prettier', 'promise', 'no-only-tests'],
env: {
node: true,
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},
overrides: [
{
files: ['apps/**/*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'plugin:promise/recommended',
'plugin:prettier/recommended',
],
parserOptions: {
project: 'apps/server/tsconfig.lint.json',
},
env: {
node: true,
es6: true,
},
rules: {
'import/no-unresolved': 'off', // better handled by ts resolver
'import/no-extraneous-dependencies': 'off', // better handles by ts resolver
'import/prefer-default-export': 'off',
'no-void': ['error', { allowAsStatement: true }],
'max-classes-per-file': 'off',
'class-methods-use-this': 'off',
'no-param-reassign': 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: true,
},
],
},
overrides: [
{
files: ['**/*spec.ts'],
plugins: ['jest'],
env: {
jest: true,
},
rules: {
// you should turn the original rule off *only* for test files
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
},
],
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
branch: ${{ github.event.ref }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches-ignore:
- dependabot/**
pull_request:
types: [labeled]
types: [labeled]

permissions:
contents: read
Expand Down Expand Up @@ -39,9 +39,9 @@ jobs:

- name: test image exists
run: |
mkdir -p ~/.docker
echo '{"experimental": "enabled"}' >> ~/.docker/config.json
echo "IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ github.repository }}:${{ github.sha }} > /dev/null && echo 1 || echo 0)" >> $GITHUB_ENV
mkdir -p ~/.docker
echo '{"experimental": "enabled"}' >> ~/.docker/config.json
echo "IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ github.repository }}:${{ github.sha }} > /dev/null && echo 1 || echo 0)" >> $GITHUB_ENV
- name: Build and push ${{ github.repository }}
if: ${{ env.IMAGE_EXISTS == 0 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
images: schulcloud/tldraw-client
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}
- name: Log into registry
uses: docker/login-action@v1
with:
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
singleQuote: true,
printWidth: 80,
useTabs: true,
endOfLine: 'auto',
};
Loading

0 comments on commit b3e395c

Please sign in to comment.