Skip to content

Public api rule not working as expected #11

@jesperume

Description

@jesperume

Thanks for a great plugin!

However the rule "@conarti/feature-sliced/public-api" is not working as expected.

In the FSD public api docs the very first example says the following should not be allowed. But when I try this path "features/auth-form/components/view/form" is does not show an eslint error.

Bad: moving or renaming this component inside the feature will lead to the need to refactor imports in all places where the component is used.

  • import { Form } from "features/auth-form/ui/form"
    Good: the interface of the feature does not display its internal structure, external "users" of the feature will not suffer from moving or renaming the component inside the feature
  • import { AuthForm } from "features/auth-form"

I've tried to clone the repo and manually add the following test. It failes with: "Should have 1 error but had 0. Can you have a look?

File: src\rules\public-api\index.test.ts

invalid: [
    {
      code: "import { addCommentFormActions, addCommentFormReducer } from 'features/auth-form/components/view/form'",
      errors: [
        makeErrorWithSuggestion(
          ...
        ),
      ],
    },

What I'm looking for is to configure the rule so that only "import from features/auth-form" is allowed and everything under features/auth-form/** is disallowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions