Open fastmx opened 3 years ago
Hello, I'm trying to configure TS+ESLint with nexus-plugin prisma. No luck so far with it, I'm getting this error:
ESLint: Unsafe call of an any typed value.(@typescript-eslint/no-unsafe-call)
Is there anyone who made this work?
Here is my configuration:
Prisma model:
model Company { id Int @default(autoincrement()) @id symbol String name String description String }
Nexus
const Company = objectType({ name: "Company", definition(t) { t.model.id(); t.model.name(); t.model.description(); } }); const Query = queryType({ definition(t) { t.field("company", { type: Company, args: { id: idArg() }, resolve: (_root, { id }, ctx) => ctx.prisma.company.findUnique({ where: { id: Number(id) } }) }); } }); const schema = makeSchema({ types: [Query, Company], plugins: [nexusPrisma({ experimentalCRUD: true })], outputs: { schema: path.join(process.cwd(), "generated", "schema.gen.graphql"), typegen: path.join(process.cwd(), "generated", "nexusTypes.gen.ts") }, // sourceTypes: { modules: [{ module: ".prisma/client", alias: "PrismaClient" }] }, contextType: { module: path.join(process.cwd(), "src", "graphql", "context.ts"), export: "Context" }, sourceTypes: { modules: [ { module: "@prisma/client", alias: "prisma" } ] } });
Packages:
"dependencies": { "@prisma/client": "2.18.0", "@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/parser": "^4.18.0", "apollo-server-micro": "^2.21.1", "babel-eslint": "^10.1.0", "eslint": "^7.22.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-prettier": "^7.2.0", "eslint-plugin-flowtype": "^5.4.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^24.3.2", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "graphql": "^15.5.0", "next": "10.0.9", "nexus": "^1.0.0", "nexus-plugin-prisma": "^0.32.0", "prettier": "^2.2.1", "prisma": "2.18.0", "react": "17.0.1", "react-dom": "17.0.1" },
You are using the plugin wrong, you must let it create the type definition file that will fix this error.
Hello, I'm trying to configure TS+ESLint with nexus-plugin prisma. No luck so far with it, I'm getting this error:
Is there anyone who made this work?
Here is my configuration:
Prisma model:
Nexus
Packages: