Skip to content

Add import sorting with configurable grouping to ESLint config#1

Merged
foreleven merged 5 commits into
mainfrom
copilot/optimize-eslint-configuration
Nov 7, 2025
Merged

Add import sorting with configurable grouping to ESLint config#1
foreleven merged 5 commits into
mainfrom
copilot/optimize-eslint-configuration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 7, 2025

Configure ESLint to enforce import order with automatic fixes: third-party libraries → @/ prefixed internal modules → relative imports.

Changes

  • config/eslint-config: Added eslint-plugin-import-x with custom import grouping

    • Configured 4-tier import hierarchy: builtin → external → internal (@/**) → relative (./, ../)
    • Enforces blank lines between groups and alphabetical sorting within groups
    • TypeScript resolver enabled for proper module resolution
  • packages/widget: Created eslint.config.js (previously missing)

  • packages/widget-renderer: Created eslint.config.js with React settings

  • packages/*: Auto-fixed import order violations across all TypeScript/JSX files

  • apps/widget-builder: Auto-fixed import order violations across 35+ TypeScript/JSX files including all components, pages, UI components, and widget components

Example

Before:

import { JSXElementSchema } from "./JSXSchema";
import { JSONSchema4 } from "json-schema";

After:

import { JSONSchema4 } from "json-schema";

import { JSXElementSchema } from "./JSXSchema";

Notes

This branch has been rebased onto the latest main branch to incorporate recent changes (feat: components page).

Original prompt

创建一个新分支,优化项目的 eslint ,添加 import sort,按照三方库,本地目录 @/ 开头,和本地 ./** 分组。 仅修改 config/eslint-config 的配置。和修复 packages/* 下面的代码。


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@foreleven foreleven marked this pull request as ready for review November 7, 2025 10:41
@foreleven foreleven requested a review from Copilot November 7, 2025 10:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI changed the title [WIP] Update ESLint configuration to optimize import sorting Add import sorting with configurable grouping to ESLint config Nov 7, 2025
Copilot AI requested a review from foreleven November 7, 2025 10:54
@foreleven
Copy link
Copy Markdown
Contributor

@copilot Rebase main 分支,并继续修复 apps/* 下面的代码

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot Rebase main 分支,并继续修复 apps/* 下面的代码

已完成以下工作:

  1. Rebase main 分支: 已成功将 copilot/optimize-eslint-configuration 分支 rebase 到最新的 main 分支 (commit 07bcd9f "feat: components page")

  2. 修复 apps/ 下的代码*: 已使用 eslint --fix 自动修复 35 个文件的 import 顺序问题,包括:

    • apps/widget-builder/src/App.tsx
    • apps/widget-builder/src/components/ (所有组件文件)
    • apps/widget-builder/src/pages/ (所有页面文件)
    • apps/widget-builder/src/components/ui/ (所有 UI 组件)
    • apps/widget-builder/src/components/widget-components/ (所有 widget 组件)
    • apps/widget-builder/vite.config.ts

所有 import-x/order 错误已解决。Build 测试通过。Commit ba8480f 已创建,包含所有更改。

由于 rebase 后需要 force push,推送可能需要手动处理或等待 GitHub 同步。

Copilot AI and others added 3 commits November 7, 2025 21:04
…n packages

Co-authored-by: foreleven <4785594+foreleven@users.noreply.github.com>
Co-authored-by: foreleven <4785594+foreleven@users.noreply.github.com>
@foreleven foreleven force-pushed the copilot/optimize-eslint-configuration branch from 15b159f to b68cd7f Compare November 7, 2025 13:06
@foreleven foreleven merged commit 8415c6b into main Nov 7, 2025
1 check passed
@foreleven foreleven deleted the copilot/optimize-eslint-configuration branch November 7, 2025 14:44
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.

3 participants