Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: eslint add rule prefer top level type import #3354

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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