Skip to content

fix(type-utils): allow FileSpecifier to exclude paths #6860

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

Closed

Conversation

RebeccaStevens
Copy link
Contributor

PR Checklist

Overview

Adds excludePaths option to FileSpecifier (has no effect if a path is given).
This new option defaults to ["node_modules"].

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @RebeccaStevens!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Apr 7, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit db94a99
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/643014f5acb7b7000869114a
😎 Deploy Preview https://deploy-preview-6860--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@nx-cloud
Copy link

nx-cloud bot commented Apr 7, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit db94a99. 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 30 targets

Sent with 💌 from NxCloud.

@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

Merging #6860 (db94a99) into v6 (a35a2bb) will decrease coverage by 0.02%.
The diff coverage is 75.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #6860      +/-   ##
==========================================
- Coverage   87.46%   87.45%   -0.02%     
==========================================
  Files         374      374              
  Lines       12879    12884       +5     
  Branches     3811     3814       +3     
==========================================
+ Hits        11265    11268       +3     
- Misses       1229     1230       +1     
- Partials      385      386       +1     
Flag Coverage Δ
unittest 87.45% <75.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/type-utils/src/TypeOrValueSpecifier.ts 84.84% <75.00%> (-4.44%) ⬇️

Copy link
Contributor

@marekdedic marekdedic left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, you truly beat me to it by just a few minutes :D

As I wrote in the comments, I'm not a fan of the paths being configurable and would just hard-code node_modules there.

However, if you do decide to go ahead with the excludePaths option, typeOrValueSpecifierSchema needs to be modified as well :)

@JoshuaKGoldberg
Copy link
Member

I'm going to wait on discussion in #6839 - it might impact the config option here.

@JoshuaKGoldberg JoshuaKGoldberg added the blocked by another PR PRs which are ready to go but waiting on another PR label Apr 16, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the branch typescript-eslint:main July 10, 2023 17:52
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Jul 10, 2023

This was unintentionally auto-closed when we merged the v6 branch 🙃 it'll be recreated reopened.

@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from v6 to main July 10, 2023 21:11
@JoshuaKGoldberg
Copy link
Member

Sorry for the delay - #6839 is accepting PRs so this is unblocked!

@JoshuaKGoldberg JoshuaKGoldberg removed the blocked by another PR PRs which are ready to go but waiting on another PR label Oct 17, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here! I think the changes generally make sense, but I'm leaning towards keeping it less complex by not making excludePaths and path mutually exclusive. What do you think?

path?: undefined;
excludePaths?: string | string[]; // defaults to `["node_modules"]`.
}
);
Copy link
Member

Choose a reason for hiding this comment

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

Starting a new conversation here: why make excludePaths and path mutually exclusive? What if someone wants to provide both? E.g.:

{
  path: "examples",
  excludePaths: ["examples/*/node_modules"]
}

Proposal: can we switch this back to a straightforward interface?

interface FileSpecifier {
  from: 'file';
  name: string | string[];
  path?: string;
  excludePaths?: string | string[]; // defaults to `["node_modules"]`.
}

}
| {
path?: undefined;
excludePaths?: string | string[]; // defaults to `["node_modules"]`.
Copy link
Member

Choose a reason for hiding this comment

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

I also wonder if we should call this pathExcludes, to visually lump it in with path... 🤔

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Oct 17, 2023
@JoshuaKGoldberg
Copy link
Member

👋 ping @RebeccaStevens, just checking in - is this still something you have time for? No worries if not! I just don't want to leave it hanging.

@JoshuaKGoldberg JoshuaKGoldberg added the stale PRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period label Nov 13, 2023
@JoshuaKGoldberg
Copy link
Member

Closing this PR as it's been stale for a while without activity. Feel free to reopen @RebeccaStevens if you have time - but no worries if not!

If anybody wants to drive it forward, please do post your own PR - and if you use this as a start, consider adding a co-author at the end of your PR description. Thanks! 😊

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Issues waiting for a reply from the OP or another party bug Something isn't working stale PRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: typeMatchesSpecifier FileSpecifier checks in node modules
4 participants