Skip to content

Don't trigger deep pattern warning on non-pattern files #1309

Closed
@andriokha

Description

@andriokha

I am using Pattern Lab Node v5.13.2 on Linux, with Node v14.16.0, using a Custom Edition.

Expected Behavior

This is regarding the warning that's emitted if you go beyond 3 levels deep when deeper nesting's enabled.

We don't have any patterns deeper than 3 levels, but we do store images in a subdirectory. That is, the structure is similar to

- molecules/
  - blocks/
    - media-block/
      - media-block.md
      - media-block.mustache
      - media-block.scss
      - media-block~variant1.json
      - media-block~variant2.json
        - images/
          - image1.jpg

I'd expect this to compile without warnings because there are no patterns nested deeper than 3 levels.

Actual Behavior

The following warning's emitted.

Warning:
A pattern file: xxx was found greater than 3 levels deep from yyy.
It's strongly suggested to not deviate from the following structure under _patterns/
[patternType]/[patternSubtype]/[patternName].[patternExtension]
or
[patternType]/[patternSubtype]/[patternName]/[patternName].[patternExtension]

While Pattern Lab may still function, assets may 404 and frontend links may break. Consider yourself warned. 
Read More: https://patternlab.io/docs/overview-of-patterns/

Is there actually any risk with our current setup? Does it make sense to explicitly look for patterns rather than any file before issuing the warning? If that's not workable for some reason (and assuming we're not doing anything dangerous) would it be possible to have an option to disable the warning? Currently we've increased the log level (as done in #1037) but ideally we wouldn't have to.

Steps to Reproduce
  1. Set allPatternsAreDeeplyNested to true in patternlab-config.json.
  2. Set up a pattern with the structure shown above.
  3. Build pattern lab.

(And thanks for a fantastic project!)

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