Skip to content

Commit

Permalink
Allow subpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
iansan5653 authored Sep 6, 2024
1 parent 24d8526 commit 20c0335
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/is-primer-component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const {isImportedFrom} = require('./is-imported-from')

/** @returns {boolean} */
/**
* Check if `name` is a JSX component that is imported from `@primer/react` or
* a subpath `@primer/react/*`.
* @returns {boolean}
*/
function isPrimerComponent(name, scope) {
let identifier

Expand All @@ -14,7 +18,6 @@ function isPrimerComponent(name, scope) {
default:
return false
}

return isImportedFrom(/^@primer\/react$/, identifier, scope)
return isImportedFrom(/^@primer\/react(?:$|\/)/, identifier, scope)
}
exports.isPrimerComponent = isPrimerComponent

0 comments on commit 20c0335

Please sign in to comment.