Skip to content

The new update still requires glob patterns to be matched regardelss of if they are used #36

Closed
@AtlasTom

Description

@AtlasTom

Describe the bug
The new pattern:

module.exports = {
  plugins: ['check-file'],
  rules: {
    'check-file/filename-blocklist': [
      'error',
      { '*.models.ts': '*.model.ts' },
      {
        errorMessage:
          'The file "{{ target }}" is blocked since it since it matches the blocklisted pattern "{{ pattern }}", see contribute.md for details',
      },
    ],
  },
};

still requires an expected Glob { '*.models.ts': '*.model.ts' }, despite the errorMessage Not using it at all. In addition the previous PR where a non-glob string could be used in the value {'*models.ts: reson models is not allowed}` also allowed a different reason for each block. The current implementation should at least allow an empty string in value when errorMessage is defined.
It just doesn't make sense to still have to provide a suggested Glob pattern that must pass a glob matching pattern, when it isn't used at all.

Expected behavior

module.exports = {
  plugins: ['check-file'],
  rules: {
    'check-file/filename-blocklist': [
      'error',
      { '*.models.ts':  'The file "{{ target }}" is blocked since it since it matches the blocklisted pattern "{{ pattern }}", see contribute.md for details'
       '*.otherthing.ts':  'The file "{{ target }}" is blocked since it since it matches the blocklisted pattern "{{ pattern }}", see aDifferent.md for details'
      },
      {
        errorMessage: true 
        },
    ],
  },
};

should work and not return the error " 1:1 error There is an invalid pattern "The file "{{ target }}" is blocked since it since it matches the blocklisted pattern", please double-check it and try again check-file/filename-blocklist"

OR at least:

module.exports = {
  plugins: ['check-file'],
  rules: {
    'check-file/filename-blocklist': [
      'error',
      { '*.models.ts': '' },
      {
        errorMessage:
          'The file "{{ target }}" is blocked since it since it matches the blocklisted pattern "{{ pattern }}", see contribute.md for details',
      },
    ],
  },
};

should work and not return the error " 1:1 error There is an invalid pattern "The file "{{ target }}" is blocked since it since it matches the blocklisted pattern", please double-check it and try again check-file/filename-blocklist"

Desktop (please complete the following information):

  • OS: macOS

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions