feat: update ESLint config with @typescript-eslint/consistent-type-imports (#4746)

* update: Add type

* fix: update import statement for NextApiRequest type

* fix: update imports to use type for LexicalEditor and EditorState

* Refactor imports to use 'import type' for type-only imports across multiple files

- Updated imports in various components and API files to use 'import type' for better clarity and to optimize TypeScript's type checking.
- Ensured consistent usage of type imports in files related to chat, dataset, workflow, and user management.
- Improved code readability and maintainability by distinguishing between value and type imports.

* refactor: remove old ESLint configuration and add new rules

- Deleted the old ESLint configuration file from the app project.
- Added a new ESLint configuration file with updated rules and settings.
- Changed imports to use type-only imports in various files for better clarity and performance.
- Updated TypeScript configuration to remove unnecessary options.
- Added an ESLint ignore file to exclude build and dependency directories from linting.

* fix: update imports to use 'import type' for type-only imports in schema files
This commit is contained in:
Theresa
2025-05-06 17:33:09 +08:00
committed by GitHub
parent 5361674a2c
commit 2d3117c5da
806 changed files with 2223 additions and 1881 deletions

View File

@@ -1,5 +1,5 @@
import { SourceMemberType } from '../user/type';
import { OperationLogEventEnum } from './constants';
import type { SourceMemberType } from '../user/type';
import type { OperationLogEventEnum } from './constants';
export type OperationLogSchema = {
_id: string;

View File

@@ -1,5 +1,5 @@
import type { HistoryItemType } from '../../core/chat/type.d';
import { OutLinkSchema } from './type.d';
import type { OutLinkSchema } from './type.d';
export type AuthOutLinkInitProps = {
outLinkUid: string;

View File

@@ -1,5 +1,5 @@
import { AppSchema } from '../../core/app/type';
import { PublishChannelEnum } from './constant';
import type { PublishChannelEnum } from './constant';
import { RequireOnlyOne } from '../../common/type/utils';
// Feishu Config interface

View File

@@ -1,5 +1,5 @@
import { NullPermission, PermissionKeyEnum, PermissionList } from '../constant';
import { PermissionListType } from '../type';
import { type PermissionListType } from '../type';
import { i18nT } from '../../../../web/i18n/utils';
export enum AppPermissionKeyEnum {}
export const AppPermissionList: PermissionListType = {

View File

@@ -1,4 +1,4 @@
import { PerConstructPros, Permission } from '../controller';
import { type PerConstructPros, Permission } from '../controller';
import { AppDefaultPermissionVal } from './constant';
export class AppPermission extends Permission {

View File

@@ -1,6 +1,7 @@
import { RequireAtLeastOne, RequireOnlyOne } from '../../common/type/utils';
import { Permission } from './controller';
import { PermissionValueType } from './type';
import type { RequireOnlyOne } from '../../common/type/utils';
import { RequireAtLeastOne } from '../../common/type/utils';
import type { Permission } from './controller';
import type { PermissionValueType } from './type';
export type CollaboratorItemType = {
teamId: string;

View File

@@ -1,4 +1,4 @@
import { PermissionListType } from './type';
import { type PermissionListType } from './type';
import { i18nT } from '../../../web/i18n/utils';
export enum AuthUserTypeEnum {
token = 'token',

View File

@@ -1,4 +1,4 @@
import { PermissionListType, PermissionValueType } from './type';
import { type PermissionListType, type PermissionValueType } from './type';
import { PermissionList, NullPermission, OwnerPermissionVal } from './constant';
export type PerConstructPros = {

View File

@@ -1,5 +1,5 @@
import { NullPermission } from '../constant';
import { PerConstructPros, Permission } from '../controller';
import { type PerConstructPros, Permission } from '../controller';
export class DatasetPermission extends Permission {
constructor(props?: PerConstructPros) {
if (!props) {

View File

@@ -1,5 +1,5 @@
import { PermissionKeyEnum, PermissionList } from '../constant';
import { PermissionListType } from '../type';
import { type PermissionListType } from '../type';
export enum GroupMemberRole {
owner = 'owner',

View File

@@ -1,7 +1,7 @@
import { TeamMemberItemType } from 'support/user/team/type';
import { TeamPermission } from '../user/controller';
import { GroupMemberRole } from './constant';
import { Permission } from '../controller';
import type { GroupMemberRole } from './constant';
import type { Permission } from '../controller';
type MemberGroupSchemaType = {
_id: string;

View File

@@ -1,6 +1,6 @@
import { UserModelSchema } from '../user/type';
import { RequireOnlyOne } from '../../common/type/utils';
import { TeamMemberSchema } from '../user/team/type';
import type { UserModelSchema } from '../user/type';
import type { RequireOnlyOne } from '../../common/type/utils';
import type { TeamMemberSchema } from '../user/team/type';
import { MemberGroupSchemaType } from './memberGroup/type';
import type { TeamMemberWithUserSchema } from '../user/team/type';
import { AuthUserTypeEnum, type PermissionKeyEnum, type PerResourceTypeEnum } from './constant';

View File

@@ -1,5 +1,5 @@
import { PermissionKeyEnum } from '../constant';
import { PermissionListType } from '../type';
import { type PermissionListType } from '../type';
import { PermissionList } from '../constant';
import { i18nT } from '../../../../web/i18n/utils';
export enum TeamPermissionKeyEnum {

View File

@@ -1,4 +1,4 @@
import { PerConstructPros, Permission } from '../controller';
import { type PerConstructPros, Permission } from '../controller';
import {
TeamApikeyCreatePermissionVal,
TeamAppCreatePermissionVal,

View File

@@ -1,6 +1,6 @@
import { PermissionValueType } from './type';
import { type PermissionValueType } from './type';
import { NullPermission, PermissionTypeEnum } from './constant';
import { Permission } from './controller';
import type { Permission } from './controller';
/* team public source, or owner source in team */
export function mongoRPermission({

View File

@@ -1,12 +1,10 @@
import {
MemberGroupSchemaType,
MemberGroupListItemType
} from 'support/permission/memberGroup/type';
import { OAuthEnum } from './constant';
import { TrackRegisterParams } from './login/api';
import type { MemberGroupSchemaType } from 'support/permission/memberGroup/type';
import { MemberGroupListItemType } from 'support/permission/memberGroup/type';
import type { OAuthEnum } from './constant';
import type { TrackRegisterParams } from './login/api';
import { TeamMemberStatusEnum } from './team/constant';
import { OrgType } from './team/org/type';
import { TeamMemberItemType } from './team/type';
import type { OrgType } from './team/org/type';
import type { TeamMemberItemType } from './team/type';
export type PostLoginProps = {
username: string;

View File

@@ -1,4 +1,4 @@
import { InformLevelEnum, SendInformTemplateCodeEnum } from './constants';
import type { InformLevelEnum, SendInformTemplateCodeEnum } from './constants';
export type SendInformProps = {
level: `${InformLevelEnum}`;

View File

@@ -1,4 +1,4 @@
import { TrackRegisterParams } from '../../marketing/type';
import type { TrackRegisterParams } from '../../marketing/type';
export type GetWXLoginQRResponse = {
code: string;

View File

@@ -1,6 +1,7 @@
import { PermissionValueType } from '../../permission/type';
import { TeamMemberRoleEnum } from './constant';
import { LafAccountType, TeamMemberSchema, ThirdPartyAccountType } from './type';
import type { TeamMemberRoleEnum } from './constant';
import type { TeamMemberSchema, ThirdPartyAccountType } from './type';
import { LafAccountType } from './type';
export type AuthTeamRoleProps = {
teamId: string;

View File

@@ -1,4 +1,4 @@
import { GroupMemberRole } from '../../../../support/permission/memberGroup/constant';
import type { GroupMemberRole } from '../../../../support/permission/memberGroup/constant';
export type postCreateGroupData = {
name: string;

View File

@@ -1,4 +1,4 @@
import { OrgSchemaType } from './type';
import { type OrgSchemaType } from './type';
export const OrgCollectionName = 'team_orgs';
export const OrgMemberCollectionName = 'team_org_members';

View File

@@ -1,8 +1,8 @@
import type { UserModelSchema } from '../type';
import type { TeamMemberRoleEnum, TeamMemberStatusEnum } from './constant';
import { LafAccountType } from './type';
import type { LafAccountType } from './type';
import { PermissionValueType, ResourcePermissionType } from '../../permission/type';
import { TeamPermission } from '../../permission/user/controller';
import type { TeamPermission } from '../../permission/user/controller';
export type ThirdPartyAccountType = {
lafAccount?: LafAccountType;

View File

@@ -1,7 +1,7 @@
import { TeamPermission } from '../permission/user/controller';
import { UserStatusEnum } from './constant';
import { TeamMemberStatusEnum } from './team/constant';
import { TeamTmbItemType } from './team/type';
import type { TeamPermission } from '../permission/user/controller';
import type { UserStatusEnum } from './constant';
import type { TeamMemberStatusEnum } from './team/constant';
import type { TeamTmbItemType } from './team/type';
export type UserModelSchema = {
_id: string;

View File

@@ -1,5 +1,6 @@
import { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import { BillTypeEnum, DrawBillQRItem } from './constants';
import type { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import type { BillTypeEnum } from './constants';
import { DrawBillQRItem } from './constants';
export type CreateOrderResponse = {
qrCode?: string;

View File

@@ -1,6 +1,7 @@
import { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from '../sub/constants';
import { BillPayWayEnum, BillStatusEnum, BillTypeEnum } from './constants';
import { TeamInvoiceHeaderType } from '../../user/team/type';
import type { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import { SubTypeEnum } from '../sub/constants';
import type { BillPayWayEnum, BillStatusEnum, BillTypeEnum } from './constants';
import type { TeamInvoiceHeaderType } from '../../user/team/type';
export type BillSchemaType = {
_id: string;

View File

@@ -1,4 +1,4 @@
import { StandardSubLevelEnum, SubModeEnum } from './constants';
import type { StandardSubLevelEnum, SubModeEnum } from './constants';
import { TeamSubSchema } from './type.d';
export type StandardSubPlanParams = {

View File

@@ -1,4 +1,4 @@
import { SubTypeEnum, StandardSubLevelEnum } from '../constants';
import type { SubTypeEnum, StandardSubLevelEnum } from '../constants';
export type TeamCouponSub = {
type: `${SubTypeEnum}`; // Sub type

View File

@@ -1,4 +1,4 @@
import { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from './constants';
import type { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from './constants';
// Content of plan
export type TeamStandardSubPlanItemType = {

View File

@@ -1,5 +1,5 @@
import { UsageSourceEnum } from './constants';
import { UsageListItemCountType, UsageListItemType } from './type';
import type { UsageSourceEnum } from './constants';
import type { UsageListItemCountType, UsageListItemType } from './type';
export type CreateTrainingUsageProps = {
name: string;

View File

@@ -1,5 +1,5 @@
import { SourceMemberType } from '../../../support/user/type';
import { CreateUsageProps } from './api';
import type { SourceMemberType } from '../../../support/user/type';
import type { CreateUsageProps } from './api';
import { UsageSourceEnum } from './constants';
export type UsageListItemCountType = {