Skip to content

[Config][Doc] minimatch syntax is not fully supported in include and exclude due to makePathRegexSafeΒ #2352

@houkanshan

Description

@houkanshan

Description

include and exclude: these patterns specify which files to include or exclude during the extraction process. They are passed to minimatch for pattern matching.
https://lingui.dev/ref/conf#catalogs

I think the fix should be either updating the docs to mention these unsupported characters, or using glob's escape character \ to properly escape the special characters instead.

Verifications

  • I've checked the docs and this isn't covered there.
  • I've searched existing issues on GitHub.

Reproduction Steps

This config used to work before

{
  sourceLocale: 'en',
  locales: ['en', 'es'],
  catalogs: [
    {
      path: 'i18n/locales/{locale}/messages',
      include: ['**/*.{ts,tsx}'], // <------------- this
      exclude: ['**/node_modules/**'],
    },
  ],
}

Expected Behavior

Now running lingui extract generates empty catalogs

Catalog statistics for i18n/locales/{locale}/messages:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Language    β”‚ Total count β”‚ Missing β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ en (source) β”‚      0      β”‚    -    β”‚
β”‚ es          β”‚      0      β”‚    0    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Macro Support

Not using macro

Lingui Version

5.5.1

Babel Version

No response

Framework

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions