Skip to content

Commit

Permalink
migrated eslint donfic from eslintrc.* to eslint.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelgeek committed Sep 11, 2024
1 parent c50796b commit 5850021
Show file tree
Hide file tree
Showing 32 changed files with 1,409 additions and 265 deletions.
77 changes: 0 additions & 77 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ apps/frontend-vue/.env
infrastructure/.env
.nx-cache
.nx
apps/api/src/generated
*.env
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

/dist
/coverage

/.nx/cache
/.nx/workspace-data
1 change: 1 addition & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=
19 changes: 0 additions & 19 deletions apps/api/.eslintrc.json

This file was deleted.

17 changes: 17 additions & 0 deletions apps/api/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const baseConfig = require('../../eslint.config.js')

module.exports = [
...baseConfig,
{ rules: { curly: 'error' } },
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'off',
},
languageOptions: {
parserOptions: { project: ['apps/api/tsconfig.*?.json'] },
},
},
{ ignores: ['**/*/src/generated', '**/node_modules'] },
]
16 changes: 16 additions & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@nx-vite-infra/api",
"version": "1.0.0",
"description": "A sample Express app to demonstrate using Apollo GraphQL with Nexus and Prisma",
"main": "src/server.ts",
"keywords": [
"apollo",
"graphql",
"nexus",
"prisma",
"node",
"express"
],
"author": "manuelgeek",
"license": "MIT"
}
77 changes: 74 additions & 3 deletions apps/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,70 @@
"projectType": "application",
"tags": [],
"targets": {
"nexus-generate": {
"executor": "nx:run-commands",
"outputs": [
"{projectRoot}/graphql/schema.graphql",
"{workspaceRoot}/node_modules/@types/nexus-typegen-custom/index.d.ts"
],
"options": {
"cwd": "apps/api/",
"commands": [
"npx cross-env TS_NODE_PROJECT=tsconfig.app.json ts-node -r tsconfig-paths/register --transpile-only src/schema.ts"
]
},
"dependsOn": [
{
"target": "build",
"dependencies": true
}
]
},
"format": {
"executor": "nx:run-commands",
"options": {
"cwd": "apps/api",
"commands": ["npx prisma format --schema src/prisma/schema.prisma"]
}
},
"migrate-dev": {
"executor": "nx:run-commands",
"options": {
"cwd": "apps/api",
"commands": ["npx prisma migrate dev --schema src/prisma/schema.prisma"]
}
},
"migrate-reset": {
"executor": "nx:run-commands",
"options": {
"cwd": "apps/api",
"commands": [
"npx prisma migrate reset --force --schema src/prisma/schema.prisma"
]
}
},
"migrate-deploy": {
"executor": "nx:run-commands",
"options": {
"cwd": "apps/api",
"commands": [
"npx prisma migrate deploy --schema src/prisma/schema.prisma"
]
}
},
"generate": {
"executor": "nx:run-commands",
"outputs": ["{projectRoot}/src/generated"],
"options": {
"cwd": "apps/api",
"commands": [
{
"command": "npx prisma generate --schema src/prisma/schema.prisma",
"forwardAllArgs": false
}
]
}
},
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
Expand All @@ -14,9 +78,8 @@
"outputPath": "dist/apps/api",
"format": ["cjs"],
"bundle": false,
"main": "apps/api/src/main.ts",
"main": "apps/api/src/server.ts",
"tsConfig": "apps/api/tsconfig.app.json",
"assets": ["apps/api/src/assets"],
"generatePackageJson": true,
"esbuildOptions": {
"sourcemap": true,
Expand All @@ -35,7 +98,15 @@
}
}
}
}
},
"dependsOn": [
{
"target": "generate"
},
{
"target": "nexus-generate"
}
]
},
"serve": {
"executor": "@nx/js:node",
Expand Down
Empty file removed apps/api/src/assets/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions apps/api/src/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { PrismaClient } from '@prisma/client'

export interface Context {
db: PrismaClient
}

export const context = {
db: new PrismaClient(),
}
Loading

0 comments on commit 5850021

Please sign in to comment.