-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Im running into issues with ESlint (mainly in CI context) when using import { db, schema } from 'hub:db'. It seems that schema is not properly typed in that context (though nuxi typecheck does pass)
Take the following example:
import { schema, db } from 'hub:db'
export default defineEventHandler(async (_event) => {
const data = await db
.select()
.from(schema.exampleTable)
.all()
if (data.length > 0) {
return data[0]
}
throw createError({ statusCode: 404, statusMessage: 'No data found' })
})This would result in these linting errors
nuxt lint: 5:56 error Unsafe member access .exampleTable on an `error` typed value @typescript-eslint/no-unsafe-member-access
nuxt lint: 9:15 error Unsafe member access [0] on an `error` typed value @typescript-eslint/no-unsafe-member-access
As soon as i start the development server (nuxt dev) the linting succeeds. However, this is not the case when running nuxt prepare, which is what happens in CI.
Steps to reproduce
Steps to reproduce the behavior:
- Setup Nuxt eslint module
- Create a schema
- import that schema and query it via a server route
- Setup linting in CI
- Run linting in CI
You should see errors like the one mentioned above
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working