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

Warn when broad glob patterns are used in the content configuration #14140

Merged
merged 12 commits into from
Aug 7, 2024

Commits on Aug 7, 2024

  1. show a warning when detecting broad glob patterns

    We will show a warning if all of these conditions are true:
    
    1. We detect `**` in the glob pattern
    2. _and_ you didn't explicitly use `node_modules` in the glob pattern
    3. _and_ we found files that include `node_modules` in the file path
    4. _and_ no other globs exist that explicitly match the found file
    
    With these rules in place, the DX has nice trade-offs:
    
    1. Very simple projects (that don't even have a `node_modules` folder),
       can simply use `./**/*` because while resolving actual files we won't
       see files from `node_modules` and thus won't warn.
    2. If you use `./src/**` and you do have a `node_modules`, then we also
       won't complain (unless you have a `node_modules` folder in the
       `./src` folder).
    3. If you work with a 3rd party library that you want to make changes
       to. Using an explicit match like `./node_modules/my-package/**/*` is
       allowed because `node_modules` is explicitly mentioned.
    
    Note: this only shows a warning, it does not stop the process entirely.
    The warning will be show when the very first file in the `node_modules`
    is detected.
    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    59723fb View commit details
    Browse the repository at this point in the history
  2. update changelog

    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    ef54703 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    89a55e3 View commit details
    Browse the repository at this point in the history
  4. fix CHANGELOG

    Accidentally removed a line
    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    09b69c6 View commit details
    Browse the repository at this point in the history
  5. re-use broad glob check

    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    e5eeb52 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    28d911e View commit details
    Browse the repository at this point in the history
  7. re-word warning

    + use the actual glob/file that is causing issues
    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    8be2483 View commit details
    Browse the repository at this point in the history
  8. update snapshot tests

    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    2d7e4aa View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    b1865b9 View commit details
    Browse the repository at this point in the history
  10. Update src/lib/content.js

    Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
    RobinMalfait and adamwathan committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    f5c8b51 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9c0006f View commit details
    Browse the repository at this point in the history
  12. update snapshot tests

    RobinMalfait committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    a9202fb View commit details
    Browse the repository at this point in the history