-
Notifications
You must be signed in to change notification settings - Fork 671
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
New: Ability to search npm packages #785
Conversation
src/lib/utils/resource-loader.ts
Outdated
export const getCoreRulesFromNpm = async () => { | ||
const rules = await getNpmPackages('@sonarwhal/rule'); | ||
|
||
return filterPackages(rules, '@sonarwhal/rule'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put a comment explaining why we are filtering even though you are searching for @sonarwhal/rule
?
Maybe we could also do a search just by @sonarwhal
and then do the grouping in memory by rule/parser/connector/etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it is because I'm doing something weird or not, but the search doesn't work like you expect to work. With the packages there is right now, search for @sonarwhal
or sonarwhal
return the same elements (and not, not all the packages start with @sonarwhal`.
About the filter, I will write some explanation, but look for @sonarwhal/rule
doesn't have to return only packages that start with @sonarwhal/rule
:(
src/lib/types.ts
Outdated
@@ -74,3 +74,17 @@ export interface IORA { | |||
fail(): void; | |||
text: string; | |||
} | |||
|
|||
export type NpmMaintainer = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some descriptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
This is in preparation for #748. We will merge this PR once the other one is merged. The idea is to replace the results of getting the installed core rules with the npm search. The reason is that there will not be any rule installed by default. Some things to take into account while this PR continues:
@sarvaje, any other thing that we discussed that I forgot? |
f5613b2
to
09aad7c
Compare
d91817b
to
407bdff
Compare
Co-authored-by: Antón Molleda <[email protected]>
Fix: package.json files to copy all files. Fix: A bunch of tests due to the new architecture.
Pull request checklist
Make sure you:
For non-trivial changes, please make sure you also:
Short description of the change(s)
This PR allow us to get the npm packages with rules/parsers/etc. directly from npm, and it will be useful for futures updates in sonarwhal.