javierbrea / eslint-plugin-boundaries

Eslint plugin checking architecture boundaries between elements
MIT License
473 stars 9 forks source link

Plugin counts some element as unknow #314

Closed budarin closed 7 months ago

budarin commented 7 months ago

describe elements

    'boundaries/elements': [
        {
            type: 'services',
            pattern: 'src/services/*',
        },
        {
            type: 'ui',
            pattern: 'src/ui/*',
        },
        {
            type: 'shared',
            pattern: 'src/shared/*',
        },
        {
            type: 'utils',
            pattern: 'src/utils/*',
        },
    ],

but plugin counts files from the elements as unknown

[boundaries]: 'src/shared/index.ts' is of unknown type
{
  "source": "shared/index.ts",
  "path": "src/shared/index.ts",
  "isIgnored": false,
  "isLocal": true,
  "isBuiltIn": false,
  "isExternal": false,
  "baseModule": null,
  "type": null,
  "elementPath": null,
  "capture": null,
  "capturedValues": null,
  "internalPath": null,
  "parents": []
}
[boundaries]: 'src/services/index.ts' is of unknown type
{
  "source": "services/index.ts",
  "path": "src/services/index.ts",
  "isIgnored": false,
  "isLocal": true,
  "isBuiltIn": false,
  "isExternal": false,
  "baseModule": null,
  "type": null,
  "elementPath": null,
  "capture": null,
  "capturedValues": null,
  "internalPath": null,
  "parents": []
}
[boundaries]: 'src/utils/index.ts' is of unknown type
{
  "source": "utils/index.ts",
  "path": "src/utils/index.ts",
  "isIgnored": false,
  "isLocal": true,
  "isBuiltIn": false,
  "isExternal": false,
  "baseModule": null,
  "type": null,
  "elementPath": null,
  "capture": null,
  "capturedValues": null,
  "internalPath": null,
  "parents": []
}
[boundaries]: 'src/ui/index.ts' is of unknown type
{
  "path": "src/ui/index.ts",
  "isIgnored": false,
  "type": null,
  "elementPath": null,
  "capture": null,
  "capturedValues": null,
  "internalPath": null,
  "parents": []
}

To Reproduce Here is the project

Operating system, Node.js an npm versions, and eslint version (please complete the following information):

javierbrea commented 7 months ago

Hi @budarin , it seems that you are using a "folder" pattern, and trying to match files. From the documentation:

mode: file|folder|full Optional. When it is set to folder (default value), the element type will be assigned to the first file's parent folder matching the pattern. In the practice, it is like adding */ to the given pattern, but the plugin makes it by itself because it needs to know exactly which parent folder has to be considered the element.

You should try setting the pattern mode to "file".

budarin commented 7 months ago

It's unclear what each of mode do

javierbrea commented 7 months ago

You're welcome to improve the documentation by opening a PR @budarin

budarin commented 7 months ago

@javierbrea I would love to! but I still can't figure out at all even how to configure the plugin so that it at least works, let alone someone else to explain how it needs to be configured.

By the way, you could fix the config in the demo project and take it to yourself as a demonstration so that other developers could see and understand how to configure plugins

right now, the situation with documentation and support is just awful - I've been re-reading the documentation for 4 days and I can't understand anything- the terms in the documentation do not correspond in any way to the debugging information, and it is not possible to really understand either the logic of the work or the ways to configure the plugin normally and there are no attempts to help in support, but only references to the documentation from to which nothing is clear :(

javierbrea commented 7 months ago

Hi again @budarin , thanks for your opinion. Please note that there are many examples of support provided to other plugin users in other closed issues. In fact, in your first issue, I provided you an explanation and examples apart from links to the documentation. I closed that ticket because of next points:

In this case, I close it for the same reason. You asked about a problem, and I gave you a clue so you can continue reading about the problem in the right place in the documentation.

Thank you for offering me to solve your problem directly in your project, but maybe the best way to get help from someone is not saying "this is a bug!, the documentation is awful... by the way, fix my example project". I can say you that I have configured the plugin successfully for many different projects with many different folder structures and levels, and I have also helped others to configure their projects (again, you can read closed tickets, it even may help you to learn how to configure it). In fact, in the plugin code there is a test folder with real examples about very different ways to configure it that are executed every PR, maybe reading them may be also useful to you, and then you could help to improve it, in case you want. So, I don't think that I really need your project to be fixed as a example for others. Again, maybe you can fix it by yourself, and then you can provide it to others as a example, or even improve the docs.

Anyway, I take note of your opinion, and of course, I will try to improve the documentation. Any constructive criticism or useful and specific issues will be always welcome, as well as opening PRs, of course.

budarin commented 7 months ago

@javierbrea Thanks for the clarification

I did not ask to configure the plugin specifically in my project, I asked to clarify the idea of describing the configuration for such cases as in my project. Don't get me wrong, I've been honestly trying for the 4th day to figure out how to configure the plugin on the project, but it doesn't work either by sticking or by reading the documentation because the idea of the plugin's work is not clear from the documentation. The docs describes the simplest cases that have little correlation with reality

If a person with many years of experience in the industry can't figure out a plugin for 4 days, I, as the owner of the package, would try to figure out the problems and then describe his questions and solutions in the docs

Anyway thanks for trying