-
Notifications
You must be signed in to change notification settings - Fork 256
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(extract): adds recognition of jsdoc @import type imports #965
Conversation
Test driving it, seems to work great already. |
Thanks! Good to hear it works 🎉 There will be small changes over time. E.g. since yesterday I've changed the names of dependencyTypes a bit (for regular cli use shouldn't matter) and I'll add a feature switch to (1) prevent this being a breaking change (2) auto-switch the javascript parser to |
…en true extract code will attempt jsdoc import detection
…g an *ss on the ci
Code Climate has analyzed commit 2daf3d3 and detected 0 issues on this pull request. View more on Code Climate. |
## Description - adds recognition for the 'older' bracket style imports in jsdoc (so things like `/** @type {import('thing')} */`, `/** @typedef {import('thing')} Thing */`, `/** @param {import('thing')} pParameter blablabla */`, ...) - updates documentation to reflect that it isn't a 'future feature' anymore - 🏕️ drive-by: updates jsdoc type references in dependency-cruiser's own sources TODO - [x] Add support for more exotic ways to import (e.g. `/** @type {Partial<import('bla')>} */`, `/** @type{boolean|import('bla')|import('ble')} */`, `/** {Set<string,Partial<import('bla')>} */`, ...) - [x] Verify with [the list of jsdoc tag types typescript supports](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html) there's no other corner cases that can bite us. - [x] so... we currently seem to occasionally resolve these type only imports to the real implementation. Is that an issue? > [!NOTE] > an iteration of this pull request has been published [as a beta on npmjs](https://www.npmjs.com/package/dependency-cruiser/v/16.7.0-beta-2) ## Motivation and Context - necessary to be more complete than just `@import` tags (see #964 and #965) - needs to be introduced at the same time as those to prevent a breaking change ## How Has This Been Tested? - [x] green ci - [x] additional unit tests ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Documentation only change - [ ] Refactor (non-breaking change which fixes an issue without changing functionality) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
jsdoc
,jsdoc-import-tag
dependency types@import
jsdoc tagparser
set totsc
parser
attribute set totsc
)Future work:
/** @type {import('yadda').bla} */
) statements in other jsdoc tags - see typescript jsdoc reference for a list => likely better in a separate PR.Motivation and Context
Addresses #964
How Has This Been Tested?
Types of changes
Checklist
📖
⚖️