feat: add excludeSourcePatterns option to import-access/jsdoc rule#125
Merged
uhyo merged 2 commits intouhyo:masterfrom Apr 14, 2025
Merged
feat: add excludeSourcePatterns option to import-access/jsdoc rule#125uhyo merged 2 commits intouhyo:masterfrom
uhyo merged 2 commits intouhyo:masterfrom
Conversation
uhyo
reviewed
Apr 14, 2025
Owner
uhyo
left a comment
There was a problem hiding this comment.
Thank you for the PR! I'd like to ask a light improvement in documentation.
Tests are failing but I'm not sure it is related to this PR... 😨
Owner
|
Thank you! I'll take a look at broken CI so I can release this quickly. |
Owner
|
@ygkn Hello 👋 sorry for being very late, but version |
Contributor
Author
|
@uhyo It works! Thank you! Here is the test: |
Owner
|
@ygkn Great! Thank you. I released |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #124
This PR adds a new
excludeSourcePatternsoption to theimport-access/jsdocrule.Implementation
excludeSourcePatternsoption toJSDocRuleOptionscheckSymbolImportabilityto check source paths against patternsThe change is fully backward compatible as it's an optional feature.
Example
Verification
We can verify this PR works as expected using the minimal reproduction repository from issue #124:
Add option to eslint.config.mjs:
{ rules: { "import-access/jsdoc": [ "error", { defaultImportability: "package", + excludeSourcePatterns: [ + ".next/**/*", + ], }, ], }, },We get only expected errors.
Dependencies
Added
minimatch(v10.0.1) for glob pattern matching. This is already used in the ecosystem:minimatch(v3.1.2)minimatchin its parserAlternative Approach
If adding
minimatchas a dependency is a concern, we could implement a regex-based approach instead:This would avoid the external dependency, though glob patterns are more user-friendly and consistent with ESLint's existing pattern syntax.