mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into federation-expose-privateKey-to-writeHomeCommunity
This commit is contained in:
commit
7079aad4b3
1
.github/workflows/lint_pr.yml
vendored
1
.github/workflows/lint_pr.yml
vendored
@ -29,6 +29,7 @@ jobs:
|
|||||||
database
|
database
|
||||||
release
|
release
|
||||||
federation
|
federation
|
||||||
|
dht
|
||||||
workflow
|
workflow
|
||||||
docker
|
docker
|
||||||
other
|
other
|
||||||
|
|||||||
@ -1,20 +1,34 @@
|
|||||||
|
// eslint-disable-next-line import/no-commonjs, import/unambiguous
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
// jest: true,
|
|
||||||
},
|
},
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['prettier', '@typescript-eslint' /*, 'jest' */],
|
plugins: ['prettier', '@typescript-eslint', 'import', 'n', 'promise'],
|
||||||
extends: [
|
extends: [
|
||||||
'standard',
|
'standard',
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:prettier/recommended',
|
'plugin:prettier/recommended',
|
||||||
'plugin:@typescript-eslint/recommended',
|
// 'plugin:import/recommended',
|
||||||
|
// 'plugin:import/typescript',
|
||||||
|
// 'plugin:security/recommended',
|
||||||
|
// 'plugin:@eslint-community/eslint-comments/recommended',
|
||||||
],
|
],
|
||||||
// add your custom rules here
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: {
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
},
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': ['error'],
|
'no-console': 'error',
|
||||||
|
camelcase: 'error',
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'error',
|
||||||
'prettier/prettier': [
|
'prettier/prettier': [
|
||||||
'error',
|
'error',
|
||||||
@ -22,5 +36,171 @@ module.exports = {
|
|||||||
htmlWhitespaceSensitivity: 'ignore',
|
htmlWhitespaceSensitivity: 'ignore',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// import
|
||||||
|
// 'import/export': 'error',
|
||||||
|
// 'import/no-deprecated': 'error',
|
||||||
|
// 'import/no-empty-named-blocks': 'error',
|
||||||
|
// 'import/no-extraneous-dependencies': 'error',
|
||||||
|
// 'import/no-mutable-exports': 'error',
|
||||||
|
// 'import/no-unused-modules': 'error',
|
||||||
|
// 'import/no-named-as-default': 'error',
|
||||||
|
// 'import/no-named-as-default-member': 'error',
|
||||||
|
// 'import/no-amd': 'error',
|
||||||
|
// 'import/no-commonjs': 'error',
|
||||||
|
// 'import/no-import-module-exports': 'error',
|
||||||
|
// 'import/no-nodejs-modules': 'off',
|
||||||
|
// 'import/unambiguous': 'error',
|
||||||
|
// 'import/default': 'error',
|
||||||
|
// 'import/named': 'error',
|
||||||
|
// 'import/namespace': 'error',
|
||||||
|
// 'import/no-absolute-path': 'error',
|
||||||
|
// 'import/no-cycle': 'error',
|
||||||
|
// 'import/no-dynamic-require': 'error',
|
||||||
|
// 'import/no-internal-modules': 'off',
|
||||||
|
// 'import/no-relative-packages': 'error',
|
||||||
|
// 'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||||
|
// 'import/no-self-import': 'error',
|
||||||
|
// 'import/no-unresolved': 'error',
|
||||||
|
// 'import/no-useless-path-segments': 'error',
|
||||||
|
// 'import/no-webpack-loader-syntax': 'error',
|
||||||
|
// 'import/consistent-type-specifier-style': 'error',
|
||||||
|
// 'import/exports-last': 'off',
|
||||||
|
// 'import/extensions': 'error',
|
||||||
|
// 'import/first': 'error',
|
||||||
|
// 'import/group-exports': 'off',
|
||||||
|
// 'import/newline-after-import': 'error',
|
||||||
|
// 'import/no-anonymous-default-export': 'error',
|
||||||
|
// 'import/no-default-export': 'error',
|
||||||
|
// 'import/no-duplicates': 'error',
|
||||||
|
// 'import/no-named-default': 'error',
|
||||||
|
// 'import/no-namespace': 'error',
|
||||||
|
// 'import/no-unassigned-import': 'error',
|
||||||
|
// 'import/order': [
|
||||||
|
// 'error',
|
||||||
|
// {
|
||||||
|
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
||||||
|
// 'newlines-between': 'always',
|
||||||
|
// pathGroups: [
|
||||||
|
// {
|
||||||
|
// pattern: '@?*/**',
|
||||||
|
// group: 'external',
|
||||||
|
// position: 'after',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// pattern: '@/**',
|
||||||
|
// group: 'external',
|
||||||
|
// position: 'after',
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// alphabetize: {
|
||||||
|
// order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
|
||||||
|
// caseInsensitive: true /* ignore case. Options: [true, false] */,
|
||||||
|
// },
|
||||||
|
// distinctGroup: true,
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// 'import/prefer-default-export': 'off',
|
||||||
|
// n
|
||||||
|
// 'n/handle-callback-err': 'error',
|
||||||
|
// 'n/no-callback-literal': 'error',
|
||||||
|
// 'n/no-exports-assign': 'error',
|
||||||
|
// 'n/no-extraneous-import': 'error',
|
||||||
|
// 'n/no-extraneous-require': 'error',
|
||||||
|
// 'n/no-hide-core-modules': 'error',
|
||||||
|
// 'n/no-missing-import': 'off', // not compatible with typescript
|
||||||
|
// 'n/no-missing-require': 'error',
|
||||||
|
// 'n/no-new-require': 'error',
|
||||||
|
// 'n/no-path-concat': 'error',
|
||||||
|
// 'n/no-process-exit': 'error',
|
||||||
|
// 'n/no-unpublished-bin': 'error',
|
||||||
|
// 'n/no-unpublished-import': 'off', // TODO need to exclude seeds
|
||||||
|
// 'n/no-unpublished-require': 'error',
|
||||||
|
// 'n/no-unsupported-features': ['error', { ignores: ['modules'] }],
|
||||||
|
// 'n/no-unsupported-features/es-builtins': 'error',
|
||||||
|
// 'n/no-unsupported-features/es-syntax': 'error',
|
||||||
|
// 'n/no-unsupported-features/node-builtins': 'error',
|
||||||
|
// 'n/process-exit-as-throw': 'error',
|
||||||
|
// 'n/shebang': 'error',
|
||||||
|
// 'n/callback-return': 'error',
|
||||||
|
// 'n/exports-style': 'error',
|
||||||
|
// 'n/file-extension-in-import': 'off',
|
||||||
|
// 'n/global-require': 'error',
|
||||||
|
// 'n/no-mixed-requires': 'error',
|
||||||
|
// 'n/no-process-env': 'error',
|
||||||
|
// 'n/no-restricted-import': 'error',
|
||||||
|
// 'n/no-restricted-require': 'error',
|
||||||
|
// 'n/no-sync': 'error',
|
||||||
|
// 'n/prefer-global/buffer': 'error',
|
||||||
|
// 'n/prefer-global/console': 'error',
|
||||||
|
// 'n/prefer-global/process': 'error',
|
||||||
|
// 'n/prefer-global/text-decoder': 'error',
|
||||||
|
// 'n/prefer-global/text-encoder': 'error',
|
||||||
|
// 'n/prefer-global/url': 'error',
|
||||||
|
// 'n/prefer-global/url-search-params': 'error',
|
||||||
|
// 'n/prefer-promises/dns': 'error',
|
||||||
|
// 'n/prefer-promises/fs': 'error',
|
||||||
|
// promise
|
||||||
|
// 'promise/catch-or-return': 'error',
|
||||||
|
// 'promise/no-return-wrap': 'error',
|
||||||
|
// 'promise/param-names': 'error',
|
||||||
|
// 'promise/always-return': 'error',
|
||||||
|
// 'promise/no-native': 'off',
|
||||||
|
// 'promise/no-nesting': 'warn',
|
||||||
|
// 'promise/no-promise-in-callback': 'warn',
|
||||||
|
// 'promise/no-callback-in-promise': 'warn',
|
||||||
|
// 'promise/avoid-new': 'warn',
|
||||||
|
// 'promise/no-new-statics': 'error',
|
||||||
|
// 'promise/no-return-in-finally': 'warn',
|
||||||
|
// 'promise/valid-params': 'warn',
|
||||||
|
// 'promise/prefer-await-to-callbacks': 'error',
|
||||||
|
// 'promise/no-multiple-resolved': 'error',
|
||||||
|
// eslint comments
|
||||||
|
// '@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||||
|
// '@eslint-community/eslint-comments/no-restricted-disable': 'error',
|
||||||
|
// '@eslint-community/eslint-comments/no-use': 'off',
|
||||||
|
// '@eslint-community/eslint-comments/require-description': 'off',
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
// only for ts files
|
||||||
|
{
|
||||||
|
files: ['*.ts', '*.tsx'],
|
||||||
|
extends: [
|
||||||
|
// 'plugin:@typescript-eslint/recommended',
|
||||||
|
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||||
|
// 'plugin:@typescript-eslint/strict',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// allow explicitly defined dangling promises
|
||||||
|
// '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||||
|
'no-void': ['error', { allowAsStatement: true }],
|
||||||
|
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
||||||
|
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||||
|
// this should not run on ts files: https://github.com/import-js/eslint-plugin-import/issues/2215#issuecomment-911245486
|
||||||
|
'import/unambiguous': 'off',
|
||||||
|
// this is not compatible with typeorm, due to joined tables can be null, but are not defined as nullable
|
||||||
|
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
// this is to properly reference the referenced project database without requirement of compiling it
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// we do not have testing on the database
|
||||||
|
// {
|
||||||
|
// files: ['*.test.ts'],
|
||||||
|
// plugins: ['jest'],
|
||||||
|
// rules: {
|
||||||
|
// 'jest/no-disabled-tests': 'error',
|
||||||
|
// 'jest/no-focused-tests': 'error',
|
||||||
|
// 'jest/no-identical-title': 'error',
|
||||||
|
// 'jest/prefer-to-have-length': 'error',
|
||||||
|
// 'jest/valid-expect': 'error',
|
||||||
|
// '@typescript-eslint/unbound-method': 'off',
|
||||||
|
// 'jest/unbound-method': 'error',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
##################################################################################
|
##################################################################################
|
||||||
# BASE ###########################################################################
|
# BASE ###########################################################################
|
||||||
##################################################################################
|
##################################################################################
|
||||||
FROM node:17-alpine as base
|
FROM node:18.7.0-alpine3.16 as base
|
||||||
|
|
||||||
# ENVs (available in production aswell, can be overwritten by commandline or env file)
|
# ENVs (available in production aswell, can be overwritten by commandline or env file)
|
||||||
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame
|
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-use-before-define */
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm'
|
||||||
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-use-before-define */
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm'
|
||||||
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
|
|||||||
@ -19,18 +19,21 @@
|
|||||||
"lint": "eslint --max-warnings=0 --ext .js,.ts ."
|
"lint": "eslint --max-warnings=0 --ext .js,.ts ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
|
||||||
"@types/faker": "^5.5.9",
|
"@types/faker": "^5.5.9",
|
||||||
"@types/node": "^16.10.3",
|
"@types/node": "^16.10.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||||
"@typescript-eslint/parser": "^4.29.2",
|
"@typescript-eslint/parser": "^5.57.1",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^8.37.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-config-standard": "^16.0.3",
|
"eslint-config-standard": "^17.0.0",
|
||||||
"eslint-plugin-import": "^2.24.1",
|
"eslint-import-resolver-typescript": "^3.5.4",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-prettier": "^3.4.1",
|
"eslint-plugin-n": "^15.7.0",
|
||||||
"eslint-plugin-promise": "^5.1.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"prettier": "^2.3.2",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
|
"eslint-plugin-security": "^1.7.1",
|
||||||
|
"prettier": "^2.8.7",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"typescript": "^4.3.5"
|
"typescript": "^4.3.5"
|
||||||
},
|
},
|
||||||
|
|||||||
1712
database/yarn.lock
1712
database/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -1,28 +1,206 @@
|
|||||||
|
// eslint-disable-next-line import/no-commonjs, import/unambiguous
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
// jest: true,
|
|
||||||
},
|
},
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['prettier', '@typescript-eslint' /*, 'jest' */],
|
plugins: ['prettier', '@typescript-eslint', 'import', 'n', 'promise'],
|
||||||
extends: [
|
extends: [
|
||||||
'standard',
|
'standard',
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:prettier/recommended',
|
'plugin:prettier/recommended',
|
||||||
'plugin:@typescript-eslint/recommended',
|
// 'plugin:import/recommended',
|
||||||
|
// 'plugin:import/typescript',
|
||||||
|
// 'plugin:security/recommended',
|
||||||
|
// 'plugin:@eslint-community/eslint-comments/recommended',
|
||||||
],
|
],
|
||||||
// add your custom rules here
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: {
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
},
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': ['error'],
|
'no-console': 'error',
|
||||||
|
camelcase: 'error',
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'error',
|
||||||
'prettier/prettier': [
|
'prettier/prettier': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
htmlWhitespaceSensitivity: 'ignore',
|
htmlWhitespaceSensitivity: 'ignore',
|
||||||
semi: false,
|
|
||||||
singleQuote: true,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// import
|
||||||
|
// 'import/export': 'error',
|
||||||
|
// 'import/no-deprecated': 'error',
|
||||||
|
// 'import/no-empty-named-blocks': 'error',
|
||||||
|
// 'import/no-extraneous-dependencies': 'error',
|
||||||
|
// 'import/no-mutable-exports': 'error',
|
||||||
|
// 'import/no-unused-modules': 'error',
|
||||||
|
// 'import/no-named-as-default': 'error',
|
||||||
|
// 'import/no-named-as-default-member': 'error',
|
||||||
|
// 'import/no-amd': 'error',
|
||||||
|
// 'import/no-commonjs': 'error',
|
||||||
|
// 'import/no-import-module-exports': 'error',
|
||||||
|
// 'import/no-nodejs-modules': 'off',
|
||||||
|
// 'import/unambiguous': 'error',
|
||||||
|
// 'import/default': 'error',
|
||||||
|
// 'import/named': 'error',
|
||||||
|
// 'import/namespace': 'error',
|
||||||
|
// 'import/no-absolute-path': 'error',
|
||||||
|
// 'import/no-cycle': 'error',
|
||||||
|
// 'import/no-dynamic-require': 'error',
|
||||||
|
// 'import/no-internal-modules': 'off',
|
||||||
|
// 'import/no-relative-packages': 'error',
|
||||||
|
// 'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||||
|
// 'import/no-self-import': 'error',
|
||||||
|
// 'import/no-unresolved': 'error',
|
||||||
|
// 'import/no-useless-path-segments': 'error',
|
||||||
|
// 'import/no-webpack-loader-syntax': 'error',
|
||||||
|
// 'import/consistent-type-specifier-style': 'error',
|
||||||
|
// 'import/exports-last': 'off',
|
||||||
|
// 'import/extensions': 'error',
|
||||||
|
// 'import/first': 'error',
|
||||||
|
// 'import/group-exports': 'off',
|
||||||
|
// 'import/newline-after-import': 'error',
|
||||||
|
// 'import/no-anonymous-default-export': 'error',
|
||||||
|
// 'import/no-default-export': 'error',
|
||||||
|
// 'import/no-duplicates': 'error',
|
||||||
|
// 'import/no-named-default': 'error',
|
||||||
|
// 'import/no-namespace': 'error',
|
||||||
|
// 'import/no-unassigned-import': 'error',
|
||||||
|
// 'import/order': [
|
||||||
|
// 'error',
|
||||||
|
// {
|
||||||
|
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
||||||
|
// 'newlines-between': 'always',
|
||||||
|
// pathGroups: [
|
||||||
|
// {
|
||||||
|
// pattern: '@?*/**',
|
||||||
|
// group: 'external',
|
||||||
|
// position: 'after',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// pattern: '@/**',
|
||||||
|
// group: 'external',
|
||||||
|
// position: 'after',
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// alphabetize: {
|
||||||
|
// order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
|
||||||
|
// caseInsensitive: true /* ignore case. Options: [true, false] */,
|
||||||
|
// },
|
||||||
|
// distinctGroup: true,
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// 'import/prefer-default-export': 'off',
|
||||||
|
// n
|
||||||
|
// 'n/handle-callback-err': 'error',
|
||||||
|
// 'n/no-callback-literal': 'error',
|
||||||
|
// 'n/no-exports-assign': 'error',
|
||||||
|
// 'n/no-extraneous-import': 'error',
|
||||||
|
// 'n/no-extraneous-require': 'error',
|
||||||
|
// 'n/no-hide-core-modules': 'error',
|
||||||
|
// 'n/no-missing-import': 'off', // not compatible with typescript
|
||||||
|
// 'n/no-missing-require': 'error',
|
||||||
|
// 'n/no-new-require': 'error',
|
||||||
|
// 'n/no-path-concat': 'error',
|
||||||
|
// 'n/no-process-exit': 'error',
|
||||||
|
// 'n/no-unpublished-bin': 'error',
|
||||||
|
// 'n/no-unpublished-import': 'off', // TODO need to exclude seeds
|
||||||
|
// 'n/no-unpublished-require': 'error',
|
||||||
|
// 'n/no-unsupported-features': ['error', { ignores: ['modules'] }],
|
||||||
|
// 'n/no-unsupported-features/es-builtins': 'error',
|
||||||
|
// 'n/no-unsupported-features/es-syntax': 'error',
|
||||||
|
// 'n/no-unsupported-features/node-builtins': 'error',
|
||||||
|
// 'n/process-exit-as-throw': 'error',
|
||||||
|
// 'n/shebang': 'error',
|
||||||
|
// 'n/callback-return': 'error',
|
||||||
|
// 'n/exports-style': 'error',
|
||||||
|
// 'n/file-extension-in-import': 'off',
|
||||||
|
// 'n/global-require': 'error',
|
||||||
|
// 'n/no-mixed-requires': 'error',
|
||||||
|
// 'n/no-process-env': 'error',
|
||||||
|
// 'n/no-restricted-import': 'error',
|
||||||
|
// 'n/no-restricted-require': 'error',
|
||||||
|
// 'n/no-sync': 'error',
|
||||||
|
// 'n/prefer-global/buffer': 'error',
|
||||||
|
// 'n/prefer-global/console': 'error',
|
||||||
|
// 'n/prefer-global/process': 'error',
|
||||||
|
// 'n/prefer-global/text-decoder': 'error',
|
||||||
|
// 'n/prefer-global/text-encoder': 'error',
|
||||||
|
// 'n/prefer-global/url': 'error',
|
||||||
|
// 'n/prefer-global/url-search-params': 'error',
|
||||||
|
// 'n/prefer-promises/dns': 'error',
|
||||||
|
// 'n/prefer-promises/fs': 'error',
|
||||||
|
// promise
|
||||||
|
// 'promise/catch-or-return': 'error',
|
||||||
|
// 'promise/no-return-wrap': 'error',
|
||||||
|
// 'promise/param-names': 'error',
|
||||||
|
// 'promise/always-return': 'error',
|
||||||
|
// 'promise/no-native': 'off',
|
||||||
|
// 'promise/no-nesting': 'warn',
|
||||||
|
// 'promise/no-promise-in-callback': 'warn',
|
||||||
|
// 'promise/no-callback-in-promise': 'warn',
|
||||||
|
// 'promise/avoid-new': 'warn',
|
||||||
|
// 'promise/no-new-statics': 'error',
|
||||||
|
// 'promise/no-return-in-finally': 'warn',
|
||||||
|
// 'promise/valid-params': 'warn',
|
||||||
|
// 'promise/prefer-await-to-callbacks': 'error',
|
||||||
|
// 'promise/no-multiple-resolved': 'error',
|
||||||
|
// eslint comments
|
||||||
|
// '@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||||
|
// '@eslint-community/eslint-comments/no-restricted-disable': 'error',
|
||||||
|
// '@eslint-community/eslint-comments/no-use': 'off',
|
||||||
|
// '@eslint-community/eslint-comments/require-description': 'off',
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
// only for ts files
|
||||||
|
{
|
||||||
|
files: ['*.ts', '*.tsx'],
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||||
|
// 'plugin:@typescript-eslint/strict',
|
||||||
|
// 'plugin:type-graphql/recommended',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// allow explicitly defined dangling promises
|
||||||
|
// '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||||
|
'no-void': ['error', { allowAsStatement: true }],
|
||||||
|
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
||||||
|
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||||
|
// this should not run on ts files: https://github.com/import-js/eslint-plugin-import/issues/2215#issuecomment-911245486
|
||||||
|
'import/unambiguous': 'off',
|
||||||
|
// this is not compatible with typeorm, due to joined tables can be null, but are not defined as nullable
|
||||||
|
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
// this is to properly reference the referenced project database without requirement of compiling it
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['*.test.ts'],
|
||||||
|
plugins: ['jest'],
|
||||||
|
rules: {
|
||||||
|
'jest/no-disabled-tests': 'error',
|
||||||
|
'jest/no-focused-tests': 'error',
|
||||||
|
'jest/no-identical-title': 'error',
|
||||||
|
'jest/prefer-to-have-length': 'error',
|
||||||
|
'jest/valid-expect': 'error',
|
||||||
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
|
// 'jest/unbound-method': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
9
federation/.prettierrc.js
Normal file
9
federation/.prettierrc.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
semi: false,
|
||||||
|
printWidth: 100,
|
||||||
|
singleQuote: true,
|
||||||
|
trailingComma: "all",
|
||||||
|
tabWidth: 2,
|
||||||
|
bracketSpacing: true,
|
||||||
|
endOfLine: "auto",
|
||||||
|
};
|
||||||
@ -3,12 +3,7 @@ module.exports = {
|
|||||||
verbose: true,
|
verbose: true,
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest',
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**', '!src/seeds/**', '!build/**'],
|
||||||
'src/**/*.ts',
|
|
||||||
'!**/node_modules/**',
|
|
||||||
'!src/seeds/**',
|
|
||||||
'!build/**',
|
|
||||||
],
|
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
lines: 72,
|
lines: 72,
|
||||||
|
|||||||
@ -34,17 +34,21 @@
|
|||||||
"@types/jest": "27.0.2",
|
"@types/jest": "27.0.2",
|
||||||
"@types/lodash.clonedeep": "^4.5.6",
|
"@types/lodash.clonedeep": "^4.5.6",
|
||||||
"@types/node": "^16.10.3",
|
"@types/node": "^16.10.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||||
"@typescript-eslint/parser": "^4.28.0",
|
"@typescript-eslint/parser": "^5.57.1",
|
||||||
"apollo-server-testing": "2.25.2",
|
"apollo-server-testing": "2.25.2",
|
||||||
"eslint": "^7.29.0",
|
"eslint": "^8.37.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-config-standard": "^16.0.3",
|
"eslint-config-standard": "^17.0.0",
|
||||||
"eslint-plugin-import": "^2.23.4",
|
"eslint-import-resolver-typescript": "^3.5.4",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-promise": "^5.1.0",
|
"eslint-plugin-n": "^15.7.0",
|
||||||
"jest": "27.2.4",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
|
"eslint-plugin-security": "^1.7.1",
|
||||||
|
"eslint-plugin-type-graphql": "^1.0.0",
|
||||||
|
"jest": "^27.2.4",
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": "^2.0.7",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.3.1",
|
||||||
"ts-jest": "27.0.5",
|
"ts-jest": "27.0.5",
|
||||||
|
|||||||
@ -36,21 +36,18 @@ const database = {
|
|||||||
DB_USER: process.env.DB_USER || 'root',
|
DB_USER: process.env.DB_USER || 'root',
|
||||||
DB_PASSWORD: process.env.DB_PASSWORD || '',
|
DB_PASSWORD: process.env.DB_PASSWORD || '',
|
||||||
DB_DATABASE: process.env.DB_DATABASE || 'gradido_community',
|
DB_DATABASE: process.env.DB_DATABASE || 'gradido_community',
|
||||||
TYPEORM_LOGGING_RELATIVE_PATH:
|
TYPEORM_LOGGING_RELATIVE_PATH: process.env.TYPEORM_LOGGING_RELATIVE_PATH || 'typeorm.backend.log',
|
||||||
process.env.TYPEORM_LOGGING_RELATIVE_PATH || 'typeorm.backend.log',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check config version
|
// Check config version
|
||||||
constants.CONFIG_VERSION.CURRENT =
|
constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT
|
||||||
process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT
|
|
||||||
if (
|
if (
|
||||||
![
|
![constants.CONFIG_VERSION.EXPECTED, constants.CONFIG_VERSION.DEFAULT].includes(
|
||||||
constants.CONFIG_VERSION.EXPECTED,
|
constants.CONFIG_VERSION.CURRENT,
|
||||||
constants.CONFIG_VERSION.DEFAULT,
|
)
|
||||||
].includes(constants.CONFIG_VERSION.CURRENT)
|
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Fatal: Config Version incorrect - expected "${constants.CONFIG_VERSION.EXPECTED}" or "${constants.CONFIG_VERSION.DEFAULT}", but found "${constants.CONFIG_VERSION.CURRENT}"`
|
`Fatal: Config Version incorrect - expected "${constants.CONFIG_VERSION.EXPECTED}" or "${constants.CONFIG_VERSION.DEFAULT}", but found "${constants.CONFIG_VERSION.CURRENT}"`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,5 @@ import { federationLogger as logger } from '@/server/logger'
|
|||||||
|
|
||||||
export const getApiResolvers = (): string => {
|
export const getApiResolvers = (): string => {
|
||||||
logger.info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
|
logger.info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
|
||||||
return path.join(
|
return path.join(__dirname, `./${CONFIG.FEDERATION_API}/resolver/*Resolver.{ts,js}`)
|
||||||
__dirname,
|
|
||||||
`./${CONFIG.FEDERATION_API}/resolver/*Resolver.{ts,js}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,13 +14,11 @@ async function main() {
|
|||||||
|
|
||||||
app.listen(CONFIG.FEDERATION_PORT, () => {
|
app.listen(CONFIG.FEDERATION_PORT, () => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(
|
console.log(`Server is running at http://localhost:${CONFIG.FEDERATION_PORT}`)
|
||||||
`Server is running at http://localhost:${CONFIG.FEDERATION_PORT}`
|
|
||||||
)
|
|
||||||
if (CONFIG.GRAPHIQL) {
|
if (CONFIG.GRAPHIQL) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(
|
console.log(
|
||||||
`GraphIQL available at ${CONFIG.FEDERATION_COMMUNITY_URL}/api/${CONFIG.FEDERATION_API}`
|
`GraphIQL available at ${CONFIG.FEDERATION_COMMUNITY_URL}/api/${CONFIG.FEDERATION_API}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -36,7 +36,7 @@ type ServerDef = { apollo: ApolloServer; app: Express; con: Connection }
|
|||||||
const createServer = async (
|
const createServer = async (
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
// context: any = serverContext,
|
// context: any = serverContext,
|
||||||
logger: Logger = apolloLogger
|
logger: Logger = apolloLogger,
|
||||||
// localization: i18n.I18n = i18n,
|
// localization: i18n.I18n = i18n,
|
||||||
): Promise<ServerDef> => {
|
): Promise<ServerDef> => {
|
||||||
logger.addContext('user', 'unknown')
|
logger.addContext('user', 'unknown')
|
||||||
|
|||||||
@ -12,25 +12,13 @@ options.appenders.federation.filename = filename
|
|||||||
.replace('%v', CONFIG.FEDERATION_API)
|
.replace('%v', CONFIG.FEDERATION_API)
|
||||||
.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
||||||
filename = options.appenders.access.filename
|
filename = options.appenders.access.filename
|
||||||
options.appenders.access.filename = filename.replace(
|
options.appenders.access.filename = filename.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
||||||
'%p',
|
|
||||||
CONFIG.FEDERATION_PORT.toString()
|
|
||||||
)
|
|
||||||
filename = options.appenders.apollo.filename
|
filename = options.appenders.apollo.filename
|
||||||
options.appenders.apollo.filename = filename.replace(
|
options.appenders.apollo.filename = filename.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
||||||
'%p',
|
|
||||||
CONFIG.FEDERATION_PORT.toString()
|
|
||||||
)
|
|
||||||
filename = options.appenders.backend.filename
|
filename = options.appenders.backend.filename
|
||||||
options.appenders.backend.filename = filename.replace(
|
options.appenders.backend.filename = filename.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
||||||
'%p',
|
|
||||||
CONFIG.FEDERATION_PORT.toString()
|
|
||||||
)
|
|
||||||
filename = options.appenders.errorFile.filename
|
filename = options.appenders.errorFile.filename
|
||||||
options.appenders.errorFile.filename = filename.replace(
|
options.appenders.errorFile.filename = filename.replace('%p', CONFIG.FEDERATION_PORT.toString())
|
||||||
'%p',
|
|
||||||
CONFIG.FEDERATION_PORT.toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
log4js.configure(options)
|
log4js.configure(options)
|
||||||
|
|
||||||
|
|||||||
@ -34,17 +34,12 @@ const logPlugin = {
|
|||||||
const { query, mutation, variables, operationName } = requestContext.request
|
const { query, mutation, variables, operationName } = requestContext.request
|
||||||
if (operationName !== 'IntrospectionQuery') {
|
if (operationName !== 'IntrospectionQuery') {
|
||||||
logger.info(`Request:
|
logger.info(`Request:
|
||||||
${mutation || query}variables: ${JSON.stringify(
|
${mutation || query}variables: ${JSON.stringify(filterVariables(variables), null, 2)}`)
|
||||||
filterVariables(variables),
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
)}`)
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
willSendResponse(requestContext: any) {
|
willSendResponse(requestContext: any) {
|
||||||
if (operationName !== 'IntrospectionQuery') {
|
if (operationName !== 'IntrospectionQuery') {
|
||||||
if (requestContext.context.user)
|
if (requestContext.context.user) logger.info(`User ID: ${requestContext.context.user.id}`)
|
||||||
logger.info(`User ID: ${requestContext.context.user.id}`)
|
|
||||||
if (requestContext.response.data) {
|
if (requestContext.response.data) {
|
||||||
logger.info('Response Success!')
|
logger.info('Response Success!')
|
||||||
logger.trace(`Response-Data:
|
logger.trace(`Response-Data:
|
||||||
@ -61,8 +56,6 @@ ${JSON.stringify(requestContext.response.errors, null, 2)}`)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const plugins =
|
const plugins =
|
||||||
process.env.NODE_ENV === 'development'
|
process.env.NODE_ENV === 'development' ? [setHeadersPlugin] : [setHeadersPlugin, logPlugin]
|
||||||
? [setHeadersPlugin]
|
|
||||||
: [setHeadersPlugin, logPlugin]
|
|
||||||
|
|
||||||
export default plugins
|
export default plugins
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const checkDBVersion = async (DB_VERSION: string): Promise<boolean> => {
|
|||||||
logger.error(
|
logger.error(
|
||||||
`Wrong database version detected - the backend requires '${DB_VERSION}' but found '${
|
`Wrong database version detected - the backend requires '${DB_VERSION}' but found '${
|
||||||
dbVersion || 'None'
|
dbVersion || 'None'
|
||||||
}`
|
}`,
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user