komische linting results...

This commit is contained in:
Claus-Peter Hübner 2023-01-12 18:22:24 +01:00
parent 9547eff793
commit 8dd1ef881f
8 changed files with 3188 additions and 265 deletions

3
federation/.eslintignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
**/*.min.js
build

26
federation/.eslintrc.js Normal file
View File

@ -0,0 +1,26 @@
module.exports = {
root: true,
env: {
node: true,
// jest: true,
},
parser: "@typescript-eslint/parser",
plugins: ["prettier", "@typescript-eslint" /*, 'jest' */],
extends: [
"standard",
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
],
// add your custom rules here
rules: {
"no-console": ["error"],
"no-debugger": "error",
"prettier/prettier": [
"error",
{
htmlWhitespaceSensitivity: "ignore",
},
],
},
};

View File

@ -15,27 +15,46 @@
"lint": "eslint --max-warnings=0 --ext .js,.ts ."
},
"dependencies": {
"@types/dotenv": "^8.2.0",
"@types/i18n": "^0.13.6",
"@types/jsonwebtoken": "^8.5.9",
"@types/lodash.clonedeep": "^4.5.7",
"@types/node": "^18.11.11",
"apollo-server-express": "2.25.2",
"apollo-server-express": "^2.25.2",
"class-validator": "^0.13.2",
"cors": "2.8.5",
"cross-env": "^7.0.3",
"decimal.js-light": "^2.5.1",
"dotenv": "10.0.0",
"express": "4.17.1",
"graphql": "15.5.1",
"i18n": "0.15.1",
"jsonwebtoken": "^8.5.1",
"lodash.clonedeep": "^4.5.0",
"log4js": "^6.7.1",
"nodemon": "^2.0.20",
"reflect-metadata": "^0.1.13",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.1",
"type-graphql": "^1.1.1",
"typescript": "^4.9.3"
},
"devDependencies": {
"@types/express": "^4.17.12",
"@types/jest": "^27.0.2",
"@types/lodash.clonedeep": "^4.5.7",
"@types/node": "^16.10.3",
"@types/nodemailer": "^6.4.4",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"apollo-server-testing": "^2.25.2",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"faker": "^5.5.3",
"jest": "^27.2.4",
"nodemon": "^2.0.7",
"prettier": "^2.3.1",
"ts-jest": "^27.0.5",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.1",
"typescript": "^4.9.3"
}
}

View File

@ -1,22 +1,21 @@
import { Field, ObjectType, Query, Resolver } from 'type-graphql'
import { federationLogger as logger } from '@/server/logger'
import { Field, ObjectType, Query, Resolver } from "type-graphql";
import { federationLogger as logger } from "@/server/logger";
@ObjectType()
class GetTestApiResult {
constructor(apiVersion: string) {
this.api = `${apiVersion}`
this.api = `${apiVersion}`;
}
@Field(() => String)
api: string
api: string;
}
@Resolver()
export class TestResolver {
export class TestResolver {
@Query(() => GetTestApiResult)
async test(): Promise<GetTestApiResult> {
logger.info(`test api 1_1`)
return new GetTestApiResult("1_1")
logger.info(`test api 1_1`);
return new GetTestApiResult("1_1");
}
}

View File

@ -1,22 +1,21 @@
import { Field, ObjectType, Query, Resolver } from 'type-graphql'
import { federationLogger as logger } from '@/server/logger'
import { Field, ObjectType, Query, Resolver } from "type-graphql";
import { federationLogger as logger } from "@/server/logger";
@ObjectType()
class GetTestApiResult {
constructor(apiVersion: string) {
this.api = `${apiVersion}`
this.api = `${apiVersion}`;
}
@Field(() => String)
api: string
api: string;
}
@Resolver()
export class TestResolver {
export class TestResolver {
@Query(() => GetTestApiResult)
async test(): Promise<GetTestApiResult> {
logger.info(`test api 2_0`)
return new GetTestApiResult("2_0")
logger.info(`test api 2_0`);
return new GetTestApiResult("2_0");
}
}

View File

@ -1,23 +1,23 @@
import { GraphQLScalarType, Kind } from 'graphql'
import Decimal from 'decimal.js-light'
import { GraphQLScalarType, Kind } from "graphql";
import Decimal from "decimal.js-light";
export default new GraphQLScalarType({
name: 'Decimal',
description: 'The `Decimal` scalar type to represent currency values',
name: "Decimal",
description: "The `Decimal` scalar type to represent currency values",
serialize(value: Decimal) {
return value.toString()
return value.toString();
},
parseValue(value) {
return new Decimal(value)
return new Decimal(value);
},
parseLiteral(ast) {
if (ast.kind !== Kind.STRING) {
throw new TypeError(`${String(ast)} is not a valid decimal value.`)
throw new TypeError(`${String(ast)} is not a valid decimal value.`);
}
return new Decimal(ast.value)
return new Decimal(ast.value);
},
})
});

View File

@ -1,33 +1,33 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import createServer from "./server/createServer";
import createServer from "./server/createServer"
// config
import CONFIG from "./config";
import CONFIG from "./config"
async function main() {
// eslint-disable-next-line no-console
console.log(`FEDERATION_PORT=${CONFIG.FEDERATION_PORT}`);
console.log(`FEDERATION_PORT=${CONFIG.FEDERATION_PORT}`)
// eslint-disable-next-line no-console
console.log(`FEDERATION_API=${CONFIG.FEDERATION_API}`);
const { app } = await createServer();
console.log(`FEDERATION_API=${CONFIG.FEDERATION_API}`)
const { app } = await createServer()
app.listen(CONFIG.FEDERATION_PORT, () => {
// eslint-disable-next-line no-console
console.log(
`Server is running at http://localhost:${CONFIG.FEDERATION_PORT}`
);
)
if (CONFIG.GRAPHIQL) {
// eslint-disable-next-line no-console
console.log(
`GraphIQL available at http://localhost:${CONFIG.FEDERATION_PORT}`
);
)
}
});
})
}
main().catch((e) => {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
});
console.error(e)
process.exit(1)
})

File diff suppressed because it is too large Load Diff