Skip to content

Commit cab3093

Browse files
committed
Add consistent-type-imports eslint rule
1 parent 8d0d8cf commit cab3093

File tree

8 files changed

+23
-17
lines changed

8 files changed

+23
-17
lines changed

demo/eslint.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ const eslintConfig = tseslint.config(
2525
...react.configs.recommended.rules,
2626
...react.configs["jsx-runtime"].rules,
2727
...reactHooks.configs.recommended.rules,
28+
"@typescript-eslint/consistent-type-imports": [
29+
"warn",
30+
{
31+
prefer: "type-imports",
32+
disallowTypeAnnotations: true,
33+
},
34+
],
2835
"react/prop-types": "off",
2936
"react-refresh/only-export-components": [
3037
"warn",

demo/src/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {
1010
Stack,
1111
Text,
1212
} from "@chakra-ui/react";
13+
import type { GroupBase, LoadingIndicatorProps } from "chakra-react-select";
1314
import {
1415
AsyncSelect,
1516
CreatableSelect,
16-
GroupBase,
17-
LoadingIndicatorProps,
1817
Select,
1918
chakraComponents,
2019
} from "chakra-react-select";
@@ -36,7 +35,8 @@ import {
3635
SelectValueText,
3736
} from "./components/ui/select";
3837
import animeMovies from "./data/anime-movies";
39-
import { ColorOption, colorOptions, groupedOptions } from "./data/options";
38+
import type { ColorOption } from "./data/options";
39+
import { colorOptions, groupedOptions } from "./data/options";
4040

4141
const mappedColorOptions = colorOptions.map((option) => ({
4242
...option,

demo/src/components/advanced-examples/custom-indicator-icons-example.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import {
2-
GroupBase,
3-
Select,
4-
SelectComponentsConfig,
5-
chakraComponents,
6-
} from "chakra-react-select";
1+
import type { GroupBase, SelectComponentsConfig } from "chakra-react-select";
2+
import { Select, chakraComponents } from "chakra-react-select";
73
import { LuArrowDown, LuCircleX } from "react-icons/lu";
84
import { groupedOptions } from "../../data/options";
95

demo/src/components/advanced-examples/dynamic-selected-option-color-example.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState } from "react";
22
import { Select } from "chakra-react-select";
3-
import { ColorOption, colorOptions } from "../../data/options";
3+
import type { ColorOption } from "../../data/options";
4+
import { colorOptions } from "../../data/options";
45

56
const DynamicSelectedOptionColorExample = () => {
67
const [selectedOptionColorPalette, setSelectedOptionColorPalette] =

demo/src/components/advanced-examples/menu-portal-target-example.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState } from "react";
22
import { Stack } from "@chakra-ui/react";
3-
import { Select, Props as SelectProps } from "chakra-react-select";
3+
import type { Props as SelectProps } from "chakra-react-select";
4+
import { Select } from "chakra-react-select";
45
import { colorOptions } from "../../data/options";
56
import { Button } from "../ui/button";
67
import {

demo/src/components/advanced-examples/select-popover-example.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useRef, useState } from "react";
22
import { Icon } from "@chakra-ui/react";
3-
import {
3+
import type {
44
ChakraStylesConfig,
5-
Select,
65
SelectInstance,
76
SingleValue,
87
} from "chakra-react-select";
8+
import { Select } from "chakra-react-select";
99
import { LuChevronDown, LuSearch } from "react-icons/lu";
10-
import { StateOption, stateOptions } from "../../data/options";
10+
import type { StateOption } from "../../data/options";
11+
import { stateOptions } from "../../data/options";
1112
import { Button } from "../ui/button";
1213
import {
1314
PopoverBody,

demo/src/data/countries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GroupBase, OptionBase } from "chakra-react-select";
1+
import type { GroupBase, OptionBase } from "chakra-react-select";
22

33
export interface CountryOption extends OptionBase {
44
label: string;

demo/src/data/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ColorPalette } from "@chakra-ui/react";
2-
import { OptionBase } from "chakra-react-select";
1+
import type { ColorPalette } from "@chakra-ui/react";
2+
import type { OptionBase } from "chakra-react-select";
33

44
export interface ColorOption extends OptionBase {
55
label: string;

0 commit comments

Comments
 (0)