Skip to content

Commit

Permalink
feat: eslint add rule prefer top level type import (#3354)
Browse files Browse the repository at this point in the history
  • Loading branch information
winchesHe authored Jul 6, 2024
1 parent 1cd64b2 commit 167e197
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"prev": ["const", "let", "var"],
"next": ["const", "let", "var"]
}
]
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"]
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"test": "jest --verbose --config ./jest.config.js",
"typecheck": "turbo typecheck",
"lint": "pnpm lint:pkg && pnpm lint:docs",
"lint:pkg": "eslint -c .eslintrc.json ./packages/**/**/*.{ts,tsx}",
"lint:pkg": "eslint -c .eslintrc.json ./packages/**/*.{ts,tsx}",
"lint:docs": "eslint -c .eslintrc.json ./apps/docs/**/*.{ts,tsx}",
"lint:fix": "eslint --fix -c .eslintrc.json ./packages/**/**/*.{ts,tsx}",
"lint:fix": "eslint --fix -c .eslintrc.json ./packages/**/*.{ts,tsx}",
"lint:docs-fix": "eslint --fix -c .eslintrc.json ./apps/docs/**/*.{ts,tsx}",
"check:rap": "tsx scripts/check-rap-updates.ts",
"fix:rap": "tsx scripts/fix-rap.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/components/accordion/src/use-accordion.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {SelectionBehavior, MultipleSelection} from "@react-types/shared";
import type {AriaAccordionProps} from "@react-types/accordion";
import type {AccordionGroupVariantProps} from "@nextui-org/theme";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import {useProviderContext} from "@nextui-org/system";
import {ReactRef, filterDOMProps} from "@nextui-org/react-utils";
import React, {Key, useCallback} from "react";
import {TreeState, useTreeState} from "@react-stately/tree";
Expand Down
3 changes: 2 additions & 1 deletion packages/components/button/src/use-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import type {ButtonVariantProps} from "@nextui-org/theme";
import type {AriaButtonProps} from "@nextui-org/use-aria-button";
import type {ReactNode} from "react";
import type {RippleProps} from "@nextui-org/ripple";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import {useProviderContext} from "@nextui-org/system";
import {dataAttr} from "@nextui-org/shared-utils";
import {ReactRef} from "@nextui-org/react-utils";
import {MouseEventHandler, useCallback} from "react";
Expand Down
3 changes: 2 additions & 1 deletion packages/components/checkbox/src/use-checkbox-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import type {AriaCheckboxGroupProps} from "@react-types/checkbox";
import type {Orientation} from "@react-types/shared";
import type {ReactRef} from "@nextui-org/react-utils";
import type {CheckboxGroupProps} from "@react-types/checkbox";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import {useProviderContext} from "@nextui-org/system";
import {useCallback, useMemo} from "react";
import {chain, mergeProps} from "@react-aria/utils";
import {checkboxGroup} from "@nextui-org/theme";
Expand Down
3 changes: 2 additions & 1 deletion packages/components/checkbox/src/use-checkbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {CheckboxVariantProps, CheckboxSlots, SlotsToClasses} from "@nextui-org/theme";
import type {AriaCheckboxProps} from "@react-types/checkbox";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import {useProviderContext} from "@nextui-org/system";
import {ReactNode, Ref, useCallback, useId, useState} from "react";
import {useMemo, useRef} from "react";
import {useToggleState} from "@react-stately/toggle";
Expand Down
3 changes: 2 additions & 1 deletion packages/components/dropdown/src/use-dropdown.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {PopoverProps} from "@nextui-org/popover";
import type {MenuTriggerType} from "@react-types/menu";
import type {Ref} from "react";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import {useProviderContext} from "@nextui-org/system";
import {useMenuTriggerState} from "@react-stately/menu";
import {useMenuTrigger} from "@react-aria/menu";
import {dropdown} from "@nextui-org/theme";
Expand Down
4 changes: 3 additions & 1 deletion packages/components/menu/src/use-menu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {useProviderContext, type HTMLNextUIProps, type PropGetter} from "@nextui-org/system";
import type {HTMLNextUIProps, PropGetter} from "@nextui-org/system";

import {useProviderContext} from "@nextui-org/system";
import {AriaMenuProps} from "@react-types/menu";
import {AriaMenuOptions} from "@react-aria/menu";
import {useAriaMenu} from "@nextui-org/use-aria-menu";
Expand Down
4 changes: 3 additions & 1 deletion packages/components/select/__tests__/select.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type {SelectProps} from "../src";

import * as React from "react";
import {render, renderHook, act} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import {useForm} from "react-hook-form";

import {Select, SelectItem, SelectSection, type SelectProps} from "../src";
import {Select, SelectItem, SelectSection} from "../src";
import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter} from "../../modal/src";

type Item = {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/system-rsc/test-utils/no-slots-component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {HTMLNextUIProps} from "../src/types";
import type {VariantProps} from "@nextui-org/theme";

import React, {useMemo} from "react";
import {tv, type VariantProps} from "@nextui-org/theme";
import {tv} from "@nextui-org/theme";
import {filterDOMProps, ReactRef, useDOMRef} from "@nextui-org/react-utils";
import {objectToDeps} from "@nextui-org/shared-utils";

Expand Down
3 changes: 2 additions & 1 deletion packages/core/system-rsc/test-utils/slots-component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {HTMLNextUIProps} from "../src/types";
import type {VariantProps} from "@nextui-org/theme";

import React, {useMemo} from "react";
import {SlotsToClasses, tv, type VariantProps} from "@nextui-org/theme";
import {SlotsToClasses, tv} from "@nextui-org/theme";
import {filterDOMProps, ReactRef, useDOMRef} from "@nextui-org/react-utils";
import {objectToDeps} from "@nextui-org/shared-utils";
import clsx from "clsx";
Expand Down

0 comments on commit 167e197

Please sign in to comment.