Skip to content

Commit ab47845

Browse files
chore: update antfu eslint (#384)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Streamlined module imports by clearly separating type-only imports from runtime imports, enhancing clarity and maintainability. - **Style** - Standardized formatting across code and tests—adjusting spacing in generator functions, type assertions, and similar constructs—for consistent presentation. - **Chore** - Updated linting configurations and dependency management, removing unused plugins and upgrading packages to support improved development practices. These internal enhancements improve code quality and consistency without altering end-user functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent 6e0dfe7 commit ab47845

68 files changed

Lines changed: 697 additions & 571 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/content/docs/advanced/validation-errors.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import { RPCHandler } from '@orpc/server/fetch'
1616
import { router } from './shared/planet'
1717
// ---cut---
1818
import { onError, ORPCError, ValidationError } from '@orpc/server'
19-
import { ZodError, type ZodIssue } from 'zod'
19+
import { ZodError } from 'zod'
20+
import type { ZodIssue } from 'zod'
2021

2122
const handler = new RPCHandler(router, {
2223
clientInterceptors: [
@@ -53,7 +54,8 @@ const handler = new RPCHandler(router, {
5354
## Customizing with Middleware
5455

5556
```ts twoslash
56-
import { z, ZodError, type ZodIssue } from 'zod'
57+
import { z, ZodError } from 'zod'
58+
import type { ZodIssue } from 'zod'
5759
import { onError, ORPCError, os, ValidationError } from '@orpc/server'
5860

5961
const base = os.use(onError((error) => {
@@ -105,7 +107,8 @@ As explained in the [error handling guide](/docs/error-handling#combining-both-a
105107
import { RPCHandler } from '@orpc/server/fetch'
106108
// ---cut---
107109
import { onError, ORPCError, os, ValidationError } from '@orpc/server'
108-
import { z, ZodError, type ZodIssue } from 'zod'
110+
import { z, ZodError } from 'zod'
111+
import type { ZodIssue } from 'zod'
109112

110113
const base = os.errors({
111114
INPUT_VALIDATION_FAILED: {

apps/content/docs/tanstack-query/react.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Integrate oRPC React Query utils into your React app with Context:
7474
```ts twoslash
7575
import { router } from './shared/planet'
7676
// ---cut---
77-
import { createContext, useContext } from 'react'
77+
import { createContext, use } from 'react'
7878
import { RouterUtils } from '@orpc/react-query'
7979
import { RouterClient } from '@orpc/server'
8080

@@ -83,7 +83,7 @@ Integrate oRPC React Query utils into your React app with Context:
8383
export const ORPCContext = createContext<ORPCReactUtils | undefined>(undefined)
8484

8585
export function useORPC(): ORPCReactUtils {
86-
const orpc = useContext(ORPCContext)
86+
const orpc = use(ORPCContext)
8787
if (!orpc) {
8888
throw new Error('ORPCContext is not set up properly')
8989
}

apps/content/examples/openai-streaming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const complete = os
2828
stream: true,
2929
})
3030

31-
yield * stream
31+
yield* stream
3232
})
3333

3434
const router = { complete }

eslint.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ import antfu from '@antfu/eslint-config'
22
import pluginBan from 'eslint-plugin-ban'
33

44
export default antfu({
5-
react: true,
65
formatters: true,
76
}, {
87
plugins: { ban: pluginBan },
98
rules: {
109
'ts/consistent-type-definitions': 'off',
11-
'react-refresh/only-export-components': 'off',
12-
'react/prefer-destructuring-assignment': 'off',
13-
'react/no-context-provider': 'off',
1410
'ts/method-signature-style': ['off'],
1511
'ban/ban': [
1612
'error',
@@ -38,7 +34,6 @@ export default antfu({
3834
rules: {
3935
'unused-imports/no-unused-vars': 'off',
4036
'antfu/no-top-level-await': 'off',
41-
'react-hooks/rules-of-hooks': 'off',
4237
'no-alert': 'off',
4338
'ban/ban': 'off',
4439
},
@@ -48,7 +43,6 @@ export default antfu({
4843
'no-console': 'off',
4944
'perfectionist/sort-imports': 'off',
5045
'import/first': 'off',
51-
'react-hooks/rules-of-hooks': 'off',
5246
'ban/ban': 'off',
5347
},
5448
}, {

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"packages:changelog:github": "pnpm dlx changelogithub --draft"
2828
},
2929
"devDependencies": {
30-
"@antfu/eslint-config": "^3.9.2",
31-
"@eslint-react/eslint-plugin": "^1.16.2",
30+
"@antfu/eslint-config": "^4.0.0",
3231
"@solidjs/testing-library": "^0.8.10",
3332
"@sveltejs/vite-plugin-svelte": "^5.0.3",
3433
"@testing-library/jest-dom": "^6.6.3",
@@ -42,8 +41,6 @@
4241
"eslint": "^9.15.0",
4342
"eslint-plugin-ban": "^2.0.0",
4443
"eslint-plugin-format": "^0.1.2",
45-
"eslint-plugin-react-hooks": "^5.0.0",
46-
"eslint-plugin-react-refresh": "^0.4.14",
4744
"jsdom": "^25.0.1",
4845
"lint-staged": "^15.2.10",
4946
"simple-git-hooks": "^2.11.1",

packages/client/src/adapters/standard/link.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type { Interceptor, ThrowableError } from '@orpc/shared'
22
import type { StandardLazyResponse, StandardRequest } from '@orpc/standard-server'
33
import type { ClientContext, ClientLink, ClientOptions } from '../../types'
4+
import type { StandardLinkPlugin } from './plugin'
45
import type { StandardLinkClient, StandardLinkCodec } from './types'
56
import { intercept, toArray } from '@orpc/shared'
6-
import { CompositeStandardLinkPlugin, type StandardLinkPlugin } from './plugin'
7+
import { CompositeStandardLinkPlugin } from './plugin'
78

89
export interface StandardLinkInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
910
path: readonly string[]

packages/client/src/adapters/standard/rpc-json-serializer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { isObject, type Segment } from '@orpc/shared'
1+
import type { Segment } from '@orpc/shared'
2+
import { isObject } from '@orpc/shared'
23

34
export const STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES = {
45
BIGINT: 0,

packages/client/src/adapters/standard/rpc-link-codec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import type { Value } from '@orpc/shared'
12
import type { StandardHeaders, StandardLazyResponse, StandardRequest, StandardResponse } from '@orpc/standard-server'
23
import type { ClientContext, ClientOptions, HTTPMethod } from '../../types'
34
import type { StandardRPCSerializer } from './rpc-serializer'
45
import type { StandardLinkCodec } from './types'
5-
import { isAsyncIteratorObject, stringifyJSON, value, type Value } from '@orpc/shared'
6+
import { isAsyncIteratorObject, stringifyJSON, value } from '@orpc/shared'
67
import { mergeStandardHeaders } from '@orpc/standard-server'
78
import { createORPCErrorFromJson, isORPCErrorJson, isORPCErrorStatus, ORPCError } from '../../error'
89
import { getMalformedResponseErrorCode, toHttpPath } from './utils'

packages/client/src/adapters/standard/rpc-link.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import type { ClientContext } from '../../types'
2+
import type { StandardLinkOptions } from './link'
3+
import type { StandardRPCJsonSerializerOptions } from './rpc-json-serializer'
4+
import type { StandardRPCLinkCodecOptions } from './rpc-link-codec'
25
import type { StandardLinkClient } from './types'
3-
import { StandardLink, type StandardLinkOptions } from './link'
4-
import { StandardRPCJsonSerializer, type StandardRPCJsonSerializerOptions } from './rpc-json-serializer'
5-
import { StandardRPCLinkCodec, type StandardRPCLinkCodecOptions } from './rpc-link-codec'
6+
import { StandardLink } from './link'
7+
import { StandardRPCJsonSerializer } from './rpc-json-serializer'
8+
import { StandardRPCLinkCodec } from './rpc-link-codec'
69
import { StandardRPCSerializer } from './rpc-serializer'
710

811
export interface StandardRPCLinkOptions<T extends ClientContext>

packages/client/src/dynamic-link.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DynamicLink } from './dynamic-link'
44
describe('dynamicLink', () => {
55
it('pass correct context', () => {
66
void new DynamicLink<{ batch?: boolean }>(({ context }, path, input) => {
7-
expectTypeOf(context).toEqualTypeOf<{ batch?: boolean } >()
7+
expectTypeOf(context).toEqualTypeOf<{ batch?: boolean }>()
88

99
return {} as any
1010
})

0 commit comments

Comments
 (0)