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

Add globbing to ES Lint onlyDependOnLibsWithTags #15264

Closed
kschaefe opened this issue Feb 25, 2023 · 2 comments · Fixed by #17530
Closed

Add globbing to ES Lint onlyDependOnLibsWithTags #15264

kschaefe opened this issue Feb 25, 2023 · 2 comments · Fixed by #17530
Assignees
Labels
community This is a good first issue for contributing outdated scope: linter Issues related to Eslint support in Nx type: feature

Comments

@kschaefe
Copy link

Description

Currently, only special-case * globbing exists for onlyDependOnLibsWithTags. Add the ability to use * to pattern match with partial strings.

Note: I filed this as a request instead of a bug because this feature does not exist, but the current Nx implementation feels like a miss. See all of these places that support globbing.

If you decide not to implement this, I'd recommend making the documentation more clear that onlyDependOnLibsWithTags doesn't support any globbing other than the special case. My assumption was that it would because everything else globs and you note * special case in the docs.

Motivation

We have a few tag types. They're perhaps overly picayune, but we're using them to help developers focus in on making more, smaller libraries. As such we're using a two part tag main:specifier, such as util:types for a shared, types-only library or util:data-access. Given our wide usage of this pattern we want to be able to set onlyDependOnLibsWithTags to util:* for things like features or apps. As we add more main:new-specifier libraries, we don't want to have to update the ES Lint tag rules.

Splitting the main and specifier portions into independent tags creates the same problem. As we add new things (new specifiers), we still have to go update our ES Lint rules.

@AgentEnder AgentEnder added the scope: linter Issues related to Eslint support in Nx label Feb 27, 2023
@meeroslav meeroslav added the community This is a good first issue for contributing label Apr 18, 2023
@ericyd
Copy link
Contributor

ericyd commented Jun 7, 2023

TIL "picayune" is a word 😄

I'm going to try to implement this, not because I have any attachment to this particular issue, but because Nx is an amazing project and I'd love to help close out a community issue.

I believe the fix should be straight forward, it looks like the relevant code is in the hasTag function which is used to filter if a project has the tag. Adding a manual glob check should work.

In the meantime, @kschaefe , if I'm reading the source code correctly, you might be able to achieve your goal right now by using a string that looks like a regex, e.g.

"onlyDependOnLibsWithTags": ["/main.*/"]

or even just

"onlyDependOnLibsWithTags": ["/main/"]

It seems like this could be better explained in the docs so I'll try to update that while implementing non-regex glob support.

If the Nx team has any opinions on how/where I document this, I'm all ears, otherwise I'll take a stab somewhere that feels reasonable.

ericyd added a commit to ericyd/nx that referenced this issue Jun 9, 2023
…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 self-assigned this Jun 23, 2023
meeroslav pushed a commit to ericyd/nx that referenced this issue Jun 23, 2023
…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 pushed a commit to ericyd/nx that referenced this issue Jun 30, 2023
…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
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

4 participants