nuqs is used for managing URL query state in Next.js applications. Follow these guidelines when working with it:
-
Import necessary functions from
nuqs:import { parseAsBoolean, parseAsStringEnum, useQueryState } from "nuqs";
| // eslint-plugin-array-methods/rules/prefer-array-immutable-methods.js | |
| module.exports = { | |
| create: function (context) { | |
| return { | |
| CallExpression(node) { | |
| const sourceCode = context.getSourceCode() | |
| if (node.callee.type !== 'MemberExpression') return |
| import type { ZodSchema } from 'zod'; | |
| import { parseSchema } from '@/lib/schemas/parseSchema'; | |
| /** Get a response with a file to download */ | |
| export const getFileResponse = <T>({ | |
| file, | |
| filename, | |
| schema, | |
| }: { |
| 'use client'; | |
| import * as React from 'react'; | |
| import type { DataTableFilterField } from '@/components/ui/data-table/data-table.types'; | |
| import { | |
| type ColumnDef, | |
| type ColumnFiltersState, | |
| type PaginationState, |
| export const fetchCompressImage = async (file: Blob) => { | |
| const formData = new FormData(); | |
| formData.append('Content-Type', file.type); | |
| formData.append('file', file); | |
| const res = await fetch(apiRoutes.compressImage, { | |
| body: formData, | |
| method: 'POST', | |
| }); |
| export const searchRange = ( | |
| editor: PlateEditor, | |
| search: string | [string, string], | |
| { | |
| match, | |
| // from, | |
| }: { | |
| match?: GetNodeEntriesOptions['match'] | |
| from?: Point | |
| } = {}, |
| 'use client'; | |
| export function withTooltip< | |
| T extends React.ComponentType<any> | keyof HTMLElementTagNameMap, | |
| >(Component: T) { | |
| return React.forwardRef< | |
| React.ElementRef<T>, | |
| React.ComponentPropsWithoutRef<T> & { | |
| tooltip?: React.ReactNode; | |
| tooltipContentProps?: Omit< |
| import { | |
| getPluginType, | |
| type PlatePlugin, | |
| type TDescendant, | |
| type TElement, | |
| type TText, | |
| } from '@udecode/plate-common'; | |
| import { | |
| remarkTransformElementChildren, | |
| type DeserializeMdPlugin, |
| const RemoteSelection = ({ data, selectionRects, caretPosition }: CursorOverlayData<CursorData>) => { | |
| if (!data) { | |
| return null | |
| } | |
| return ( | |
| <> | |
| {selectionRects.map((position, i) => ( | |
| <div | |
| key={i} |
| export const MARK_THREAD = 'thread' | |
| export const getThreadKey = (id: string) => MARK_THREAD + '_' + id | |
| export const isThreadKey = (key: string) => key.startsWith(MARK_THREAD + '_') | |
| export const createThreadPlugin = createPluginFactory({ | |
| key: MARK_THREAD, | |
| isLeaf: true, |