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

feat(linter): allow globs in onlyDependOnLibsWithTags eslint-plugin configuration option #17530

Conversation

ericyd
Copy link
Contributor

@ericyd ericyd commented Jun 9, 2023

Current Behavior

onlyDependOnLibsWithTags does not handle glob patterns in the tags list. However, several other options for the eslint-plugin do support glob patterns.

Expected Behavior

Update onlyDependOnLibsWithTags to handle glob patterns in tag lists. This allows a tagged package to depend on any packages matching the glob, rather than only specific tags.

Note: this behavior was already available, via Regex support. However, the ability to use regular expressions in the tag list was undocumented. This PR adds documentation for the new glob pattern as well as the existing regex pattern.

Related Issue(s)

Fixes #15264

Questions to maintainers

  1. When I followed the instructions in the CONTRIBUTING.md file, my pnpm-lock file was modified to version 6.1. Should this command be updated?
  2. When I first cloned the repo, VSCode automatically prompted me to open in the dev container. Great! It also automatically ran pnpm i and it added 10k+ files to a .pnpm-store directory. Should this directory be added to .gitignore? This didn't happen when I ran pnpm install outside of the devcontainer, so I'm not clear where the discrepancy comes from

@ericyd ericyd requested review from a team as code owners June 9, 2023 18:40
@ericyd ericyd requested review from FrozenPandaz and bcabanes June 9, 2023 18:40
@vercel
Copy link

vercel bot commented Jun 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2023 10:09am

@nx-cloud
Copy link

nx-cloud bot commented Jun 9, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit e297d72. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Comment on lines 106 to 110
// if the tag is a glob, check if the project matches the glob prefix
if (tag.endsWith('*')) {
const prefix = tag.substring(0, tag.length - 1);
return (proj.data.tags || []).some((t) => t.startsWith(prefix));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know this is a pretty naïve implementation of glob support, but since this option already supports regex I figured it didn't really need to be ultra robust. Happy to revisit if desired

ericyd and others added 2 commits June 30, 2023 12:04
…onfiguration option

add support for globs (in addition to existing string, regex, and * options)

to the onlyDependOnLibsWithTags configuration option for the eslint-plugin

closed nrwl#15264
@meeroslav meeroslav force-pushed the ericyd/add-glob-support-to-eslint-plugin-onlyDependOnLibsWithTags-option branch from 6103878 to e297d72 Compare June 30, 2023 10:06
@meeroslav meeroslav self-assigned this Jun 30, 2023
@meeroslav meeroslav added type: feature scope: linter Issues related to Eslint support in Nx labels Jun 30, 2023
@meeroslav meeroslav merged commit 576262b into nrwl:master Jun 30, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: linter Issues related to Eslint support in Nx type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add globbing to ES Lint onlyDependOnLibsWithTags
3 participants