Skip to content

Commit

Permalink
fix(i18n): import i18n utils from relative path/sanity module (#5546)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored Jan 23, 2024
1 parent 475981d commit e536d23
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@playwright/test": "^1.39.0",
"@sanity/client": "^6.11.1",
"@sanity/eslint-config-i18n": "^1.0.0",
"@sanity/eslint-config-i18n": "^1.1.0",
"@sanity/pkg-utils": "^3.3.2",
"@sanity/test": "0.0.1-alpha.1",
"@sanity/tsdoc": "1.0.0-alpha.38",
Expand Down
1 change: 1 addition & 0 deletions packages/sanity/src/core/config/prepareConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {startCase} from 'lodash'
import {fromUrl} from '@sanity/bifur-client'
import {createElement, isValidElement} from 'react'
import {isValidElementType} from 'react-is'
// eslint-disable-next-line @sanity/i18n/no-i18next-import
import type {i18n} from 'i18next'
import {createSchema} from '../schema'
import {type AuthStore, createAuthStore, isAuthStore} from '../store/_legacy'
Expand Down
1 change: 1 addition & 0 deletions packages/sanity/src/core/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
} from '@sanity/types'
import type {ComponentType, ReactNode} from 'react'
import type {Observable} from 'rxjs'
// eslint-disable-next-line @sanity/i18n/no-i18next-import
import type {i18n} from 'i18next'
import type {FormBuilderCustomMarkersComponent, FormBuilderMarkersComponent} from '../form'
import type {LocalePluginOptions, LocaleSource} from '../i18n/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {memo, useCallback, useMemo} from 'react'
import {useTranslation} from 'react-i18next'
import {
PortableTextEditor,
usePortableTextEditor,
usePortableTextEditorSelection,
} from '@sanity/portable-text-editor'
import {isKeySegment} from '@sanity/types'
import {useTranslation} from '../../../../i18n'
import {PopoverProps} from '../../../../../ui-components'
import {CollapseMenu, CollapseMenuButton} from '../../../../components/collapseMenu'
import {ContextMenuButton} from '../../../../components/contextMenuButton'
Expand Down
5 changes: 5 additions & 0 deletions packages/sanity/src/core/i18n/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"@sanity/i18n/no-i18next-import": "off"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import styled from 'styled-components'
import {Card, Text} from '@sanity/ui'
import {BoltIcon} from '@sanity/icons'
import {purple, yellow} from '@sanity/color'
import {useTranslation} from 'react-i18next'
import {forwardRef} from 'react'
import {useTranslation} from '../../../../i18n'
import {Button} from '../../../../../ui-components'

const CenteredStroke = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SearchIcon} from '@sanity/icons'
import React, {forwardRef} from 'react'
import {useTranslation} from 'react-i18next'
import {useTranslation} from '../../../../i18n'
import {Button} from '../../../../../ui-components'
import {GLOBAL_SEARCH_KEY, GLOBAL_SEARCH_KEY_MODIFIER} from './constants'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {useElementRect, DialogProvider, Flex, PortalProvider, DialogProviderProps} from '@sanity/ui'
import {useState, useCallback, useMemo} from 'react'
import {useTranslation} from 'react-i18next'
import {Path} from 'sanity-diff-patch'
import styled from 'styled-components'
import isHotkey from 'is-hotkey'
Expand All @@ -25,6 +24,7 @@ import {TooltipDelayGroupProvider} from '../../../../ui-components'
import {getMenuItems} from '../menuItems'
import {DocumentLayoutError} from './DocumentLayoutError'
import {
useTranslation,
useZIndex,
ChangeConnectorRoot,
DocumentInspectorMenuItem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ObjectSchemaType, SchemaType} from '@sanity/types'
import type {ObjectSchemaType} from '@sanity/types'
import {Heading, Stack, Text} from '@sanity/ui'
import {useTranslation} from 'react-i18next'
import styled, {css} from 'styled-components'
import {structureLocaleNamespace} from '../../../../i18n'
import {useTranslation} from 'sanity'

interface DocumentHeaderProps {
documentId: string
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/ui-components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
BoxHeight,
} from '@sanity/ui'
import React, {ComponentProps, forwardRef} from 'react'
import {useTranslation} from 'react-i18next'
import {useTranslation} from 'sanity'

/** @internal */
export type DialogProps = Pick<
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3595,13 +3595,13 @@
resolved "https://registry.yarnpkg.com/@sanity/diff-match-patch/-/diff-match-patch-3.1.1.tgz#16514d3a550d880bae1f59cc3ffe6865f5a4b58a"
integrity sha512-dSZqGeYjHKGIkqAzGqLcG92LZyJGX+nYbs/FWawhBbTBDWi21kvQ0hsL3DJThuFVWtZMWTQijN3z6Cnd44Pf2g==

"@sanity/eslint-config-i18n@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@sanity/eslint-config-i18n/-/eslint-config-i18n-1.0.0.tgz#19b89c05f3bc78a8025936d71d79c4ebda51ce56"
integrity sha512-BIeD9IVT7O5I6vDyDaICoidN02qeImdXDRAW062iHY9gV4JrGScWBFio2HQLso7C+Z6SrQB8jOft6SzeYqDhdQ==
"@sanity/eslint-config-i18n@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@sanity/eslint-config-i18n/-/eslint-config-i18n-1.1.0.tgz#f7a94d513f0bbe7c7478188de80272a7a2231764"
integrity sha512-mMD0CB1R3n9vN+wWpmjIge1EW2yVYlNIO/N4LJd1kNZUs5FhyT4ZeFoJT79wj3lmr9K+yoHjqjTQ5HuZkRCSXw==
dependencies:
"@rushstack/eslint-patch" "^1.3.2"
"@sanity/eslint-plugin-i18n" "^1.0.0"
"@sanity/eslint-plugin-i18n" "^1.1.0"
"@typescript-eslint/parser" "^6.2.1"
eslint-plugin-i18next "^6.0.3"

Expand All @@ -3622,10 +3622,10 @@
eslint-plugin-react "^7.32.2"
eslint-plugin-react-hooks "^4.6.0"

"@sanity/eslint-plugin-i18n@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@sanity/eslint-plugin-i18n/-/eslint-plugin-i18n-1.0.0.tgz#b7838e83ebda73a6853c2d6c52525dd62e6f3380"
integrity sha512-ibPaZttafAWLRz2SXAk8LOBr+nykU4BoMUYjdQVIx/N3D2deZdJp0s1c0lmljkrE2B3LmB0B7oTzF9CUrw3Kyg==
"@sanity/eslint-plugin-i18n@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@sanity/eslint-plugin-i18n/-/eslint-plugin-i18n-1.1.0.tgz#5fb1d97d030dd28545475cd0394b4dba71d87197"
integrity sha512-EpoqPVqaP2NSmG8vGa4zsD6BuyBTVHwmD3VigOya7roHB8GZXuJjDg6+SXzhb+cTVuZtWaAjt8NMYVYx4uWCIQ==

"@sanity/eventsource@^5.0.0":
version "5.0.1"
Expand Down

0 comments on commit e536d23

Please sign in to comment.