dukeluo / eslint-plugin-check-file

ESLint rules for consistent filename and folder. Allows you to enforce a consistent naming pattern for the filename and folder.

Home Page:https://www.npmjs.com/package/eslint-plugin-check-file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

check-file/filename-naming-convention application is not working as expected with custom matching

mkhstar opened this issue · comments

Describe the bug
check-file/filename-naming-convention application is not working as expected with custom matching

Expected behavior
I expected it to work with custom glob matching

Plugin configuration

  "check-file/filename-naming-convention": [
      "error",
      {
        "**/tests/e2e/*": "*.{spec,test}.e2e.ts",
      },
    ]

Desktop (please complete the following information):

  • OS: macos

Additional context
It prints the error The filename "my-controller.spec.e2e.ts" does not match the "*.{spec,test}.e2e.ts" pattern
Even thought console.log(micromatch.isMatch('my-controller.spec.e2e.ts', '*.{spec,test}.e2e.ts')) // returns true
Is there anything i am doing wrong or is there a bug with this?

commented

@mkhstar How about this?

  "check-file/filename-naming-convention": [
      "error",
      {
        "**/tests/e2e/*.ts": "*.{spec,test}.e2e",
      },
    ]

Thanks that seems to work. So we shouldn't add the extension right?

commented

Thanks that seems to work. So we shouldn't add the extension right?

Yes, the rule only validates the name part.