Skip to content

Add ESLint rule for import grouping and ordering #19

@coderabbitai

Description

@coderabbitai

Issue Description

An import grouping inconsistency was identified in the CLP codebase that should be addressed by adding proper ESLint rules to enforce consistent import organization.

Current Problem

In files like components/log-viewer-webui/client/src/AntdApp.tsx, external dependencies are mixed with local imports without proper grouping:

import {RouterProvider} from "react-router";

import {ConfigProvider} from "antd";

import router from "./router";
import THEME_CONFIG from "./theme";

Expected Behavior

Imports should be grouped and ordered consistently:

  1. External dependencies (from node_modules)
  2. Local imports (relative paths)
  3. Within each group, maintain alphabetical or logical ordering

Example of properly organized imports:

import {ConfigProvider} from "antd";
import {RouterProvider} from "react-router";

import router from "./router";
import THEME_CONFIG from "./theme";

Suggested Solution

Add ESLint rules to enforce import organization, such as:

  • import/order rule with appropriate configuration
  • import/newline-after-import for spacing between groups

Context

This issue was identified in PR: y-scope/clp#937
Related comment: y-scope/clp#937 (comment)

Benefits

  • Improved code readability and maintainability
  • Consistent import organization across the entire codebase
  • Automatic enforcement through ESLint to prevent future inconsistencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions