Skip to content

chore(ava): rewrite all import path to relative path - #843

Merged
leondt1 merged 1 commit into
v4from
rewrite-path
Nov 5, 2025
Merged

chore(ava): rewrite all import path to relative path#843
leondt1 merged 1 commit into
v4from
rewrite-path

Conversation

@leondt1

@leondt1 leondt1 commented Nov 5, 2025

Copy link
Copy Markdown

PR includes

将所有路径重写为相对路径

@leondt1
leondt1 requested review from Yzing and hustcc November 5, 2025 07:40
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @leondt1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring effort to standardize module imports across the project. By converting all absolute import paths to relative ones, the change aims to simplify the module resolution mechanism and eliminate the dependency on TypeScript path aliases. This should lead to a more consistent and potentially more robust build process by reducing configuration complexity.

Highlights

  • Import Path Refactoring: All absolute import paths, such as those starting with @ava/ or @antv/ava, have been rewritten to use relative paths throughout the codebase.
  • TypeScript Configuration Cleanup: The paths alias configurations in both the root tsconfig.json and playground/tsconfig.json files have been removed, as they are no longer needed after switching to relative imports.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 主要将项目中的路径别名(如 @ava/...)重构为了相对路径,这是一个比较大的工程性改动。整体来看,路径的替换是准确的。

我注意到在重构过程中,不同地方的导入风格存在一些不一致。有些地方改为了从模块的入口文件(barrel file, 如 index.ts)导入,而另一些地方则改为了从更具体的源文件导入。为了提升代码的可维护性和可读性,建议在整个项目中统一导入风格。我在具体的代码文件中提出了一些建议,希望能帮助统一风格,例如优先从具体的源文件导入,以减少对桶文件的依赖,避免潜在的循环依赖问题。

此外,在 site/examples/advice/advise-with-rules/demo/index.jsx 文件中,React 的导入被移除了,这是一个很好的优化,符合现代 React 的实践。

总体来说,这次重构做得不错,统一风格后代码会更清晰。

@@ -1,15 +1,14 @@
import { logError, isOpenAi, isTbox, requestLLM, safeJsonParse } from '@ava/utils';
import { logError, isOpenAi, isTbox, requestLLM, safeJsonParse } from '../../../utils';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了保持导入风格的一致性,建议将此处的聚合导入拆分为从更具体的文件导入。例如,logErrorsafeJsonParse 来自 common.ts,而 isOpenAiisTboxrequestLLM 来自 llm.ts

import { logError, safeJsonParse } from '../../../utils/common';
import { isOpenAi, isTbox, requestLLM } from '../../../utils/llm';


import { assert, isArray, isObject, isBasicType } from '@ava/utils';
import { getAllRelationFeatures } from '@ava/extract/features';
import { assert, isArray, isObject, isBasicType } from '../../utils';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在本次重构中,许多地方的导入路径都改为了相对路径。注意到这里从 ../../utils 导入了多个辅助函数,而这些函数实际上来自 ../../utils/common../../utils/isType。在项目的其他地方(例如 src/utils/statistics/ 目录下的文件),导入方式是直接从更具体的文件(如 ../common)导入。为了保持项目范围内导入风格的一致性,建议将此处的导入也拆分为从具体文件导入。这有助于提高代码的可维护性,并减少因使用桶文件(barrel files)可能引起的循环依赖风险。

Suggested change
import { assert, isArray, isObject, isBasicType } from '../../utils';
import { assert } from '../../utils/common';
import { isArray, isObject, isBasicType } from '../../utils/isType';


import { ChangePointItem } from './types';

import { standardDeviation, cdf } from './index';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在同一目录下的 mannkendall-test.ts 文件中,cdf 是从 ./cdf 导入的。为了保持一致性,建议这里也从具体的文件中导入 standardDeviationcdf,而不是从模块的入口文件 ./index 导入。standardDeviation 似乎可以从 ./base 导入。

Suggested change
import { standardDeviation, cdf } from './index';
import { standardDeviation } from './base';
import { cdf } from './cdf';

import { isEqual } from 'lodash';

import { isArray, isNumber, nOnes, range } from '@ava/utils';
import { isArray, isNumber, nOnes, range } from '../../../src/utils';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了与项目中其他部分的导入风格保持一致(例如 src/utils/statistics/ 目录),建议将此处的聚合导入拆分为从更具体的文件导入。这可以提高代码的可维护性,并避免使用桶文件(barrel files)可能带来的问题。

import { isArray, isNumber } from '../../../src/utils/isType';
import { nOnes, range } from '../../../src/utils/common';

@leondt1
leondt1 merged commit f1ada6f into v4 Nov 5, 2025
1 check failed
@leondt1
leondt1 deleted the rewrite-path branch November 5, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants