Skip to content

absolute-relative rule does not recognize @x cross-import paths #30

@conarti

Description

@conarti

Problem

The absolute-relative rule incorrectly flags @x cross-import paths as "should be relative", even though they must always be absolute.

Example:

// File: entities/policies/ui/PoliciesNodesTable.vue
import { useGroups } from "@/entities/groups/@x/policies";
//                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// ERROR: There must be relative paths within a slice

The rule extracts the slice from the import path entities/groups/@x/policies using extractSlice, which returns policies (the last path segment). Since the current file is also in the policies slice, the rule determines isSameSlice = true and isSameLayer = true, then shouldBeRelative() returns true.

However, this import goes to a different entity (groups), and the @x notation is specifically designed for cross-slice imports, which must always be absolute.

Expected behavior

The absolute-relative rule should detect @x paths via extractCrossImportInfo (which already exists and works correctly in layers-slices validation) and skip the absolute/relative check for valid cross-imports.

Current workaround

"@conarti/feature-sliced/absolute-relative": ["error", { ignoreImports: ["**/@x/**"] }],

Environment

  • @conarti/eslint-plugin-feature-sliced: 2.0.0-rc.6
  • ESLint 9 flat config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions