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

Fix overrides.files in config to allow basename glob patterns #6547

Merged
merged 2 commits into from Jan 22, 2023

Conversation

ybiquitous
Copy link
Member

Which issue, if any, is this issue related to?

Closes #6525

Is there anything in the PR that needs further explanation?

This change fixes the overrides.files property in config to allow basename glob patterns like *.css or *.html.

For example, let's consider stylelint-config-standard-vue:

{
  overrides: [
    {
      files: ["*.vue", "**/*.vue"],
      extends: [/* ... */],
    },
  ]
}

People should expect the *.vue pattern matches any .vue files in any directories.
See https://github.com/ota-meshi/stylelint-config-standard-vue/blob/v1.0.0/lib/index.js#L6

See also the basename option micromatch:
https://github.com/micromatch/micromatch/tree/4.0.5#optionsbasename

This change fixes the `overrides.files` property in config to allow
basename glob patterns like `*.css` or `*.html`.

For example, let's consider `stylelint-config-standard-vue`:

```js
{
  overrides: [
    {
      files: ["*.vue", "**/*.vue"],
      extends: [/* ... */],
    },
  ]
}
```

People should expect the `*.vue` pattern matches any `.vue` files in any directories.
See <https://github.com/ota-meshi/stylelint-config-standard-vue/blob/v1.0.0/lib/index.js#L6>

See also the `basename` option `micromatch`:
<https://github.com/micromatch/micromatch/tree/4.0.5#optionsbasename>
@changeset-bot
Copy link

changeset-bot bot commented Dec 28, 2022

🦋 Changeset detected

Latest commit: 6e29fab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR


// Glob patterns for micromatch should be in POSIX-style
return normalizePath(result);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] Created the absolutizeGlob() function to reduce duplications.

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@ybiquitous
Copy link
Member Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix overrides.files in config for glob patterns like *.vue
2 participants