diff --git a/.eslintrc.json b/.eslintrc.json index 262fed1ad75852b..8eec065efcf790b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -93,7 +93,9 @@ } ], "no-useless-constructor": "off", - "@typescript-eslint/no-useless-constructor": "warn" + "@typescript-eslint/no-useless-constructor": "warn", + "@typescript-eslint/prefer-literal-enum-member": "error", + "@typescript-eslint/prefer-namespace-keyword": "error" } }, { @@ -326,6 +328,8 @@ "react/react-in-jsx-scope": "error", "react/require-render-return": "error", "react/style-prop-object": "warn", - "react-hooks/rules-of-hooks": "error" + "react-hooks/rules-of-hooks": "error", + // "@typescript-eslint/non-nullable-type-assertion-style": "warn", + "@typescript-eslint/prefer-as-const": "warn" } } diff --git a/examples/convex/convex/_generated/dataModel.ts b/examples/convex/convex/_generated/dataModel.ts index 87c7cb3c1fbefef..2f229880ec7cfd7 100644 --- a/examples/convex/convex/_generated/dataModel.ts +++ b/examples/convex/convex/_generated/dataModel.ts @@ -9,8 +9,8 @@ * @module */ -import { AnyDataModel } from "convex/server"; -import { GenericId } from "convex/values"; +import { AnyDataModel } from 'convex/server' +import { GenericId } from 'convex/values' /** * No `schema.ts` file found! @@ -26,12 +26,12 @@ import { GenericId } from "convex/values"; /** * The names of all of your Convex tables. */ -export type TableNames = string; +export type TableNames = string /** * The type of a document stored in Convex. */ -export type Document = any; +export type Document = any /** * An identifier for a document in Convex. @@ -45,8 +45,8 @@ export type Document = any; * Using `===` will not work because two different instances of `Id` can refer * to the same document. */ -export type Id = GenericId; -export const Id = GenericId; +export type Id = GenericId +export const Id = GenericId /** * A type describing your Convex data model. @@ -57,4 +57,4 @@ export const Id = GenericId; * This type is used to parameterize methods like `queryGeneric` and * `mutationGeneric` to make them type-safe. */ -export type DataModel = AnyDataModel; +export type DataModel = AnyDataModel diff --git a/examples/convex/convex/_generated/react.ts b/examples/convex/convex/_generated/react.ts index 0ed0e5634a0ccec..1859ea22336cd59 100644 --- a/examples/convex/convex/_generated/react.ts +++ b/examples/convex/convex/_generated/react.ts @@ -9,10 +9,10 @@ * @module */ -import type getCounter from "../getCounter"; -import type incrementCounter from "../incrementCounter"; -import type { OptimisticLocalStore as GenericOptimisticLocalStore } from "convex/browser"; -import type { ClientMutation, ClientQuery } from "convex/server"; +import type getCounter from '../getCounter' +import type incrementCounter from '../incrementCounter' +import type { OptimisticLocalStore as GenericOptimisticLocalStore } from 'convex/browser' +import type { ClientMutation, ClientQuery } from 'convex/server' /** * A type describing your app's public Convex API. @@ -25,14 +25,14 @@ import type { ClientMutation, ClientQuery } from "convex/server"; */ export type ConvexAPI = { queries: { - getCounter: ClientQuery; - }; + getCounter: ClientQuery + } mutations: { - incrementCounter: ClientMutation; - }; -}; + incrementCounter: ClientMutation + } +} -import { makeUseQuery, makeUseMutation, makeUseConvex } from "convex/react"; +import { makeUseQuery, makeUseMutation, makeUseConvex } from 'convex/react' /** * Load a reactive query within a React component. @@ -46,7 +46,7 @@ import { makeUseQuery, makeUseMutation, makeUseConvex } from "convex/react"; * @param args - The arguments to the query function. * @returns `undefined` if loading and the query's return value otherwise. */ -export const useQuery = makeUseQuery(); +export const useQuery = makeUseQuery() /** * Construct a new {@link ReactMutation}. @@ -64,7 +64,7 @@ export const useQuery = makeUseQuery(); * @param name - The name of the mutation. * @returns The {@link ReactMutation} object with that name. */ -export const useMutation = makeUseMutation(); +export const useMutation = makeUseMutation() /** * Get the {@link ConvexReactClient} within a React component. @@ -73,10 +73,10 @@ export const useMutation = makeUseMutation(); * * @returns The active {@link ConvexReactClient} object, or `undefined`. */ -export const useConvex = makeUseConvex(); +export const useConvex = makeUseConvex() /** * A view of the query results currently in the Convex client for use within * optimistic updates. */ -export type OptimisticLocalStore = GenericOptimisticLocalStore; +export type OptimisticLocalStore = GenericOptimisticLocalStore diff --git a/examples/convex/convex/_generated/server.ts b/examples/convex/convex/_generated/server.ts index 0e8d913bbd0a73a..833b51dcc8ef08e 100644 --- a/examples/convex/convex/_generated/server.ts +++ b/examples/convex/convex/_generated/server.ts @@ -16,8 +16,8 @@ import { MutationCtx as GenericMutationCtx, DatabaseReader as GenericDatabaseReader, DatabaseWriter as GenericDatabaseWriter, -} from "convex/server"; -import { DataModel } from "./dataModel.js"; +} from 'convex/server' +import { DataModel } from './dataModel.js' /** * Define a query in this Convex app's public API. @@ -27,7 +27,7 @@ import { DataModel } from "./dataModel.js"; * @param func - The query function. It receives a {@link QueryCtx} as its first argument. * @returns The wrapped query. Include this as an `export` to name it and make it accessible. */ -export const query = makeQuery(); +export const query = makeQuery() /** * Define a mutation in this Convex app's public API. @@ -37,7 +37,7 @@ export const query = makeQuery(); * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. */ -export const mutation = makeMutation(); +export const mutation = makeMutation() /** * A set of services for use within Convex query functions. @@ -48,7 +48,7 @@ export const mutation = makeMutation(); * This differs from the {@link MutationCtx} because all of the services are * read-only. */ -export type QueryCtx = GenericQueryCtx; +export type QueryCtx = GenericQueryCtx /** * A set of services for use within Convex mutation functions. @@ -56,7 +56,7 @@ export type QueryCtx = GenericQueryCtx; * The mutation context is passed as the first argument to any Convex mutation * function run on the server. */ -export type MutationCtx = GenericMutationCtx; +export type MutationCtx = GenericMutationCtx /** * An interface to read from the database within Convex query functions. @@ -65,7 +65,7 @@ export type MutationCtx = GenericMutationCtx; * document by its {@link Id}, or {@link DatabaseReader.table}, which starts * building a query. */ -export type DatabaseReader = GenericDatabaseReader; +export type DatabaseReader = GenericDatabaseReader /** * An interface to read from and write to the database within Convex mutation @@ -76,4 +76,4 @@ export type DatabaseReader = GenericDatabaseReader; * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control) * for the guarantees Convex provides your functions. */ -export type DatabaseWriter = GenericDatabaseWriter; +export type DatabaseWriter = GenericDatabaseWriter diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index fc4fd2597c40bdd..29b5a607ad42692 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -335,7 +335,7 @@ declare module 'next/dist/compiled/@segment/ajv-human-errors' { export = m } -declare module NodeJS { +declare namespace NodeJS { interface ProcessVersions { pnp?: string }