-
Notifications
You must be signed in to change notification settings - Fork 342
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
Upgrade eslint to v9, use flat config #5498
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for aa48d5d |
JavaScript changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
index f69163a5d..c21c331e2 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
@@ -183,7 +183,7 @@ class I18n {
s && (n = s)
}
if ("string" == typeof n) {
- if (n.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(n)) {
if (!e) throw new Error("i18n: cannot replace placeholders in string if no option data provided");
return this.replacePlaceholders(n, e)
}
@@ -472,7 +472,7 @@ class CharacterCount extends GOVUKFrontendComponentConfigurable {
element: a,
identifier: `Count message (\`id="${r}"\`)`
});
- `${a.textContent}`.match(/^\s*$/) && (a.textContent = this.i18n.t("textareaDescription", {
+ /^\s*$/.exec(`${a.textContent}`) && (a.textContent = this.i18n.t("textareaDescription", {
count: this.maxLength
})), this.$textarea.insertAdjacentElement("afterend", a);
const c = document.createElement("div");
Action run for aa48d5d |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/all.bundle.js b/packages/govuk-frontend/dist/govuk/all.bundle.js
index ab5747462..11ea6aeb0 100644
--- a/packages/govuk-frontend/dist/govuk/all.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/all.bundle.js
@@ -72,6 +72,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -363,7 +364,7 @@
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
@@ -1014,7 +1015,7 @@
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
});
}
- if (`${$textareaDescription.textContent}`.match(/^\s*$/)) {
+ if (/^\s*$/.exec(`${$textareaDescription.textContent}`)) {
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
count: this.maxLength
});
@@ -2505,9 +2506,11 @@
}
}).filter(Boolean);
}
+
/**
* @typedef {{new (...args: any[]): any, moduleName: string}} CompatibleClass
*/
+
/**
* Config for all components via `initAll()`
*
@@ -2520,6 +2523,7 @@
* @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config
* @property {PasswordInputConfig} [passwordInput] - Password input config
*/
+
/**
* Config for individual components
*
@@ -2534,15 +2538,18 @@
* @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig
* @typedef {import('./components/password-input/password-input.mjs').PasswordInputConfig} PasswordInputConfig
*/
+
/**
* Component config keys, e.g. `accordion` and `characterCount`
*
* @typedef {keyof Config} ConfigKey
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {ConstructorParameters<ComponentClass>[1]} ComponentConfig
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} ErrorContext
@@ -2550,12 +2557,14 @@
* @property {ComponentClass} [component] - Class of component
* @property {ComponentConfig<ComponentClass>} config - Config supplied to component
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @callback OnErrorCallback
* @param {unknown} error - Thrown error
* @param {ErrorContext<ComponentClass>} context - Object containing the element, component class and configuration
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} CreateAllOptions
diff --git a/packages/govuk-frontend/dist/govuk/all.bundle.mjs b/packages/govuk-frontend/dist/govuk/all.bundle.mjs
index 654758d17..f906b6374 100644
--- a/packages/govuk-frontend/dist/govuk/all.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/all.bundle.mjs
@@ -66,6 +66,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -357,7 +358,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
@@ -1008,7 +1009,7 @@ class CharacterCount extends GOVUKFrontendComponentConfigurable {
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
});
}
- if (`${$textareaDescription.textContent}`.match(/^\s*$/)) {
+ if (/^\s*$/.exec(`${$textareaDescription.textContent}`)) {
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
count: this.maxLength
});
@@ -2499,9 +2500,11 @@ function createAll(Component, config, createAllOptions) {
}
}).filter(Boolean);
}
+
/**
* @typedef {{new (...args: any[]): any, moduleName: string}} CompatibleClass
*/
+
/**
* Config for all components via `initAll()`
*
@@ -2514,6 +2517,7 @@ function createAll(Component, config, createAllOptions) {
* @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config
* @property {PasswordInputConfig} [passwordInput] - Password input config
*/
+
/**
* Config for individual components
*
@@ -2528,15 +2532,18 @@ function createAll(Component, config, createAllOptions) {
* @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig
* @typedef {import('./components/password-input/password-input.mjs').PasswordInputConfig} PasswordInputConfig
*/
+
/**
* Component config keys, e.g. `accordion` and `characterCount`
*
* @typedef {keyof Config} ConfigKey
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {ConstructorParameters<ComponentClass>[1]} ComponentConfig
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} ErrorContext
@@ -2544,12 +2551,14 @@ function createAll(Component, config, createAllOptions) {
* @property {ComponentClass} [component] - Class of component
* @property {ComponentConfig<ComponentClass>} config - Config supplied to component
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @callback OnErrorCallback
* @param {unknown} error - Thrown error
* @param {ErrorContext<ComponentClass>} context - Object containing the element, component class and configuration
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} CreateAllOptions
diff --git a/packages/govuk-frontend/dist/govuk/common/index.mjs b/packages/govuk-frontend/dist/govuk/common/index.mjs
index 0030168b6..fb12e7a14 100644
--- a/packages/govuk-frontend/dist/govuk/common/index.mjs
+++ b/packages/govuk-frontend/dist/govuk/common/index.mjs
@@ -64,6 +64,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
index 949910dc2..c39770cbe 100644
--- a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
@@ -32,6 +32,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -303,7 +304,7 @@
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
index 521b35c78..6f8dd9a86 100644
--- a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
@@ -26,6 +26,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -297,7 +298,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
index 54849012d..f78c83413 100644
--- a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
@@ -32,6 +32,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
index b5ff0c905..645f9ea2b 100644
--- a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
@@ -26,6 +26,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
index cc24a93af..90011e6c4 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
@@ -37,6 +37,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -328,7 +329,7 @@
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
@@ -568,7 +569,7 @@
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
});
}
- if (`${$textareaDescription.textContent}`.match(/^\s*$/)) {
+ if (/^\s*$/.exec(`${$textareaDescription.textContent}`)) {
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
count: this.maxLength
});
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
index 030682a94..67424e584 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
@@ -31,6 +31,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -322,7 +323,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
@@ -562,7 +563,7 @@ class CharacterCount extends GOVUKFrontendComponentConfigurable {
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
});
}
- if (`${$textareaDescription.textContent}`.match(/^\s*$/)) {
+ if (/^\s*$/.exec(`${$textareaDescription.textContent}`)) {
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
count: this.maxLength
});
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.mjs b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.mjs
index dda6c3e8b..f8f3dc6b6 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.mjs
@@ -71,7 +71,7 @@ class CharacterCount extends GOVUKFrontendComponentConfigurable {
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
});
}
- if (`${$textareaDescription.textContent}`.match(/^\s*$/)) {
+ if (/^\s*$/.exec(`${$textareaDescription.textContent}`)) {
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
count: this.maxLength
});
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
index 04c9b69e9..afc282237 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
@@ -26,6 +26,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
index 934dab1b1..8bdd0873e 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
@@ -20,6 +20,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
index 0280ff8f5..039fea77b 100644
--- a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
@@ -62,6 +62,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
index d7f644f4e..086de248a 100644
--- a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
@@ -56,6 +56,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
index a9ad88164..01a7cae49 100644
--- a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
@@ -32,6 +32,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -303,7 +304,7 @@
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
index 726290eeb..b2c266959 100644
--- a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
@@ -26,6 +26,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -297,7 +298,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
index 821b9563e..c58384319 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
@@ -34,6 +34,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
index ceb5d98de..d80706233 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
@@ -28,6 +28,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
index a64b09dd1..e7b30fb16 100644
--- a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
@@ -56,6 +56,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
index d81bfcc4d..83d3b8839 100644
--- a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
@@ -50,6 +50,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
index ddd2862a3..02c90483a 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
@@ -37,6 +37,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -308,7 +309,7 @@
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
index 1b4d22544..1e88c7428 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
@@ -31,6 +31,7 @@ function isObject(option) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
@@ -302,7 +303,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
index 076a35f79..b46b92141 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
@@ -26,6 +26,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
index ca0e06f97..d8691c133 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
@@ -20,6 +20,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
index 5a21214c3..11ab2ec17 100644
--- a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
@@ -34,6 +34,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
index c11e20be8..25d9733c6 100644
--- a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
@@ -28,6 +28,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
index 005ea996b..1c0925583 100644
--- a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
@@ -56,6 +56,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
index 01b46e5f1..19ba2443f 100644
--- a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
@@ -50,6 +50,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
index 19fb6d4b9..2808da007 100644
--- a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
@@ -40,6 +40,7 @@
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
index 8ea827012..cb3b2de37 100644
--- a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
@@ -34,6 +34,7 @@ function isSupported($scope = document.body) {
function formatErrorMessage(Component, message) {
return `${Component.moduleName}: ${message}`;
}
+
/**
* @typedef ComponentWithModuleName
* @property {string} moduleName - Name of the component
diff --git a/packages/govuk-frontend/dist/govuk/i18n.mjs b/packages/govuk-frontend/dist/govuk/i18n.mjs
index f7a76fb04..cad45d3db 100644
--- a/packages/govuk-frontend/dist/govuk/i18n.mjs
+++ b/packages/govuk-frontend/dist/govuk/i18n.mjs
@@ -18,7 +18,7 @@ class I18n {
}
}
if (typeof translation === 'string') {
- if (translation.match(/%{(.\S+)}/)) {
+ if (/%{(.\S+)}/.exec(translation)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
diff --git a/packages/govuk-frontend/dist/govuk/init.mjs b/packages/govuk-frontend/dist/govuk/init.mjs
index 7bc77bdab..0268ce68c 100644
--- a/packages/govuk-frontend/dist/govuk/init.mjs
+++ b/packages/govuk-frontend/dist/govuk/init.mjs
@@ -104,9 +104,11 @@ function createAll(Component, config, createAllOptions) {
}
}).filter(Boolean);
}
+
/**
* @typedef {{new (...args: any[]): any, moduleName: string}} CompatibleClass
*/
+
/**
* Config for all components via `initAll()`
*
@@ -119,6 +121,7 @@ function createAll(Component, config, createAllOptions) {
* @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config
* @property {PasswordInputConfig} [passwordInput] - Password input config
*/
+
/**
* Config for individual components
*
@@ -133,15 +136,18 @@ function createAll(Component, config, createAllOptions) {
* @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig
* @typedef {import('./components/password-input/password-input.mjs').PasswordInputConfig} PasswordInputConfig
*/
+
/**
* Component config keys, e.g. `accordion` and `characterCount`
*
* @typedef {keyof Config} ConfigKey
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {ConstructorParameters<ComponentClass>[1]} ComponentConfig
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} ErrorContext
@@ -149,12 +155,14 @@ function createAll(Component, config, createAllOptions) {
* @property {ComponentClass} [component] - Class of component
* @property {ComponentConfig<ComponentClass>} config - Config supplied to component
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @callback OnErrorCallback
* @param {unknown} error - Thrown error
* @param {ErrorContext<ComponentClass>} context - Object containing the element, component class and configuration
*/
+
/**
* @template {CompatibleClass} ComponentClass
* @typedef {object} CreateAllOptions
Action run for aa48d5d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes alphagov/govuk-design-system#3649