From 5cfc0b800f7c108b320079f99be4e041991a72ad Mon Sep 17 00:00:00 2001 From: curryZhaoAelf Date: Thu, 14 Mar 2024 18:02:01 +0800 Subject: [PATCH] ci: fix lint config --- .eslintrc | 16 +++--- docs/home/components/Banner/index.tsx | 1 - .../components/Features/index.module.less | 57 ------------------- docs/home/components/Features/index.tsx | 44 -------------- docs/home/components/ShowCase/Address.tsx | 4 +- docs/home/components/ShowCase/NFTCard.tsx | 4 +- docs/home/components/ShowCase/index.tsx | 15 +---- docs/home/index.tsx | 6 +- package.json | 4 +- packages/common/tsconfig.json | 2 +- packages/component/global.d.ts | 10 ---- packages/component/tsconfig.json | 3 +- .../internal-icons/src/__tests__/iconTest.tsx | 1 + packages/internal-icons/{ => src}/global.d.ts | 0 packages/internal-icons/tsconfig.json | 2 +- pnpm-lock.yaml | 9 +++ tsconfig.json | 7 ++- 17 files changed, 38 insertions(+), 147 deletions(-) delete mode 100644 docs/home/components/Features/index.module.less delete mode 100644 docs/home/components/Features/index.tsx delete mode 100644 packages/component/global.d.ts rename packages/internal-icons/{ => src}/global.d.ts (100%) diff --git a/.eslintrc b/.eslintrc index 03f44b0..9e7b335 100755 --- a/.eslintrc +++ b/.eslintrc @@ -3,27 +3,27 @@ "browser": true, "es2020": true, "jest": true, - "node": true + "node": true, }, "settings": { "react": { - "version": "detect" - } + "version": "detect", + }, }, "extends": [ "eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended" + "plugin:prettier/recommended", ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaFeatures": { - "jsx": true + "jsx": true, }, "ecmaVersion": 11, - "sourceType": "module" + "sourceType": "module", }, "plugins": ["react", "react-hooks", "@typescript-eslint"], "rules": { @@ -34,6 +34,6 @@ "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-explicit-any": "off" - } + "@typescript-eslint/no-explicit-any": "off", + }, } diff --git a/docs/home/components/Banner/index.tsx b/docs/home/components/Banner/index.tsx index 359c403..bef6c95 100644 --- a/docs/home/components/Banner/index.tsx +++ b/docs/home/components/Banner/index.tsx @@ -1,5 +1,4 @@ import React from 'react'; -// @ts-ignore import { Link, useIntl } from 'dumi'; import styles from './index.module.less'; diff --git a/docs/home/components/Features/index.module.less b/docs/home/components/Features/index.module.less deleted file mode 100644 index 4edb3b2..0000000 --- a/docs/home/components/Features/index.module.less +++ /dev/null @@ -1,57 +0,0 @@ -.container { - width: 1200px; - margin: 0 auto; - display: flex; - justify-content: space-between; - .item { - width: 350px; - word-break: break-word; - font-family: - Hevlvetica Neue, - Helvetica, - Arial, - sans-serif; - .icon { - width: 72px; - height: 72px; - } - .title { - color: rgba(0, 0, 0, 0.85); - font-size: 20px; - font-weight: 400; - line-height: 28px; - margin-block: 8px; - } - .desc { - color: rgba(0, 0, 0, 0.45); - font-size: 14px; - font-style: normal; - font-weight: 400; - line-height: 22px; - } - } -} - -[data-prefers-color='dark'] { - .item { - .title { - color: rgba(255, 255, 255, 0.85); - } - .desc { - color: rgba(255, 255, 255, 0.45); - } - } -} - -// 移动端预览时采用垂直布局展示每个 item -@media screen and (max-width: 767px) { - .container { - flex-direction: column; - align-items: center; - width: 100%; - .item { - margin-bottom: 40px; - text-align: center; - } - } -} diff --git a/docs/home/components/Features/index.tsx b/docs/home/components/Features/index.tsx deleted file mode 100644 index 7b27634..0000000 --- a/docs/home/components/Features/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { useIntl } from 'dumi'; - -import styles from './index.module.less'; - -type FeatureType = { - icon: string; - title: string; - description: string; -}; - -export default () => { - const intl = useIntl(); - - const features: FeatureType[] = [ - { - icon: 'https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*HR6IRIi3eDIAAAAAAAAAAAAADlrGAQ/original', - title: intl.formatMessage({ id: 'app.docs.site.features.0.title' }), - description: intl.formatMessage({ id: 'app.docs.site.features.0.description' }), - }, - { - icon: 'https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*VbthS5vDlCQAAAAAAAAAAAAADlrGAQ/original', - title: intl.formatMessage({ id: 'app.docs.site.features.1.title' }), - description: intl.formatMessage({ id: 'app.docs.site.features.1.description' }), - }, - { - icon: 'https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*agjbQpbtY2kAAAAAAAAAAAAADlrGAQ/original', - title: intl.formatMessage({ id: 'app.docs.site.features.2.title' }), - description: intl.formatMessage({ id: 'app.docs.site.features.2.description' }), - }, - ]; - - return ( -
- {/* {features.map((feature, index) => ( -
- {feature.title} -
{feature.title}
-
{feature.description}
-
- ))} */} -
- ); -}; diff --git a/docs/home/components/ShowCase/Address.tsx b/docs/home/components/ShowCase/Address.tsx index 06abb28..bc1479b 100644 --- a/docs/home/components/ShowCase/Address.tsx +++ b/docs/home/components/ShowCase/Address.tsx @@ -4,7 +4,7 @@ import { Space } from 'antd'; import styles from './index.module.less'; -export default () => { +export default function Address() { return (
Address @@ -22,4 +22,4 @@ export default () => {
); -}; +} diff --git a/docs/home/components/ShowCase/NFTCard.tsx b/docs/home/components/ShowCase/NFTCard.tsx index 276fcb6..483dcea 100644 --- a/docs/home/components/ShowCase/NFTCard.tsx +++ b/docs/home/components/ShowCase/NFTCard.tsx @@ -3,7 +3,7 @@ import React from 'react'; import styles from './index.module.less'; -export default () => { +export default function NFTCard() { return (
NFT Card @@ -17,4 +17,4 @@ export default () => {
); -}; +} diff --git a/docs/home/components/ShowCase/index.tsx b/docs/home/components/ShowCase/index.tsx index 023c259..19be518 100644 --- a/docs/home/components/ShowCase/index.tsx +++ b/docs/home/components/ShowCase/index.tsx @@ -7,26 +7,15 @@ import Address from './Address'; import styles from './index.module.less'; import NFTCard from './NFTCard'; -export default () => { +export default function ShowCase() { const intl = useIntl(); return (
- {/*

{intl.formatMessage({ id: 'app.docs.site.case.title' })}

-
- {intl.formatMessage({ id: 'app.docs.site.case.description' })} -
-
- -
- - -
*/} -
Made with ❤ by
AELF DESIGN
); -}; +} diff --git a/docs/home/index.tsx b/docs/home/index.tsx index 4864a72..b3ce2cb 100644 --- a/docs/home/index.tsx +++ b/docs/home/index.tsx @@ -2,12 +2,11 @@ import React, { useEffect } from 'react'; import { usePrefersColor } from 'dumi'; import HomeBanner from './components/Banner'; -import Features from './components/Features'; import ShowCase from './components/ShowCase'; // import Theme from './components/Theme'; import styles from './index.module.less'; -export default () => { +export default function Home() { const [, prefersColor] = usePrefersColor(); useEffect(() => { @@ -25,7 +24,6 @@ export default () => {
- {/* */} {/*
*/} @@ -33,4 +31,4 @@ export default () => {
); -}; +} diff --git a/package.json b/package.json index 4dfb792..b2c2411 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "devDependencies": { "@aelf-design/common": "workspace:*", "@aelf-design/internal-icons": "workspace:*", - "aelf-design": "workspace:*", "@ant-design/icons": "^5.2.6", "@babel/parser": "^7.24.0", "@biomejs/biome": "^1.4.1", @@ -62,7 +61,7 @@ "@svgr/plugin-svgo": "^8.1.0", "@tanstack/react-query": "^5.17.0", "@testing-library/react": "^14.1.2", - "@types/lodash": "^4.14.202", + "@types/lodash-es": "^4.17.12", "@types/node": "^20.10.5", "@types/react": "^18.2.45", "@types/react-copy-to-clipboard": "^5.0.7", @@ -70,6 +69,7 @@ "@typescript-eslint/parser": "^7.1.1", "@umijs/fabric": "^4.0.1", "@vitest/coverage-v8": "^1.1.0", + "aelf-design": "workspace:*", "antd": "^5.13.2", "antd-style": "^3.6.1", "babel-plugin-inline-react-svg-v2": "^2.0.2", diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index 564a599..092d383 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../tsconfig.base.json", - "include": ["src"] + "include": ["src/**/*.ts", "src/**/*.tsx", ".fatherrc.ts"] } diff --git a/packages/component/global.d.ts b/packages/component/global.d.ts deleted file mode 100644 index 2f270c0..0000000 --- a/packages/component/global.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -declare const YOUR_ZAN_API_KEY: string; -declare const YOUR_WALLET_CONNET_PROJECT_ID: string; -declare module '*.svg' { - import type * as React from 'react'; - - export const ReactComponent: React.FC>; - - export default ReactComponent; -} -declare const YOUR_INFURA_API_KEY: string; diff --git a/packages/component/tsconfig.json b/packages/component/tsconfig.json index f19d80b..1ab00aa 100644 --- a/packages/component/tsconfig.json +++ b/packages/component/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.base.json", - "include": ["src", "global.d.ts"], + "include": ["src/**/*.ts", "src/**/*.tsx", ".fatherrc.ts"], + "exclude": ["src/**/*/demos/**/*"], "compilerOptions": { "outDir": "dist" } diff --git a/packages/internal-icons/src/__tests__/iconTest.tsx b/packages/internal-icons/src/__tests__/iconTest.tsx index 5858db9..acafe6b 100644 --- a/packages/internal-icons/src/__tests__/iconTest.tsx +++ b/packages/internal-icons/src/__tests__/iconTest.tsx @@ -3,6 +3,7 @@ import React, { type ComponentType } from 'react'; import { globSync } from 'glob'; export async function getComponents(dir: string): Promise { + // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const files = globSync(path.resolve(__dirname, '..', dir, '*.tsx')); const res: ComponentType[] = []; diff --git a/packages/internal-icons/global.d.ts b/packages/internal-icons/src/global.d.ts similarity index 100% rename from packages/internal-icons/global.d.ts rename to packages/internal-icons/src/global.d.ts diff --git a/packages/internal-icons/tsconfig.json b/packages/internal-icons/tsconfig.json index 928e5b0..24cde58 100644 --- a/packages/internal-icons/tsconfig.json +++ b/packages/internal-icons/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../tsconfig.base.json", - "include": ["src", "global.d.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/global.d.ts", ".fatherrc.ts"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 294a992..b6e4416 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,6 +59,9 @@ importers: '@types/lodash': specifier: ^4.14.202 version: 4.14.202 + '@types/lodash-es': + specifier: ^4.17.12 + version: 4.17.12 '@types/node': specifier: ^20.10.5 version: 20.11.24 @@ -5574,6 +5577,12 @@ packages: '@types/node': 20.11.24 dev: true + /@types/lodash-es@4.17.12: + resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} + dependencies: + '@types/lodash': 4.14.202 + dev: true + /@types/lodash@4.14.202: resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} dev: true diff --git a/tsconfig.json b/tsconfig.json index aa153d7..bcd42cf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,9 @@ { "extends": "./tsconfig.base.json", - "include": ["/packages/**/*", ".dumirc.ts"] + "include": [ + "./packages/common/src/", + "./packages/component/src/", + "./packages/internal-icons/src/" + ], + "exclude": ["./packages/component/src/**/*/demos"] }