Skip to content

Commit d21dbb4

Browse files
sort imports (#1729)
1 parent 1219944 commit d21dbb4

File tree

106 files changed

+245
-201
lines changed

Some content is hidden

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

106 files changed

+245
-201
lines changed

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import tseslint from 'typescript-eslint';
22
import callstackConfig from '@callstack/eslint-config/react-native.flat.js';
3+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
34

45
export default [
56
{
@@ -14,9 +15,24 @@ export default [
1415
},
1516
...callstackConfig,
1617
...tseslint.configs.strict,
18+
{
19+
plugins: {
20+
'simple-import-sort': simpleImportSort,
21+
},
22+
rules: {
23+
'simple-import-sort/imports': [
24+
'error',
25+
{
26+
groups: [['^\\u0000', '^react', '^@?\\w', '^', '^\\.']],
27+
},
28+
],
29+
},
30+
},
1731
{
1832
rules: {
1933
'no-console': 'error',
34+
'import/order': 'off',
35+
'@typescript-eslint/consistent-type-imports': 'error',
2036
},
2137
},
2238
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"babel-plugin-module-resolver": "^5.0.2",
8383
"del-cli": "^6.0.0",
8484
"eslint": "^9.17.0",
85+
"eslint-plugin-simple-import-sort": "^12.1.1",
8586
"flow-bin": "~0.170.0",
8687
"jest": "^29.7.0",
8788
"prettier": "^2.8.8",

src/__tests__/config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getConfig, configure, resetToDefaults } from '../config';
1+
import { configure, getConfig, resetToDefaults } from '../config';
22

33
beforeEach(() => {
44
resetToDefaults();

src/__tests__/fire-event-textInput.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
2-
import { Text, TextInput, TextInputProps } from 'react-native';
3-
import { render, fireEvent, screen } from '..';
2+
import type { TextInputProps } from 'react-native';
3+
import { Text, TextInput } from 'react-native';
4+
import { fireEvent, render, screen } from '..';
45

56
function WrappedTextInput(props: TextInputProps) {
67
return <TextInput {...props} />;

src/__tests__/host-component-names.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { Image, Modal, ScrollView, Switch, Text, TextInput } from 'react-native';
3+
import { render, screen } from '..';
34
import {
45
isHostImage,
56
isHostModal,
@@ -8,7 +9,6 @@ import {
89
isHostText,
910
isHostTextInput,
1011
} from '../helpers/host-component-names';
11-
import { render, screen } from '..';
1212

1313
test('detects host Text component', () => {
1414
render(<Text>Hello</Text>);

src/__tests__/host-text-nesting.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
2-
import { Text, Pressable, View } from 'react-native';
3-
import { render, within, screen } from '../pure';
2+
import { Pressable, Text, View } from 'react-native';
3+
import { render, screen, within } from '../pure';
44

55
/**
66
* Our queries interact differently with composite and host elements, and some specific cases require us

src/__tests__/react-native-animated.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
2-
import { Animated, ViewStyle } from 'react-native';
2+
import type { ViewStyle } from 'react-native';
3+
import { Animated } from 'react-native';
34
import { act, render, screen } from '..';
45

56
type AnimatedViewProps = {

src/__tests__/render-hook.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { ReactNode } from 'react';
1+
import type { ReactNode } from 'react';
2+
import React from 'react';
23
import TestRenderer from 'react-test-renderer';
34
import { renderHook } from '../pure';
45

src/__tests__/render-string-validation.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
2-
import { View, Text, Pressable } from 'react-native';
3-
import { render, fireEvent, screen } from '..';
2+
import { Pressable, Text, View } from 'react-native';
3+
import { fireEvent, render, screen } from '..';
44

55
// eslint-disable-next-line no-console
66
const originalConsoleError = console.error;

src/__tests__/render.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { Pressable, Text, TextInput, View } from 'react-native';
3-
import { fireEvent, render, RenderAPI, screen } from '..';
3+
import type { RenderAPI } from '..';
4+
import { fireEvent, render, screen } from '..';
45

56
const PLACEHOLDER_FRESHNESS = 'Add custom freshness';
67
const PLACEHOLDER_CHEF = 'Who inspected freshness?';

0 commit comments

Comments
 (0)