-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
refactor: remove the lodash
dependency
#808
refactor: remove the lodash
dependency
#808
Conversation
This significantly reduces the package install size.
@@ -164,7 +165,7 @@ export default iterateJsdoc(({ | |||
|
|||
const abbreviationsRegex = abbreviations.length ? | |||
new RegExp('\\b' + abbreviations.map((abbreviation) => { | |||
return _.escapeRegExp(abbreviation.replace(/\.$/ug, '') + '.'); | |||
return escapeStringRegexp(abbreviation.replace(/\.$/ug, '') + '.'); |
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.
Maybe look into if that extra replacing is necessary.
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.
Sorry about the earlier seperate comment notifications; I thought I was queueing them for a single comment review but accidentally was spamming them as I went.
Thanks! Looks good. Hope to have energy to review in the next few days... Re: scope creep, I don't mind a few small things--better to get things right, imo. |
Co-authored-by: Jayden Seric <me@jaydenseric.com>
I pushed a couple minor tweaks and also fixed testing and linting. Could you handle the removal of the remaining |
Actually, I think I've handled that last file all right--maybe just review all of my changes to see if you feel all right to move forward |
if (context.options[0] && option in context.options[0] && | ||
// Todo: boolean shouldn't be returning property, but tests currently require | ||
(typeof context.options[0][option] === 'boolean' || | ||
key in context.options[0][option]) | ||
) { | ||
return context.options[0][option][key]; | ||
} | ||
|
||
return context.options[0][option][key]; | ||
return baseObject.properties[key].default; |
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'm not aware of the context for these changes, but trust it makes sense.
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.
Yeah, although it is likely a bug (some issues reported which may suggest it), just using the boolean value of context.options[0][option]
when found to be a boolean didn't work either, so would need investigation and a separate PR.
What this fix does is just restore the lodash behavior of avoiding erring when trying in
checking on context.options[0][option]
(as it will do when it is a boolean).
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.
Thanks for the polish, LGTM!
e9011c6
to
aecf6cd
Compare
I'm excited to see this change has landed. Is there any chance that a new release will be published soon? I'm asking because we're waiting for this change to make it into a release over in Node.js core. |
🎉 This PR is included in version 37.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@Trott : As per the automated release, this is now released in v37.1.0. And thanks for the heads up on its use on the Node.js codebase! Hope it works well for y'all... |
This significantly reduces the package install size, as
lodash
has a 1.35 MB install size:https://packagephobia.com/result?p=lodash@4.17.21
While the current total install size for
eslint-plugin-jsdoc
is 4.75 MB:https://packagephobia.com/result?p=eslint-plugin-jsdoc@37.0.3
Also, presumably the native methods (
Array.filter
,Array.flatMap
,Array.some
, etc.) perform better thanlodash
functions.Some of the more complicated helpers have been refactored to minimal dependencies, most or which were able to be dev dependencies to correctly ensure a minimal production installation for consumers.