Skip to content

Commit b1b952d

Browse files
committed
feat(template): remove unused var and some lint warning
MP-2075
1 parent 7137137 commit b1b952d

File tree

10 files changed

+30
-23
lines changed

10 files changed

+30
-23
lines changed

template-backend-extension/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import { Provider } from 'react-redux';
4-
4+
// eslint-disable-next-line import/no-extraneous-dependencies
55
import { Playground, store } from '@lumapps-extensions-playground/devenv';
66

77
import '@lumx/core/lumx.css';
88

99
import { WidgetGlobalSettings } from './widget/WidgetGlobalSettings';
1010

11-
import config from './config.js';
11+
import config from './config';
1212

1313
ReactDOM.render(
1414
<React.StrictMode>

template-backend-extension/src/widget/WidgetGlobalSettings.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type WidgetGlobalSettings = import('lumapps-sdk-js').GlobalSettingsComponent<any
1414
*
1515
* @param {Object} props The settings component properties.
1616
*/
17-
const IntlWidgetGlobalSettings: WidgetGlobalSettings = ({ properties = {}, exportProp }) => {
17+
const IntlWidgetGlobalSettings: WidgetGlobalSettings = () => {
1818
const contactMail = 'contact@mail.com';
1919
const subjectMail = 'Extension activation';
2020

@@ -32,17 +32,21 @@ const IntlWidgetGlobalSettings: WidgetGlobalSettings = ({ properties = {}, expor
3232

3333
export const WidgetGlobalSettings: WidgetGlobalSettings = (props) => {
3434
const { displayLanguage } = useLanguage();
35-
const messages: Record<string, Record<string, string>> = {
36-
en: messagesEn,
37-
fr: messagesFr,
38-
};
35+
const messages = useMemo(
36+
() => ({
37+
en: messagesEn,
38+
fr: messagesFr,
39+
}),
40+
[],
41+
);
42+
3943
const lang = useMemo(() => (Object.keys(messages).includes(displayLanguage) ? displayLanguage : 'en'), [
4044
displayLanguage,
4145
messages,
4246
]);
4347

4448
return (
45-
<IntlProvider locale={lang} messages={messages[lang]}>
49+
<IntlProvider locale={lang} messages={messages[lang as keyof typeof messages]}>
4650
<NotificationsProvider>
4751
<PredefinedErrorBoundary>
4852
<IntlWidgetGlobalSettings {...props} />

template-empty-extension/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import { Provider } from 'react-redux';
4-
4+
// eslint-disable-next-line import/no-extraneous-dependencies
55
import { Playground, store } from '@lumapps-extensions-playground/devenv';
66

77
import '@lumx/core/lumx.css';
@@ -10,7 +10,7 @@ import { Widget } from './widget/Widget';
1010
import { WidgetSettings } from './widget/WidgetSettings';
1111
import { WidgetGlobalSettings } from './widget/WidgetGlobalSettings';
1212

13-
import config from './config.js';
13+
import config from './config';
1414

1515
ReactDOM.render(
1616
<React.StrictMode>

template-empty-extension/src/widget/Widget.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
2-
import { Theme } from '@lumx/react';
32

43
type Widget = import('lumapps-sdk-js').ContentComponent<any, any>;
54

6-
const Widget: Widget = ({ value = {}, globalValue = {}, theme = Theme.light }) => {
5+
const Widget: Widget = () => {
76
return <></>;
87
};
98

template-empty-extension/src/widget/WidgetGlobalSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ type WidgetGlobalSettings = import('lumapps-sdk-js').GlobalSettingsComponent<any
77
*
88
* @param {Object} props The settings component properties.
99
*/
10-
export const WidgetGlobalSettings: WidgetGlobalSettings = ({ properties = {}, exportProp }) => {
10+
export const WidgetGlobalSettings: WidgetGlobalSettings = () => {
1111
return <></>;
1212
};

template-empty-extension/src/widget/WidgetSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import React from 'react';
22

33
type WidgetSettings = import('lumapps-sdk-js').SettingsComponent<any, any>;
44

5-
export const WidgetSettings: WidgetSettings = (props) => {
5+
export const WidgetSettings: WidgetSettings = () => {
66
return <></>;
77
};

template-share-extension/src/extension/Share.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,21 @@ const Share: import('lumapps-sdk-js').ContentComponent<undefined, ShareProps> =
120120

121121
const NotificationAwareContent: typeof Share = (props) => {
122122
const { displayLanguage } = useLanguage();
123-
const messages: Record<string, Record<string, string>> = {
124-
en: messagesEn,
125-
fr: messagesFr,
126-
};
123+
const messages = useMemo(
124+
() => ({
125+
en: messagesEn,
126+
fr: messagesFr,
127+
}),
128+
[],
129+
);
130+
127131
const lang = useMemo(() => (Object.keys(messages).includes(displayLanguage) ? displayLanguage : 'en'), [
128132
displayLanguage,
129133
messages,
130134
]);
131135

132136
return (
133-
<IntlProvider locale={lang} messages={messages[lang]}>
137+
<IntlProvider locale={lang} messages={messages[lang as keyof typeof messages]}>
134138
<NotificationsProvider>
135139
<PredefinedErrorBoundary>
136140
<Share {...props} />

template-share-extension/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import { Provider } from 'react-redux';
4-
4+
// eslint-disable-next-line import/no-extraneous-dependencies
55
import { Playground, store } from '@lumapps-extensions-playground/devenv';
66

77
import '@lumx/core/lumx.css';
88

99
import { Share } from './extension/Share';
1010
import { ShareGlobalSettings } from './extension/ShareGlobalSettings';
1111

12-
import config from './config.js';
12+
import config from './config';
1313

1414
ReactDOM.render(
1515
<React.StrictMode>

template-widget-extension/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { WidgetSettings } from './widget/WidgetSettings';
1111
import { WidgetGlobalSettings } from './widget/WidgetGlobalSettings';
1212

1313
// eslint-disable-next-line import/extensions
14-
import config from './config.js';
14+
import config from './config';
1515

1616
ReactDOM.render(
1717
<React.StrictMode>

template-widget-extension/src/widget/Widget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Widget: Widget = ({ theme = Theme.light }) => {
4646
link = useBlur && blur !== undefined ? `${link}=${blur}` : link;
4747

4848
setUrl(link);
49-
}, [blur, imageId, useBlur, useGreyScale, url, globalProperties?.baseUrl]);
49+
}, [blur, imageId, useBlur, useGreyScale, url, globalProperties]);
5050

5151
const { notifySuccess } = useNotifications();
5252

0 commit comments

Comments
 (0)