diff --git a/.betterer.eslint.config.js b/.betterer.eslint.config.js index 8cda8335a07..3030dd53c3e 100644 --- a/.betterer.eslint.config.js +++ b/.betterer.eslint.config.js @@ -108,21 +108,4 @@ module.exports = [ 'no-barrel-files/no-barrel-files': 'error', }, }, - { - files: ['public/**/*.tsx', 'packages/grafana-ui/**/*.tsx'], - ignores: ['public/app/plugins/**', '**/*.story.tsx', '**/*.{test,spec}.{ts,tsx}', '**/__mocks__/', 'public/test'], - rules: { - '@grafana/no-untranslated-strings': [ - 'error', - { - forceFix: [ - // Add paths here that are happy to be auto fixed by this rule, - // for example - // 'public/app/features/alerting' - ], - }, - ], - '@grafana/no-translation-top-level': 'error', - }, - }, ]; diff --git a/.betterer.results b/.betterer.results index 8b40311bc79..f7d69b7f905 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1116,9 +1116,6 @@ exports[`better eslint`] = { "public/app/features/connections/tabs/ConnectData/NoAccessModal/index.tsx:5381": [ [0, 0, 0, "Do not use export all (\`export * from ...\`)", "0"] ], - "public/app/features/connections/tabs/ConnectData/Search/Search.tsx:5381": [ - [0, 0, 0, "Do not use the t() function outside of a component or function", "0"] - ], "public/app/features/connections/tabs/ConnectData/Search/index.tsx:5381": [ [0, 0, 0, "Do not use export all (\`export * from ...\`)", "0"] ], @@ -1656,15 +1653,6 @@ exports[`better eslint`] = { "public/app/features/dimensions/utils.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/explore/RichHistory/RichHistorySettingsTab.tsx:5381": [ - [0, 0, 0, "Do not use the t() function outside of a component or function", "0"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "1"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "2"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "3"] - ], - "public/app/features/explore/ShortLinkButtonMenu.tsx:5381": [ - [0, 0, 0, "Do not use the t() function outside of a component or function", "0"] - ], "public/app/features/explore/TraceView/TraceView.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] @@ -1778,14 +1766,6 @@ exports[`better eslint`] = { "public/app/features/inspector/InspectDataTab.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], - "public/app/features/inspector/InspectJSONTab.tsx:5381": [ - [0, 0, 0, "Do not use the t() function outside of a component or function", "0"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "1"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "2"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "3"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "4"], - [0, 0, 0, "Do not use the t() function outside of a component or function", "5"] - ], "public/app/features/inspector/InspectStatsTab.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], diff --git a/eslint.config.js b/eslint.config.js index 96189d749c8..38506eda042 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -47,6 +47,7 @@ module.exports = [ 'public/vendor/', 'scripts/grafana-server/tmp', '!.betterer.eslint.config.js', + 'packages/grafana-ui/src/graveyard', // deprecated UI components slated for removal ], }, // Conditionally run the betterer rules if enabled in dev's config @@ -275,10 +276,11 @@ module.exports = [ plugins: { '@grafana': grafanaPlugin, }, - files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'], - ignores: ['**/*.{spec,test}.tsx'], + files: ['public/**/*.{ts,tsx,js,jsx}', 'packages/grafana-ui/**/*.{ts,tsx,js,jsx}'], + ignores: ['public/app/plugins/**', '**/*.story.tsx', '**/*.{test,spec}.{ts,tsx}', '**/__mocks__/', 'public/test'], rules: { '@grafana/no-untranslated-strings': 'error', + '@grafana/no-translation-top-level': 'error', }, }, { diff --git a/public/app/features/connections/tabs/ConnectData/Search/Search.tsx b/public/app/features/connections/tabs/ConnectData/Search/Search.tsx index 448abbc70dc..0e5ca5be634 100644 --- a/public/app/features/connections/tabs/ConnectData/Search/Search.tsx +++ b/public/app/features/connections/tabs/ConnectData/Search/Search.tsx @@ -19,8 +19,6 @@ const getStyles = (theme: GrafanaTheme2, headerHeight: number) => ({ }), }); -const placeholder = t('connections.search.placeholder', 'Search all'); - export interface Props { onChange: (e: React.FormEvent) => void; value: string | undefined; @@ -29,6 +27,7 @@ export interface Props { export const Search = ({ onChange, value }: Props) => { const chromeHeaderHeight = useChromeHeaderHeight(); const styles = useStyles2(getStyles, chromeHeaderHeight ?? 0); + const placeholder = t('connections.search.placeholder', 'Search all'); return (
diff --git a/public/app/features/explore/QueriesDrawer/utils.ts b/public/app/features/explore/QueriesDrawer/utils.ts deleted file mode 100644 index fa77d88fe13..00000000000 --- a/public/app/features/explore/QueriesDrawer/utils.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { t } from 'app//core/internationalization'; - -export const i18n = { - queryLibrary: t('explore.rich-history.query-library', 'Query library'), - queryHistory: t('explore.rich-history.query-history', 'Query history'), -}; diff --git a/public/app/features/explore/RichHistory/RichHistory.tsx b/public/app/features/explore/RichHistory/RichHistory.tsx index 60bce0a6ec3..a8a13da4d8e 100644 --- a/public/app/features/explore/RichHistory/RichHistory.tsx +++ b/public/app/features/explore/RichHistory/RichHistory.tsx @@ -16,7 +16,6 @@ import { RichHistoryQuery } from 'app/types/explore'; import { supportedFeatures } from '../../../core/history/richHistoryStorageProvider'; import { Tabs } from '../QueriesDrawer/QueriesDrawerContext'; -import { i18n } from '../QueriesDrawer/utils'; import { selectExploreDSMaps } from '../state/selectors'; import { RichHistoryQueriesTab } from './RichHistoryQueriesTab'; @@ -94,7 +93,7 @@ export function RichHistory(props: RichHistoryProps) { .filter((name): name is string => !!name); const QueriesTab: TabConfig = { - label: i18n.queryHistory, + label: t('explore.rich-history.query-history', 'Query history'), value: Tabs.RichHistory, content: ( { }; }; -const retentionPeriodOptions = [ - { value: 2, label: t('explore.rich-history-settings-tab.retention-period.2-days', '2 days') }, - { value: 5, label: t('explore.rich-history-settings-tab.retention-period.5-days', '5 days') }, - { value: 7, label: t('explore.rich-history-settings-tab.retention-period.1-week', '1 week') }, - { value: 14, label: t('explore.rich-history-settings-tab.retention-period.2-weeks', '2 weeks') }, -]; - export function RichHistorySettingsTab(props: RichHistorySettingsProps) { const { retentionPeriod, @@ -60,6 +53,12 @@ export function RichHistorySettingsTab(props: RichHistorySettingsProps) { deleteRichHistory, } = props; const styles = useStyles2(getStyles); + const retentionPeriodOptions = [ + { value: 2, label: t('explore.rich-history-settings-tab.retention-period.2-days', '2 days') }, + { value: 5, label: t('explore.rich-history-settings-tab.retention-period.5-days', '5 days') }, + { value: 7, label: t('explore.rich-history-settings-tab.retention-period.1-week', '1 week') }, + { value: 14, label: t('explore.rich-history-settings-tab.retention-period.2-weeks', '2 weeks') }, + ]; const selectedOption = retentionPeriodOptions.find((v) => v.value === retentionPeriod); const onDelete = () => { diff --git a/public/app/features/explore/ShortLinkButtonMenu.tsx b/public/app/features/explore/ShortLinkButtonMenu.tsx index 768a2ff00bd..25168f7335c 100644 --- a/public/app/features/explore/ShortLinkButtonMenu.tsx +++ b/public/app/features/explore/ShortLinkButtonMenu.tsx @@ -26,16 +26,15 @@ interface ShortLinkMenuItemData { absTime: boolean; } -const defaultMode: ShortLinkMenuItemData = { - key: 'copy-link', - label: t('explore.toolbar.copy-shortened-link', 'Copy shortened URL'), - icon: 'share-alt', - getUrl: () => undefined, - shorten: true, - absTime: false, -}; - export function ShortLinkButtonMenu() { + const defaultMode: ShortLinkMenuItemData = { + key: 'copy-link', + label: t('explore.toolbar.copy-shortened-link', 'Copy shortened URL'), + icon: 'share-alt', + getUrl: () => undefined, + shorten: true, + absTime: false, + }; const panes = useSelector(selectPanes); const [isOpen, setIsOpen] = useState(false); const [lastSelected, setLastSelected] = useState(defaultMode); diff --git a/public/app/features/inspector/InspectJSONTab.tsx b/public/app/features/inspector/InspectJSONTab.tsx index 9bfda13e376..c90a9330b9c 100644 --- a/public/app/features/inspector/InspectJSONTab.tsx +++ b/public/app/features/inspector/InspectJSONTab.tsx @@ -26,30 +26,6 @@ enum ShowContent { DataFrames = 'frames', } -const options: Array> = [ - { - label: t('dashboard.inspect-json.panel-json-label', 'Panel JSON'), - description: t( - 'dashboard.inspect-json.panel-json-description', - 'The model saved in the dashboard JSON that configures how everything works.' - ), - value: ShowContent.PanelJSON, - }, - { - label: t('dashboard.inspect-json.panel-data-label', 'Panel data'), - description: t('dashboard.inspect-json.panel-data-description', 'The raw model passed to the panel visualization'), - value: ShowContent.PanelData, - }, - { - label: t('dashboard.inspect-json.dataframe-label', 'DataFrame JSON (from Query)'), - description: t( - 'dashboard.inspect-json.dataframe-description', - 'Raw data without transformations and field config applied. ' - ), - value: ShowContent.DataFrames, - }, -]; - interface Props { onClose: () => void; dashboard?: DashboardModel; @@ -58,6 +34,35 @@ interface Props { } export function InspectJSONTab({ panel, dashboard, data, onClose }: Props) { + const options: Array> = useMemo( + () => [ + { + label: t('dashboard.inspect-json.panel-json-label', 'Panel JSON'), + description: t( + 'dashboard.inspect-json.panel-json-description', + 'The model saved in the dashboard JSON that configures how everything works.' + ), + value: ShowContent.PanelJSON, + }, + { + label: t('dashboard.inspect-json.panel-data-label', 'Panel data'), + description: t( + 'dashboard.inspect-json.panel-data-description', + 'The raw model passed to the panel visualization' + ), + value: ShowContent.PanelData, + }, + { + label: t('dashboard.inspect-json.dataframe-label', 'DataFrame JSON (from Query)'), + description: t( + 'dashboard.inspect-json.dataframe-description', + 'Raw data without transformations and field config applied. ' + ), + value: ShowContent.DataFrames, + }, + ], + [] + ); const styles = useStyles2(getPanelInspectorStyles2); const jsonOptions = useMemo(() => { if (panel) { @@ -67,7 +72,7 @@ export function InspectJSONTab({ panel, dashboard, data, onClose }: Props) { return options; } return options.slice(1, options.length); - }, [panel]); + }, [options, panel]); const [show, setShow] = useState(panel ? ShowContent.PanelJSON : ShowContent.DataFrames); const [text, setText] = useState(''); diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index fa7750cfbd3..4d81c836ad3 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -4781,7 +4781,6 @@ "newest-first": "Newest first", "oldest-first": "Oldest first", "query-history": "Query history", - "query-library": "Query library", "settings": "Settings", "starred": "Starred" },