Skip to content

Commit dcda920

Browse files
refactor: Add new eslint sorting from main (#5723)
1 parent d6322ae commit dcda920

File tree

139 files changed

+534
-517
lines changed

Some content is hidden

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

139 files changed

+534
-517
lines changed

.eslintrc.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,31 @@ const config = {
5454
],
5555
'import/default': 'off',
5656
'import/export': 'off',
57+
'import/namespace': 'off',
5758
'import/newline-after-import': 'error',
5859
'import/no-cycle': 'error',
5960
'import/no-duplicates': 'off',
61+
'import/no-named-as-default-member': 'off',
6062
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
6163
'import/no-unused-modules': ['off', { unusedExports: true }],
64+
'import/order': [
65+
'error',
66+
{
67+
groups: [
68+
'builtin',
69+
'external',
70+
'internal',
71+
'parent',
72+
'sibling',
73+
'index',
74+
'object',
75+
'type',
76+
],
77+
},
78+
],
6279
'no-redeclare': 'off',
6380
'no-shadow': 'error',
81+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
6482
},
6583
overrides: [
6684
{

packages/eslint-plugin-query/src/configs/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TSESLint } from '@typescript-eslint/utils'
21
import { rules } from '../rules'
2+
import type { TSESLint } from '@typescript-eslint/utils'
33

44
function generateRecommendedConfig(
55
allRules: Record<string, TSESLint.RuleModule<any, any>>,

packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { TSESLint } from '@typescript-eslint/utils'
21
import { AST_NODE_TYPES } from '@typescript-eslint/utils'
32
import { ASTUtils } from '../../utils/ast-utils'
43
import { createRule } from '../../utils/create-rule'
54
import { uniqueBy } from '../../utils/unique-by'
65
import { ExhaustiveDepsUtils } from './exhaustive-deps.utils'
6+
import type { TSESLint } from '@typescript-eslint/utils'
77

88
const QUERY_KEY = 'queryKey'
99
const QUERY_FN = 'queryFn'

packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { TSESLint } from '@typescript-eslint/utils'
21
import { AST_NODE_TYPES } from '@typescript-eslint/utils'
32
import { ASTUtils } from '../../utils/ast-utils'
3+
import type { TSESLint } from '@typescript-eslint/utils'
44

55
export const ExhaustiveDepsUtils = {
66
isRelevantReference(params: {

packages/eslint-plugin-query/src/utils/ast-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { AST_NODE_TYPES } from '@typescript-eslint/utils'
2+
import { uniqueBy } from './unique-by'
13
import type { TSESLint, TSESTree } from '@typescript-eslint/utils'
24
import type TSESLintScopeManager from '@typescript-eslint/scope-manager'
3-
import { AST_NODE_TYPES } from '@typescript-eslint/utils'
45
import type { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint'
5-
import { uniqueBy } from './unique-by'
66

77
export const ASTUtils = {
88
isNodeOfOneOf<T extends AST_NODE_TYPES>(

packages/eslint-plugin-query/src/utils/create-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ESLintUtils } from '@typescript-eslint/utils'
2-
import type { EnhancedCreate } from './detect-react-query-imports'
32
import { detectTanstackQueryImports } from './detect-react-query-imports'
3+
import type { EnhancedCreate } from './detect-react-query-imports'
44

55
const getDocsUrl = (ruleName: string): string =>
66
`https://tanstack.com/query/v4/docs/eslint/${ruleName}`

packages/query-async-storage-persister/src/__tests__/asyncThrottle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { vi } from 'vitest'
12
import { asyncThrottle } from '../asyncThrottle'
23
import { sleep as delay } from './utils'
3-
import { vi } from 'vitest'
44

55
describe('asyncThrottle', () => {
66
test('basic', async () => {

packages/query-async-storage-persister/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { asyncThrottle } from './asyncThrottle'
12
import type {
23
PersistedClient,
34
Persister,
45
Promisable,
56
} from '@tanstack/query-persist-client-core'
6-
import { asyncThrottle } from './asyncThrottle'
77

88
interface AsyncStorage {
99
getItem: (key: string) => Promise<string | null>

packages/query-core/src/infiniteQueryBehavior.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { QueryBehavior } from './query'
21
import { addToEnd, addToStart } from './utils'
2+
import type { QueryBehavior } from './query'
33
import type {
44
InfiniteData,
55
InfiniteQueryPageParamsOptions,

packages/query-core/src/infiniteQueryObserver.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1+
import { QueryObserver } from './queryObserver'
2+
import {
3+
hasNextPage,
4+
hasPreviousPage,
5+
infiniteQueryBehavior,
6+
} from './infiniteQueryBehavior'
17
import type {
8+
DefaultError,
29
DefaultedInfiniteQueryObserverOptions,
310
FetchNextPageOptions,
411
FetchPreviousPageOptions,
512
InfiniteData,
613
InfiniteQueryObserverOptions,
714
InfiniteQueryObserverResult,
815
QueryKey,
9-
DefaultError,
1016
} from './types'
1117
import type { QueryClient } from './queryClient'
1218
import type { NotifyOptions, ObserverFetchOptions } from './queryObserver'
13-
import { QueryObserver } from './queryObserver'
14-
import {
15-
hasNextPage,
16-
hasPreviousPage,
17-
infiniteQueryBehavior,
18-
} from './infiniteQueryBehavior'
1919
import type { Query } from './query'
2020

2121
type InfiniteQueryObserverListener<TData, TError> = (

0 commit comments

Comments
 (0)