Skip to content

Commit ff6345e

Browse files
committed
fix:补充未导入得应用
feat:render和link渲染端增加ts导入校验 fix:修改或修复ts perf:switch增加块级作用域 fix:修复Use 'const' instead fix:Buffer和Uint8Array ts报错问题 fix:修复link渲染端得ts报错 fix:修复autoprefixer警告(end->flex-end)类似得警告 fix:关闭no-unused-vars fix:修复ci检测后的报错 perf::引入依赖 fix:关闭v7中新增的规则
1 parent 0c2141e commit ff6345e

1,308 files changed

Lines changed: 8951 additions & 8264 deletions

File tree

Some content is hidden

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

app/renderer/engine-link-startup/.eslintrc.cjs

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,68 @@ module.exports = {
44
env: {
55
browser: true,
66
es2022: true,
7+
node: true,
78
},
89
parser: '@typescript-eslint/parser',
910
parserOptions: {
1011
ecmaVersion: 'latest',
1112
sourceType: 'module',
1213
ecmaFeatures: { jsx: true },
1314
},
14-
plugins: ['@typescript-eslint', 'react'],
15-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:react/jsx-runtime'],
15+
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
16+
extends: [
17+
'eslint:recommended',
18+
'plugin:@typescript-eslint/eslint-recommended',
19+
'plugin:react/jsx-runtime',
20+
'plugin:react-hooks/recommended',
21+
],
1622
settings: {
1723
react: { version: '18.2' },
1824
},
1925
rules: {
20-
'no-empty': 'warn',
26+
'no-empty': ['warn', { allowEmptyCatch: true }],
2127
'no-unused-vars': 'off',
2228
'prefer-const': 'warn',
2329
'no-var': 'warn',
2430
'no-extra-boolean-cast': 'warn',
2531
'no-fallthrough': 'warn',
2632
'no-async-promise-executor': 'warn',
2733
'no-extra-semi': 'warn',
28-
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
34+
'@typescript-eslint/no-unused-vars': 'off',
2935
'@typescript-eslint/no-explicit-any': 'off',
3036
'@typescript-eslint/no-require-imports': 'off',
3137
'@typescript-eslint/ban-ts-comment': 'warn',
3238
'react/prop-types': 'off',
3339
'react/display-name': 'off',
34-
'react/no-unknown-property': ['error', { ignore: ['css'] }],
40+
'react/no-unknown-property': ['error', { ignore: ['css', 'p-id'] }],
41+
'react-hooks/rules-of-hooks': 'error', // 强制执行 React Hooks 的规则。
42+
'react-hooks/exhaustive-deps': 'warn', // 依赖数组是否完整
43+
44+
// 关闭 v7 新增的 React Compiler lint 规则
45+
'react-hooks/set-state-in-effect': 'off', // 检查在 useEffect 中直接调用 setState 是否会导致不必要的重新渲染或无限循环
46+
'react-hooks/immutability': 'off', // 检查 Hook 是否以不可变方式更新状态
47+
'react-hooks/refs': 'off', // 检查 useRef 的使用规范。
48+
'react-hooks/use-memo': 'off', // useMemo 的使用是否合理
49+
'react-hooks/purity': 'off',
50+
'react-hooks/set-state-in-render': 'off',
51+
'react-hooks/static-components': 'off',
52+
'react-hooks/void-use-memo': 'off',
53+
'react-hooks/effect-deps': 'off',
54+
'react-hooks/memo-dependencies': 'off',
55+
'react-hooks/config': 'off',
56+
'react-hooks/suppression': 'off',
57+
'react-hooks/preserve-manual-memoization': 'off', // 保留现有手动 memoization
58+
'react-hooks/error-boundaries': 'off', // 要求组件实现错误边界
59+
60+
'no-useless-escape': 'warn',
61+
'no-control-regex': 'warn',
62+
'@typescript-eslint/consistent-type-imports': [
63+
'error',
64+
{
65+
prefer: 'type-imports',
66+
fixStyle: 'separate-type-imports',
67+
},
68+
],
3569
},
3670
ignorePatterns: ['dist', 'node_modules', 'scripts'],
3771
}

app/renderer/engine-link-startup/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"@xterm/xterm": "5.5.0",
6565
"eslint": "^8.57.0",
6666
"eslint-plugin-react": "^7.37.2",
67+
"eslint-plugin-react-hooks": "7.1.1",
6768
"happy-dom": "^12.10.3",
6869
"jsdom": "^23.0.1",
6970
"postcss-normalize": "^13.0.1",

app/renderer/engine-link-startup/src/assets/colors.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Icon from '@ant-design/icons'
2-
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3-
import React from 'react'
2+
import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3+
import type React from 'react'
44
import { v4 as uuidv4 } from 'uuid'
55

66
interface IconProps extends CustomIconComponentProps {

app/renderer/engine-link-startup/src/assets/newIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Icon from '@ant-design/icons'
2-
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3-
import React from 'react'
2+
import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3+
import type React from 'react'
44

55
export interface IconProps extends CustomIconComponentProps {
66
onClick: (e: React.MouseEvent) => void

app/renderer/engine-link-startup/src/assets/outline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Icon from '@ant-design/icons'
2-
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3-
import React from 'react'
2+
import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3+
import type React from 'react'
44

55
interface IconProps extends CustomIconComponentProps {
66
onClick: (e: React.MouseEvent) => void

app/renderer/engine-link-startup/src/assets/solid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Icon from '@ant-design/icons'
2-
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3-
import React from 'react'
2+
import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon'
3+
import type React from 'react'
44

55
interface IconProps extends CustomIconComponentProps {
66
onClick: (e: React.MouseEvent) => void

app/renderer/engine-link-startup/src/components/Editor/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React, { useEffect, useLayoutEffect, useState } from 'react'
2-
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
1+
import type React from 'react'
2+
import { useEffect, useLayoutEffect, useState } from 'react'
3+
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
34
import MonacoEditor from 'react-monaco-editor'
45
import ReactResizeDetector from 'react-resize-detector'
5-
import { Theme, useTheme } from '@/hooks/useTheme'
6+
import { type Theme, useTheme } from '@/hooks/useTheme'
67
import { applyYakitMonacoTheme } from '@/utils/theme'
78

89
export interface EditorProp {

app/renderer/engine-link-startup/src/components/yakitUI/YakitAutoComplete/YakitAutoComplete.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { AutoComplete } from 'antd'
22
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
3-
import { YakitAutoCompleteCacheDataHistoryProps, YakitAutoCompleteProps } from './YakitAutoCompleteType'
3+
import type { YakitAutoCompleteCacheDataHistoryProps, YakitAutoCompleteProps } from './YakitAutoCompleteType'
44
import styles from './YakitAutoComplete.module.scss'
55
import classNames from 'classnames'
66
import { useInViewport, useMemoizedFn } from 'ahooks'
7-
import { onGetRemoteValuesBase, onSetRemoteValuesBase, YakitOptionTypeProps } from '../../utils'
7+
import { onGetRemoteValuesBase, onSetRemoteValuesBase, type YakitOptionTypeProps } from '../../utils'
88
import { OutlineXIcon } from '@/assets/outline'
99
export const defYakitAutoCompleteRef = {
1010
onGetRemoteValues: () => ({ options: [], defaultValue: '' }),
@@ -81,7 +81,7 @@ export const YakitAutoComplete: React.FC<YakitAutoCompleteProps> = React.forward
8181
// 主要是删缓存需要
8282
onSetRemoteValues(initValue)
8383
} else {
84-
// @ts-ignore
84+
// @ts-expect-error cacheData.options 类型可能与 setCacheHistoryData 参数不兼容
8585
setCacheHistoryData({ defaultValue: value, options: newOption })
8686
}
8787
//非form表单时,设置value

app/renderer/engine-link-startup/src/components/yakitUI/YakitAutoComplete/YakitAutoCompleteType.d.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { AutoCompleteProps } from 'antd'
2-
import { SizeType } from 'antd/lib/config-provider/SizeContext'
3-
import { CacheDataHistoryProps } from '../../utils'
4-
import { BaseSelectRef } from 'rc-select'
5-
import { CSSProperties, ReactNode } from 'react'
1+
import type { AutoCompleteProps } from 'antd'
2+
import type { CacheDataHistoryProps } from '../../utils'
3+
import type { BaseSelectRef } from 'rc-select'
4+
import type { CSSProperties, ReactNode } from 'react'
65

76
/**
87
* @description YakitAutoCompleteProps 的属性

app/renderer/engine-link-startup/src/components/yakitUI/YakitButton/YakitButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useMemo } from 'react'
2-
import { Button, ButtonProps } from 'antd'
2+
import { Button, type ButtonProps } from 'antd'
33

44
import styles from './yakitButton.module.scss'
55
import classNames from 'classnames'

0 commit comments

Comments
 (0)