Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/pink-onions-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@graphiql/plugin-code-exporter': minor
'@graphiql/plugin-doc-explorer': minor
'@graphiql/plugin-history': minor
'@graphiql/react': minor
'graphiql': minor
---

set "importsNotUsedAsValues": "error" in tsconfig
2 changes: 1 addition & 1 deletion packages/graphiql-plugin-code-exporter/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useOperationsEditorState, type GraphiQLPlugin } from '@graphiql/react';
import { FC } from 'react';
import type { FC } from 'react';
import GraphiQLCodeExporter, {
GraphiQLCodeExporterProps,
} from 'graphiql-code-exporter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Mock } from 'vitest';
import type { Mock } from 'vitest';
import { useGraphiQL as $useGraphiQL } from '@graphiql/react';
import { render } from '@testing-library/react';
import { GraphQLInt, GraphQLObjectType, GraphQLSchema } from 'graphql';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use no memo';
import { GraphQLNamedType, GraphQLType } from 'graphql';
import type { GraphQLNamedType, GraphQLType } from 'graphql';

export function unwrapType(type: GraphQLType): GraphQLNamedType {
return 'ofType' in type ? unwrapType(type.ofType) : type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, useEffect } from 'react';
import { fireEvent, render } from '@testing-library/react';
import { GraphQLNamedType } from 'graphql';
import type { GraphQLNamedType } from 'graphql';
import {
ExampleSchema,
ExampleEnum,
Expand All @@ -10,7 +10,7 @@ import {
import { docExplorerStore } from '../../context';
import { TypeDocumentation } from '../type-documentation';
import { unwrapType } from './test-utils';
import { SlicesWithActions } from '@graphiql/react';
import type { SlicesWithActions } from '@graphiql/react';

vi.mock('@graphiql/react', async () => {
const originalModule =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import { GraphQLArgument } from 'graphql';
import type { FC } from 'react';
import type { GraphQLArgument } from 'graphql';
import { MarkdownContent } from '@graphiql/react';
import { DefaultValue } from './default-value';
import { TypeLink } from './type-link';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react';
import type { FC } from 'react';
import { astFromValue, print, ValueNode } from 'graphql';
import { DocExplorerFieldDef } from '../context';
import type { DocExplorerFieldDef } from '../context';
import './default-value.css';

const printDefault = (ast?: ValueNode | null): string => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import { MarkdownContent } from '@graphiql/react';
import './deprecation-reason.css';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import { DirectiveNode } from 'graphql';
import type { FC } from 'react';
import type { DirectiveNode } from 'graphql';
import './directive.css';

type DirectiveProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isType } from 'graphql';
import { FC, ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import { ChevronLeftIcon, Spinner, useGraphiQL, pick } from '@graphiql/react';
import { useDocExplorer, useDocExplorerActions } from '../context';
import { FieldDocumentation } from './field-documentation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLArgument } from 'graphql';
import type { GraphQLArgument } from 'graphql';
import { FC, useState } from 'react';
import { Button, MarkdownContent } from '@graphiql/react';
import { DocExplorerFieldDef } from '../context';
import type { DocExplorerFieldDef } from '../context';
import { Argument } from './argument';
import { DeprecationReason } from './deprecation-reason';
import { Directive } from './directive';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import { DocExplorerFieldDef, useDocExplorerActions } from '../context';
import './field-link.css';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import type { GraphQLSchema } from 'graphql';
import { MarkdownContent } from '@graphiql/react';
import { ExplorerSection } from './section';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import {
ArgumentIcon,
DeprecatedArgumentIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
isObjectType,
} from 'graphql';
import { useGraphiQL, Button, MarkdownContent } from '@graphiql/react';
import { DocExplorerFieldDef } from '../context';
import type { DocExplorerFieldDef } from '../context';
import { Argument } from './argument';
import { DefaultValue } from './default-value';
import { DeprecationReason } from './deprecation-reason';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import { GraphQLType } from 'graphql';
import type { FC } from 'react';
import type { GraphQLType } from 'graphql';
import { useDocExplorerActions } from '../context';
import { renderType } from './utils';
import './type-link.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isListType,
isNonNullType,
} from 'graphql';
import { JSX } from 'react';
import type { JSX } from 'react';

export function renderType(
type: GraphQLType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
GraphQLInputType,
GraphQLType,
} from 'graphql';
import { Maybe } from 'graphql/jsutils/Maybe';
import type { Maybe } from 'graphql/jsutils/Maybe';

/**
* Copied from packages/codemirror-graphql/src/jump.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Mock } from 'vitest';
import type { Mock } from 'vitest';
import { fireEvent, render } from '@testing-library/react';
import type { ComponentProps } from 'react';
import { formatQuery, HistoryItem } from '../components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line react/jsx-filename-extension -- TODO
import { FC, ReactElement, ReactNode, useEffect } from 'react';
import { createStore } from 'zustand';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/header-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, useEffect, useRef } from 'react';
import { useGraphiQL, useGraphiQLActions } from './provider';
import { EditorProps } from '../types';
import type { EditorProps } from '../types';
import { HEADER_URI, KEY_BINDINGS, STORAGE_KEY } from '../constants';
import {
getOrCreateModel,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '../stores';
import { StorageStore, useStorage } from '../stores/storage';
import { ThemeStore } from '../stores/theme';
import { SlicesWithActions } from '../types';
import type { SlicesWithActions } from '../types';
import { pick, useDidUpdate, useSynchronizeValue } from '../utility';
import {
FragmentDefinitionNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/query-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
cleanupDisposables,
cn,
} from '../utility';
import { MonacoEditor, EditorProps, SchemaReference } from '../types';
import type { MonacoEditor, EditorProps, SchemaReference } from '../types';
import {
KEY_BINDINGS,
MONACO_GRAPHQL_API,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/response-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
cn,
} from '../utility';
import { KEY_BINDINGS, RESPONSE_URI } from '../constants';
import { EditorProps } from '../types';
import type { EditorProps } from '../types';
import type { editor as monacoEditor, Position } from '../monaco-editor';
import { Range, languages } from '../monaco-editor';

Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/components/toolbar-menu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import { cn } from '../../utility';
import { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';
import type { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';
import { DropdownMenu } from '../dropdown-menu';
import { Tooltip } from '../tooltip';
import './index.css';
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import * as T from '@radix-ui/react-tooltip';
import './index.css';

Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/components/variable-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, useEffect, useRef } from 'react';
import { useGraphiQL, useGraphiQLActions } from './provider';
import { EditorProps } from '../types';
import type { EditorProps } from '../types';
import { KEY_BINDINGS, STORAGE_KEY, VARIABLE_URI } from '../constants';
import {
getOrCreateModel,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { initializeMode } from 'monaco-graphql/esm/lite.js';
import { parse, print } from 'graphql';
import { KeyCode, KeyMod, Uri, languages } from './monaco-editor';
import { EditorSlice } from './stores';
import type { EditorSlice } from './stores';

export const isMacOs =
typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac');
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/icons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentProps, FC, SVGProps } from 'react';
import type { ComponentProps, FC, SVGProps } from 'react';

import _ArgumentIcon from './argument.svg?react';
import _ChevronDownIcon from './chevron-down.svg?react';
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/stores/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
OperationDefinitionNode,
DocumentNode,
} from 'graphql';
import { OperationFacts } from 'graphql-language-service';
import type { OperationFacts } from 'graphql-language-service';
import { MaybePromise, mergeAst } from '@graphiql/toolkit';
import { print } from 'graphql';
import { storageStore } from './storage';
Expand All @@ -17,7 +17,7 @@ import {
clearHeadersFromTabs,
serializeTabState,
} from '../utility/tabs';
import { SlicesWithActions, MonacoEditor } from '../types';
import type { SlicesWithActions, MonacoEditor } from '../types';
import { debounce, formatJSONC } from '../utility';
import { STORAGE_KEY } from '../constants';

Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/stores/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import getValue from 'get-value';

import type { StateCreator } from 'zustand';
import { formatJSONC, parseJSONC } from '../utility';
import { SlicesWithActions, MonacoEditor } from '../types';
import type { SlicesWithActions, MonacoEditor } from '../types';
import { Range } from '../monaco-editor';

export interface ExecutionSlice {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/stores/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentType } from 'react';
import type { ComponentType } from 'react';
import type { StateCreator } from 'zustand';
import type { SlicesWithActions } from '../types';
import { storageStore } from './storage';
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/stores/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
GraphQLSchema,
IntrospectionQuery,
} from 'graphql';
import { Dispatch } from 'react';
import type { Dispatch } from 'react';
import type { StateCreator } from 'zustand';
import { SlicesWithActions, SchemaReference } from '../types';
import type { SlicesWithActions, SchemaReference } from '../types';

type MaybeGraphQLSchema = GraphQLSchema | null | undefined;

Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
PluginActions,
SchemaActions,
} from './stores';
import { AllSlices, AllActions } from './types';
import type { AllSlices, AllActions } from './types';

describe('Should not have conflicting types', () => {
interface OverlapError<K extends PropertyKey> {
Expand Down
8 changes: 4 additions & 4 deletions packages/graphiql-react/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentPropsWithoutRef } from 'react';
import { AllTypeInfo } from 'graphql-language-service/esm/types';
import type { ComponentPropsWithoutRef } from 'react';
import type { AllTypeInfo } from 'graphql-language-service/esm/types';
import type { editor as monacoEditor } from './monaco-editor';
import {
import type {
EditorSlice,
ExecutionSlice,
PluginSlice,
Expand All @@ -12,7 +12,7 @@ import {
PluginActions,
SchemaActions,
} from './stores';
import { RuleKind } from 'graphql-language-service';
import type { RuleKind } from 'graphql-language-service';

export type EditorProps = ComponentPropsWithoutRef<'div'>;

Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/utility/create-editor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { KeyboardEventHandler, RefObject } from 'react';
import type { KeyboardEventHandler, RefObject } from 'react';
import type { Uri } from '../monaco-editor';
import { editor as monacoEditor } from '../monaco-editor';
import { MonacoEditor } from '../types';
import type { MonacoEditor } from '../types';

export const EDITOR_THEME = {
dark: 'graphiql-DARK',
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/utility/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { storageStore } from '../stores';
import { debounce } from './debounce';
import { MonacoEditor } from '../types';
import { type editor as monacoEditor } from '../monaco-editor';
import type { MonacoEditor } from '../types';
import type { editor as monacoEditor } from '../monaco-editor';
import { useGraphiQL, useGraphiQLActions } from '../components';

export function useSynchronizeValue(editor?: MonacoEditor, value?: string) {
Expand Down
1 change: 1 addition & 0 deletions packages/graphiql-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"jsx": "react-jsx",
"declaration": true,
"noUncheckedIndexedAccess": true,
"importsNotUsedAsValues": "error",
"types": ["vitest/globals", "@testing-library/jest-dom"]
}
}
2 changes: 1 addition & 1 deletion packages/graphiql/src/GraphiQL.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { act, render, waitFor, fireEvent } from '@testing-library/react';
import { Component } from 'react';
import { GraphiQL } from './GraphiQL';
import { Fetcher } from '@graphiql/toolkit';
import type { Fetcher } from '@graphiql/toolkit';
import { ToolbarButton } from '@graphiql/react';
import '@graphiql/react/setup-workers/vite';

Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/src/ui/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, ReactNode } from 'react';
import type { FC, ReactNode } from 'react';

// Configure the UI by providing this Component as a child of GraphiQL.
export const GraphiQLFooter: FC<{ children: ReactNode }> = ({ children }) => {
Expand Down
Loading