-
Notifications
You must be signed in to change notification settings - Fork 325
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
Various JSDoc + type checking fixes (for v4.4.0 only) #2997
Conversation
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 splitting it, this feels much safer to merge ahead of the release 🙌🏻 Just noticed one possible misunderstanding about a test that got removed around flat keys for the character count JS config.
src/govuk/components/character-count/character-count.unit.test.mjs
Outdated
Show resolved
Hide resolved
As identified by the `tsc` TypeScript compiler
0a679b8
to
a856000
Compare
a856000
to
c2b9130
Compare
@romaricpascal Think we're all sorted now I forgot we also accept So I've had to link to the JSDoc config |
@@ -10,5 +10,8 @@ module.exports = { | |||
source: { | |||
includePattern: '.+\\.m?js$', | |||
excludePattern: '.+\\.test.m?js$' | |||
}, | |||
templates: { | |||
cleverLinks: true |
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've not used @see
or @link
yet to other areas of the code but we're ready for it now
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.
Little mix-up when replacing the AccordionConfig, but all good to go otherwise 😄
/** | ||
* Config for all components | ||
* | ||
* @typedef {object} Config | ||
* @property {HTMLElement} [scope=document] - Scope to query for components | ||
* @property {import('./components/accordion/accordion.mjs').AccordionConfig} [accordion] - Accordion config | ||
* @property {import('./components/button/button.mjs').ButtonConfig} [button] - Button config | ||
* @property {import('./components/character-count/character-count.mjs').CharacterCountConfig} [characterCount] - Character Count config | ||
* @property {import('./components/error-summary/error-summary.mjs').ErrorSummaryConfig} [errorSummary] - Error Summary config | ||
* @property {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} [notificationBanner] - Notification Banner config | ||
*/ |
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.
Oh yeah, we were so focused on the individual components that all
was completely neglected 😬 Good spot! 🙌🏻
@@ -31,13 +31,11 @@ var TRANSLATIONS_DEFAULT = { | |||
* | |||
* @class | |||
* @param {HTMLElement} $module - HTML element to use for accordion | |||
* @param {object} config - Accordion config | |||
* @param {AccordionTranslations} config.i18n - Translations | |||
* @param {AccordionTranslations} [config] - Accordion config |
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.
* @param {AccordionTranslations} [config] - Accordion config | |
* @param {AccordionConfig} [config] - Accordion config |
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.
Brilliant spot. All fixed and ready for you again 😊
See: #2921 Whilst `other` is required in English and is used as a fallback, it won’t be in all locales
c2b9130
to
a80ecde
Compare
See the generated JSDoc config served by the review app |
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.
🚀
This PR fixes various JSDoc (and related code) issues identified in #2971
Including things like:
config
param are optionalplural form
other` is optional (with caveats)i18n.${lookupKey}
translation usage removedconfig.maxlength
andconfig.maxwords
are mutually exclusiveAll working fab here.
Screenshot showing
wordsUnderLimit
(string) not matching the TranslationPluralForms (object) JSDoc type