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
Problem
The
absolute-relativerule incorrectly flags@xcross-import paths as "should be relative", even though they must always be absolute.Example:
The rule extracts the slice from the import path
entities/groups/@x/policiesusingextractSlice, which returnspolicies(the last path segment). Since the current file is also in thepoliciesslice, the rule determinesisSameSlice = trueandisSameLayer = true, thenshouldBeRelative()returnstrue.However, this import goes to a different entity (
groups), and the@xnotation is specifically designed for cross-slice imports, which must always be absolute.Expected behavior
The
absolute-relativerule should detect@xpaths viaextractCrossImportInfo(which already exists and works correctly inlayers-slicesvalidation) and skip the absolute/relative check for valid cross-imports.Current workaround
Environment
@conarti/eslint-plugin-feature-sliced:2.0.0-rc.6