Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob exclusion on non-root level does not apply recursively to all sub-folders #21

Closed
mleimer opened this issue May 2, 2023 · 2 comments

Comments

@mleimer
Copy link

mleimer commented May 2, 2023

Describe the bug
Given a config like

		'check-file/folder-naming-convention': [
			'error',
			{
				'src/pages/**': 'KEBAB_CASE'',
				'src/!(pages)/**': 'CAMEL_CASE',
			}
               ]

Then the following folder-names are considered valid:

  • src/pages/first-page/**
  • src/components/visual/interactiveButton/**
  • src/components/visual/interactive-button/**

Expected behavior

  • src/components/visual/interactive-button/** should not be valid, because interactive-buttonis violating the CAMEL_CASE rule.

Project structure

.
└── src
    └── components
        └── visual
            └── interactive-button // should fail here!
                 └── SomeFile.tsx
            └── interactiveButton // should be the only valid format
                 └── SomeFile.tsx
    └── pages
        └── first-page
            └── page.tsx

Desktop (please complete the following information):

  • OS: Ubuntu 23.04

Additional information
This bug only exist if the exclusion is applied on a sub-folder. It doesn't exist if the root-folder (here src) is excluded.

@dukeluo
Copy link
Owner

dukeluo commented May 3, 2023

Thanks for your issue. It seems there is a bug when using with the ! matcher. I will work on fixing this bug.

And you can use the following configuration as a workaround, it works well with your test data.

{
  "plugins": [
    "check-file"
  ],
  "rules": {
    "check-file/folder-naming-convention": [
      "error",
      {
        "src/pages/**/": "KEBAB_CASE",
        "src/components/**/": "CAMEL_CASE"
      }
    ]
  }
}

dukeluo added a commit that referenced this issue May 8, 2023
@dukeluo
Copy link
Owner

dukeluo commented May 13, 2023

@mleimer The new version 2.3.0 is released, you can try it now.

@dukeluo dukeluo closed this as completed May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants