diff --git a/.betterer.eslint.config.js b/.betterer.eslint.config.js index 80231c4a1e9..8d742ae5187 100644 --- a/.betterer.eslint.config.js +++ b/.betterer.eslint.config.js @@ -10,6 +10,7 @@ const testingLibraryPlugin = require('eslint-plugin-testing-library'); const grafanaConfig = require('@grafana/eslint-config/flat'); const grafanaPlugin = require('@grafana/eslint-plugin'); +const grafanaI18nPlugin = require('@grafana/i18n/eslint-plugin'); // Include the Grafana config and remove the rules, // as we just want to pull in all of the necessary configuration but not run the rules @@ -65,6 +66,7 @@ module.exports = [ 'no-barrel-files': barrelPlugin, '@grafana': grafanaPlugin, 'testing-library': testingLibraryPlugin, + '@grafana/i18n': grafanaI18nPlugin, }, linterOptions: { // This reports unused disable directives that we can clean up but diff --git a/eslint.config.js b/eslint.config.js index 6c427e66fb6..d4da985724c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -13,6 +13,7 @@ const unicornPlugin = require('eslint-plugin-unicorn'); const grafanaConfig = require('@grafana/eslint-config/flat'); const grafanaPlugin = require('@grafana/eslint-plugin'); +const grafanaI18nPlugin = require('@grafana/i18n/eslint-plugin'); const bettererConfig = require('./.betterer.eslint.config'); const getEnvConfig = require('./scripts/webpack/env-util'); @@ -294,6 +295,7 @@ module.exports = [ name: 'grafana/i18n-overrides', plugins: { '@grafana': grafanaPlugin, + '@grafana/i18n': grafanaI18nPlugin, }, files: [ 'public/app/!(plugins)/**/*.{ts,tsx,js,jsx}', @@ -308,8 +310,8 @@ module.exports = [ '**/mock*.{ts,tsx}', ], rules: { - '@grafana/no-untranslated-strings': ['error', { calleesToIgnore: ['^css$', 'use[A-Z].*'] }], - '@grafana/no-translation-top-level': 'error', + '@grafana/i18n/no-untranslated-strings': ['error', { calleesToIgnore: ['^css$', 'use[A-Z].*'] }], + '@grafana/i18n/no-translation-top-level': 'error', }, }, { diff --git a/packages/grafana-eslint-rules/README.md b/packages/grafana-eslint-rules/README.md index 1571403244a..1fb043a4ec0 100644 --- a/packages/grafana-eslint-rules/README.md +++ b/packages/grafana-eslint-rules/README.md @@ -111,184 +111,3 @@ const getStyles = (theme: GrafanaTheme2) => ({ ### `theme-token-usage` Used to find all instances of `theme` tokens being used in the codebase and emit the counts as metrics. Should **not** be used as an actual lint rule! - -### `no-untranslated-strings` - -Check if strings are marked for translation inside JSX Elements, in certain JSX props, and in certain object properties. - -### Options - -#### `forceFix` - -Allows specifying directories that, if the file is present within, then the rule will automatically fix the errors. This is primarily a workaround to allow for automatic mark up of new violations as the rule evolves. - -#### Example: - -```ts -{ - '@grafana/no-untranslated-strings': ['error', { forceFix: ['app/features/some-feature'] }], -} -``` - -#### `calleesToIgnore` - -Allows specifying regexes for methods that should be ignored when checking if object properties are untranslated. - -This is particularly useful to exclude references to properties such as `label` inside `css()` calls. - -#### Example: - -```ts -{ - '@grafana/no-untranslated-strings': ['error', { calleesToIgnore: ['^css$'] }], -} - -// The below would not be reported as an error -const foo = css({ - label: 'test', -}); - -// The below would still be reported as an error -const bar = { - label: 'test', -}; -``` - -#### JSXText - -```tsx -// Bad ❌ - - Copied - - -// Good ✅ - - Copied - -``` - -#### JSXAttributes - -```tsx -// Bad ❌ -
- -// Good ✅ -
-``` - -#### Object properties - -```tsx -// Bad ❌ -const someConfig = { - label: 'Some label', -}; - -// Good ✅ -const getSomeConfig = () => ({ - label: t('some.key.label', 'Some label'), -}); -``` - -#### Passing variables to translations - -```tsx -// Bad ❌ -const SearchTitle = ({ term }) =>
Results for {term}
; - -// Good ✅ -const SearchTitle = ({ term }) => Results for {{ term }}; - -// Good ✅ (if you need to interpolate variables inside nested components) -const SearchTerm = ({ term }) => {term}; -const SearchTitle = ({ term }) => ( - - Results for - -); - -// Good ✅ (if you need to interpolate variables and additional translated strings inside nested components) -const SearchTitle = ({ term }) => ( - - Results for {'{{ myVariable }}'} and this translated text is also in green - -); -``` - -#### How to translate props or attributes - -This rule checks if a string is wrapped up by the `Trans` tag, or if certain props contain untranslated strings. -We ask for such props to be translated with the `t()` function. - -The below props are checked for untranslated strings: - -- `label` -- `description` -- `placeholder` -- `aria-label` -- `title` -- `subTitle` -- `text` -- `tooltip` -- `message` -- `name` - -```tsx -// Bad ❌ -; - -// Good ✅ -const placeholder = t('form.username-placeholder', 'Username'); -return ; -``` - -Check more info about how translations work in Grafana in [Internationalization.md](https://github.com/grafana/grafana/blob/main/contribute/internationalization.md) - -### `no-translation-top-level` - -Ensure that `t()` translation method is not used at the top level of a file, outside of a component of method. -This is to prevent calling the translation method before it's been instantiated. - -This does not cause an error if a file is lazily loaded, but refactors can cause errors, and it can cause problems in tests. -Fix the - -```tsx -// Bad ❌ -const someTranslatedText = t('some.key', 'Some text'); -const SomeComponent = () => { - return
; -}; - -// Good ✅ -const SomeComponent = () => { - const someTranslatedText = t('some.key', 'Some text'); - return
; -}; - -// Bad ❌ -const someConfigThatHasToBeShared = [{ foo: t('some.key', 'Some text') }]; -const SomeComponent = () => { - return ( -
- {someConfigThatHasToBeShared.map((cfg) => { - return
{cfg.foo}
; - })} -
- ); -}; - -// Good ✅ -const someConfigThatHasToBeShared = () => [{ foo: t('some.key', 'Some text') }]; -const SomeComponent = () => { - const configs = someConfigThatHasToBeShared(); - return ( -
- {configs.map((cfg) => { - return
{cfg.foo}
; - })} -
- ); -}; -``` diff --git a/packages/grafana-eslint-rules/index.cjs b/packages/grafana-eslint-rules/index.cjs index c3f69b593e5..2babd165372 100644 --- a/packages/grafana-eslint-rules/index.cjs +++ b/packages/grafana-eslint-rules/index.cjs @@ -1,8 +1,6 @@ const noAriaLabelSelectors = require('./rules/no-aria-label-e2e-selectors.cjs'); const noBorderRadiusLiteral = require('./rules/no-border-radius-literal.cjs'); const noUnreducedMotion = require('./rules/no-unreduced-motion.cjs'); -const noUntranslatedStrings = require('./rules/no-untranslated-strings.cjs'); -const noTranslationTopLevel = require('./rules/no-translation-top-level.cjs'); const themeTokenUsage = require('./rules/theme-token-usage.cjs'); const noRestrictedImgSrcs = require('./rules/no-restricted-img-srcs.cjs'); @@ -12,8 +10,6 @@ module.exports = { 'no-aria-label-selectors': noAriaLabelSelectors, 'no-border-radius-literal': noBorderRadiusLiteral, 'theme-token-usage': themeTokenUsage, - 'no-untranslated-strings': noUntranslatedStrings, - 'no-translation-top-level': noTranslationTopLevel, 'no-restricted-img-srcs': noRestrictedImgSrcs, }, }; diff --git a/packages/grafana-i18n/package.json b/packages/grafana-i18n/package.json index e24446833ab..4bedfae9dcc 100644 --- a/packages/grafana-i18n/package.json +++ b/packages/grafana-i18n/package.json @@ -26,6 +26,10 @@ "./internal": { "import": "./src/internal/index.ts", "require": "./src/internal/index.ts" + }, + "./eslint-plugin": { + "import": "./src/eslint/index.cjs", + "require": "./src/eslint/index.cjs" } }, "publishConfig": { diff --git a/packages/grafana-i18n/src/eslint/README.md b/packages/grafana-i18n/src/eslint/README.md new file mode 100644 index 00000000000..4fb1abdf8f6 --- /dev/null +++ b/packages/grafana-i18n/src/eslint/README.md @@ -0,0 +1,185 @@ +# Grafana Internationalization ESLint Rules + +This package also contains custom i18n eslint rules for use within the Grafana codebase and plugins. + +## Rules + +### `no-untranslated-strings` + +Check if strings are marked for translation inside JSX Elements, in certain JSX props, and in certain object properties. + +### Options + +#### `forceFix` + +Allows specifying directories that, if the file is present within, then the rule will automatically fix the errors. This is primarily a workaround to allow for automatic mark up of new violations as the rule evolves. + +#### Example: + +```ts +{ + '@grafana/i18n/no-untranslated-strings': ['error', { forceFix: ['app/features/some-feature'] }], +} +``` + +#### `calleesToIgnore` + +Allows specifying regexes for methods that should be ignored when checking if object properties are untranslated. + +This is particularly useful to exclude references to properties such as `label` inside `css()` calls. + +#### Example: + +```ts +{ + '@grafana/i18n/no-untranslated-strings': ['error', { calleesToIgnore: ['^css$'] }], +} + +// The below would not be reported as an error +const foo = css({ + label: 'test', +}); + +// The below would still be reported as an error +const bar = { + label: 'test', +}; +``` + +#### JSXText + +```tsx +// Bad ❌ + + Copied + + +// Good ✅ + + Copied + +``` + +#### JSXAttributes + +```tsx +// Bad ❌ +
+ +// Good ✅ +
+``` + +#### Object properties + +```tsx +// Bad ❌ +const someConfig = { + label: 'Some label', +}; + +// Good ✅ +const getSomeConfig = () => ({ + label: t('some.key.label', 'Some label'), +}); +``` + +#### Passing variables to translations + +```tsx +// Bad ❌ +const SearchTitle = ({ term }) =>
Results for {term}
; + +// Good ✅ +const SearchTitle = ({ term }) => Results for {{ term }}; + +// Good ✅ (if you need to interpolate variables inside nested components) +const SearchTerm = ({ term }) => {term}; +const SearchTitle = ({ term }) => ( + + Results for + +); + +// Good ✅ (if you need to interpolate variables and additional translated strings inside nested components) +const SearchTitle = ({ term }) => ( + + Results for {'{{ myVariable }}'} and this translated text is also in green + +); +``` + +#### How to translate props or attributes + +This rule checks if a string is wrapped up by the `Trans` tag, or if certain props contain untranslated strings. +We ask for such props to be translated with the `t()` function. + +The below props are checked for untranslated strings: + +- `label` +- `description` +- `placeholder` +- `aria-label` +- `title` +- `subTitle` +- `text` +- `tooltip` +- `message` +- `name` + +```tsx +// Bad ❌ +; + +// Good ✅ +const placeholder = t('form.username-placeholder', 'Username'); +return ; +``` + +Check more info about how translations work in Grafana in [Internationalization.md](https://github.com/grafana/grafana/blob/main/contribute/internationalization.md) + +### `no-translation-top-level` + +Ensure that `t()` translation method is not used at the top level of a file, outside of a component of method. +This is to prevent calling the translation method before it's been instantiated. + +This does not cause an error if a file is lazily loaded, but refactors can cause errors, and it can cause problems in tests. + +```tsx +// Bad ❌ +const someTranslatedText = t('some.key', 'Some text'); +const SomeComponent = () => { + return
; +}; + +// Good ✅ +const SomeComponent = () => { + const someTranslatedText = t('some.key', 'Some text'); + return
; +}; + +// Bad ❌ +const someConfigThatHasToBeShared = [{ foo: t('some.key', 'Some text') }]; +const SomeComponent = () => { + return ( +
+ {someConfigThatHasToBeShared.map((cfg) => { + return
{cfg.foo}
; + })} +
+ ); +}; + +// Good ✅ +const getSomeConfigThatHasToBeShared = () => [{ foo: t('some.key', 'Some text') }]; +const SomeComponent = () => { + const configs = getSomeConfigThatHasToBeShared(); + return ( +
+ {configs.map((cfg) => { + return
{cfg.foo}
; + })} +
+ ); +}; +``` diff --git a/packages/grafana-i18n/src/eslint/index.cjs b/packages/grafana-i18n/src/eslint/index.cjs new file mode 100644 index 00000000000..9c3e4714a5f --- /dev/null +++ b/packages/grafana-i18n/src/eslint/index.cjs @@ -0,0 +1,9 @@ +const noUntranslatedStrings = require('./no-untranslated-strings/no-untranslated-strings.cjs'); +const noTranslationTopLevel = require('./no-translation-top-level/no-translation-top-level.cjs'); + +module.exports = { + rules: { + 'no-untranslated-strings': noUntranslatedStrings, + 'no-translation-top-level': noTranslationTopLevel, + }, +}; diff --git a/packages/grafana-eslint-rules/rules/no-translation-top-level.cjs b/packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.cjs similarity index 97% rename from packages/grafana-eslint-rules/rules/no-translation-top-level.cjs rename to packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.cjs index 2290a980cf1..bedb4105971 100644 --- a/packages/grafana-eslint-rules/rules/no-translation-top-level.cjs +++ b/packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.cjs @@ -7,7 +7,7 @@ const { ESLintUtils, AST_NODE_TYPES } = require('@typescript-eslint/utils'); */ const createRule = ESLintUtils.RuleCreator( - (name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-eslint-rules/README.md#${name}` + (name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-i18n/src/eslint/README.md#${name}` ); /** diff --git a/packages/grafana-eslint-rules/tests/no-translation-top-level.test.js b/packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.test.js similarity index 59% rename from packages/grafana-eslint-rules/tests/no-translation-top-level.test.js rename to packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.test.js index 88326b500d4..ab75478ce14 100644 --- a/packages/grafana-eslint-rules/tests/no-translation-top-level.test.js +++ b/packages/grafana-i18n/src/eslint/no-translation-top-level/no-translation-top-level.test.js @@ -1,8 +1,8 @@ import { RuleTester } from 'eslint'; -import noTranslationTopLevel from '../rules/no-translation-top-level.cjs'; +import noTranslationTopLevel from './no-translation-top-level.cjs'; -RuleTester.setDefaultConfig({ +const ruleTester = new RuleTester({ languageOptions: { ecmaVersion: 2018, sourceType: 'module', @@ -14,13 +14,11 @@ RuleTester.setDefaultConfig({ }, }); -const expectedErrorMessage = 'Do not use the t() function outside of a component or function'; - -const ruleTester = new RuleTester(); - +// @ts-ignore ruleTester.run('eslint no-translation-top-level', noTranslationTopLevel, { valid: [ { + name: 'invocation inside component', code: ` function Component() { return
{t('some.key', 'Some text')}
; @@ -28,31 +26,37 @@ function Component() { `, }, { + name: 'invocation inside function', code: `const foo = () => t('some.key', 'Some text');`, }, { - code: `const foo = ttt('some.key', 'Some text');`, + name: 'invocation inside class component', + code: `class Component { + render() { + return t('some.key', 'Some text'); + } + }`, }, { - code: `class Component { -render() { - return t('some.key', 'Some text'); -} -}`, + name: 'invocation of something not named t at top level', + code: `const foo = ttt('some.key', 'Some text');`, }, ], invalid: [ { + name: 'invocation at top level', code: `const thing = t('some.key', 'Some text');`, - errors: [{ message: expectedErrorMessage }], + errors: 1, }, { + name: 'invocation in array', code: `const things = [t('some.key', 'Some text')];`, - errors: [{ message: expectedErrorMessage }], + errors: 1, }, { + name: 'invocation in object', code: `const objectThings = [{foo: t('some.key', 'Some text')}];`, - errors: [{ message: expectedErrorMessage }], + errors: 1, }, ], }); diff --git a/packages/grafana-eslint-rules/rules/no-untranslated-strings.cjs b/packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.cjs similarity index 97% rename from packages/grafana-eslint-rules/rules/no-untranslated-strings.cjs rename to packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.cjs index c6f9d0cd177..91de4620060 100644 --- a/packages/grafana-eslint-rules/rules/no-untranslated-strings.cjs +++ b/packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.cjs @@ -18,7 +18,7 @@ const { const { ESLintUtils, AST_NODE_TYPES } = require('@typescript-eslint/utils'); const createRule = ESLintUtils.RuleCreator( - (name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-eslint-rules/README.md#${name}` + (name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-i18n/src/eslint/README.md#${name}` ); /** @@ -224,7 +224,10 @@ const noUntranslatedStrings = createRule({ // We don't want to report if the parent has a text node, // as we'd end up doing it twice. This makes it awkward for us to auto fix const parentHasText = parentHasChildren - ? parent.children.some((child) => child.type === AST_NODE_TYPES.JSXText && getNodeValue(child).trim()) + ? parent.children.some((child) => { + const childValue = getNodeValue(child).trim(); + return child.type === AST_NODE_TYPES.JSXText && childValue && !isStringNonAlphanumeric(childValue); + }) : false; if (untranslatedTextNodes.length && !parentHasText) { diff --git a/packages/grafana-eslint-rules/tests/no-untranslated-strings.test.js b/packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.test.js similarity index 98% rename from packages/grafana-eslint-rules/tests/no-untranslated-strings.test.js rename to packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.test.js index de6d3e4a608..8c5afef89bc 100644 --- a/packages/grafana-eslint-rules/tests/no-untranslated-strings.test.js +++ b/packages/grafana-i18n/src/eslint/no-untranslated-strings/no-untranslated-strings.test.js @@ -1,8 +1,17 @@ import { RuleTester } from 'eslint'; -import noUntranslatedStrings from '../rules/no-untranslated-strings.cjs'; +import noUntranslatedStrings from './no-untranslated-strings.cjs'; -RuleTester.setDefaultConfig({ +const filename = 'public/app/features/some-feature/nested/SomeFile.tsx'; + +const packageName = '@grafana/i18n'; + +const TRANS_IMPORT = `import { Trans } from '${packageName}';`; +const T_IMPORT = `import { t } from '${packageName}/internal';`; +const USE_TRANSLATE_IMPORT = `import { useTranslate } from '${packageName}';`; +const TRANS_AND_USE_TRANSLATE_IMPORT = `import { Trans, useTranslate } from '${packageName}';`; + +const ruleTester = new RuleTester({ languageOptions: { ecmaVersion: 2018, sourceType: 'module', @@ -14,17 +23,7 @@ RuleTester.setDefaultConfig({ }, }); -const filename = 'public/app/features/some-feature/nested/SomeFile.tsx'; - -const packageName = '@grafana/i18n'; - -const TRANS_IMPORT = `import { Trans } from '${packageName}';`; -const T_IMPORT = `import { t } from '${packageName}/internal';`; -const USE_TRANSLATE_IMPORT = `import { useTranslate } from '${packageName}';`; -const TRANS_AND_USE_TRANSLATE_IMPORT = `import { Trans, useTranslate } from '${packageName}';`; - -const ruleTester = new RuleTester(); - +//@ts-ignore ruleTester.run('eslint no-untranslated-strings', noUntranslatedStrings, { test: [], valid: [ @@ -212,6 +211,24 @@ const Foo = () =>
Untra ], }, + { + name: 'non-alphanumeric characters outside child element', + code: ` +const Foo = () => { + return ( + <> +
+ something untranslated but i'm a naughty dev and + I put a bunch of non-alphanumeric characters outside of the div +
+ .?!; + + ) +}`, + filename, + errors: 1, + }, + { name: 'Text inside JSXElement, not in a function', code: ` diff --git a/packages/grafana-eslint-rules/rules/translation-utils.cjs b/packages/grafana-i18n/src/eslint/no-untranslated-strings/translation-utils.cjs similarity index 100% rename from packages/grafana-eslint-rules/rules/translation-utils.cjs rename to packages/grafana-i18n/src/eslint/no-untranslated-strings/translation-utils.cjs diff --git a/packages/grafana-ui/src/components/Combobox/MultiCombobox.tsx b/packages/grafana-ui/src/components/Combobox/MultiCombobox.tsx index 5fb513f0d7b..ff5e51eb87c 100644 --- a/packages/grafana-ui/src/components/Combobox/MultiCombobox.tsx +++ b/packages/grafana-ui/src/components/Combobox/MultiCombobox.tsx @@ -267,7 +267,6 @@ export const MultiCombobox = (props: MultiComboboxPro ))} {selectedItems.length > visibleItems.length && ( - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} ... - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} getInternalRadius
- {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} getExternalRadius
diff --git a/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx b/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx index 4a38d9334b3..178a4276837 100644 --- a/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx +++ b/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx @@ -1,4 +1,4 @@ -/* eslint-disable @grafana/no-untranslated-strings */ +/* eslint-disable @grafana/i18n/no-untranslated-strings */ /** @jsxImportSource @emotion/react */ import { css, cx } from '@emotion/css'; import classnames from 'classnames'; diff --git a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx index ab36eabca9e..d33331a74cb 100644 --- a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx +++ b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx @@ -1,4 +1,4 @@ -/* eslint-disable @grafana/no-untranslated-strings */ +/* eslint-disable @grafana/i18n/no-untranslated-strings */ import { css, cx } from '@emotion/css'; import { useState } from 'react'; import * as React from 'react'; diff --git a/packages/grafana-ui/src/components/UsersIndicator/UsersIndicator.tsx b/packages/grafana-ui/src/components/UsersIndicator/UsersIndicator.tsx index 1c7988e6ffb..6ac131c2d0c 100644 --- a/packages/grafana-ui/src/components/UsersIndicator/UsersIndicator.tsx +++ b/packages/grafana-ui/src/components/UsersIndicator/UsersIndicator.tsx @@ -36,7 +36,7 @@ export const UsersIndicator = ({ users, onClick, limit = 4 }: UsersIndicatorProp {limitReached && ( {tooManyUsers - ? // eslint-disable-next-line @grafana/no-untranslated-strings + ? // eslint-disable-next-line @grafana/i18n/no-untranslated-strings '...' : `+${extraUsers}`} diff --git a/packages/grafana-ui/src/options/builder/axis.tsx b/packages/grafana-ui/src/options/builder/axis.tsx index 5031222cef4..f539a55a0fc 100644 --- a/packages/grafana-ui/src/options/builder/axis.tsx +++ b/packages/grafana-ui/src/options/builder/axis.tsx @@ -179,7 +179,7 @@ export const ScaleDistributionEditor = ({ value, onChange }: StandardEditorProps {type === ScaleDistribution.Symlog && ( { diff --git a/public/app/core/components/AppChrome/History/HistoryWrapper.tsx b/public/app/core/components/AppChrome/History/HistoryWrapper.tsx index 479580d6cfb..a0713e30055 100644 --- a/public/app/core/components/AppChrome/History/HistoryWrapper.tsx +++ b/public/app/core/components/AppChrome/History/HistoryWrapper.tsx @@ -139,7 +139,7 @@ function HistoryEntryAppView({ entry, isSelected, onClick }: ItemProps) { {breadcrumb.text}{' '} {index !== breadcrumbs.length - 1 - ? // eslint-disable-next-line @grafana/no-untranslated-strings + ? // eslint-disable-next-line @grafana/i18n/no-untranslated-strings '> ' : ''} diff --git a/public/app/features/actions/ActionVariablesEditor.tsx b/public/app/features/actions/ActionVariablesEditor.tsx index 9a5bf423f5a..20a8fd6e616 100644 --- a/public/app/features/actions/ActionVariablesEditor.tsx +++ b/public/app/features/actions/ActionVariablesEditor.tsx @@ -56,7 +56,7 @@ export const ActionVariablesEditor = ({ value, onChange }: Props) => { const variableTypeOptions: ComboboxOption[] = [ { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'string', value: ActionVariableType.String, }, diff --git a/public/app/features/admin/UpgradePage.tsx b/public/app/features/admin/UpgradePage.tsx index 9c921510ebb..d86d3f3091b 100644 --- a/public/app/features/admin/UpgradePage.tsx +++ b/public/app/features/admin/UpgradePage.tsx @@ -200,7 +200,7 @@ const FeatureListing = () => { - {/* eslint-disable @grafana/no-untranslated-strings */} + {/* eslint-disable @grafana/i18n/no-untranslated-strings */} @@ -216,7 +216,7 @@ const FeatureListing = () => { - {/* eslint-enable @grafana/no-untranslated-strings */} + {/* eslint-enable @grafana/i18n/no-untranslated-strings */} diff --git a/public/app/features/admin/ldap/LdapDrawer.tsx b/public/app/features/admin/ldap/LdapDrawer.tsx index a0130383458..afb8155f717 100644 --- a/public/app/features/admin/ldap/LdapDrawer.tsx +++ b/public/app/features/admin/ldap/LdapDrawer.tsx @@ -99,7 +99,7 @@ export const LdapDrawerComponent = ({ For a complete list of supported ciphers and TLS versions, refer to: {' '} - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} https://go.dev/src/crypto/tls/cipher_suites.go @@ -145,7 +145,7 @@ export const LdapDrawerComponent = ({ > { const OpeningBracket = () => {'{'}; const ClosingBracket = () => {'}'}; -// eslint-disable-next-line @grafana/no-untranslated-strings const Quote = () => "; const Equals = () => {'='}; diff --git a/public/app/features/alerting/unified/components/notification-policies/PromDurationDocs.tsx b/public/app/features/alerting/unified/components/notification-policies/PromDurationDocs.tsx index e13723fb314..79963f3fdaa 100644 --- a/public/app/features/alerting/unified/components/notification-policies/PromDurationDocs.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/PromDurationDocs.tsx @@ -39,7 +39,7 @@ export function PromDurationDocs() {
Multiple units combined
- {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} 1m30s, 2h30m20s, 1w2d
diff --git a/public/app/features/alerting/unified/components/receivers/editor/templateDataSuggestions.ts b/public/app/features/alerting/unified/components/receivers/editor/templateDataSuggestions.ts index 0aeb0684718..dcf75c73bd1 100644 --- a/public/app/features/alerting/unified/components/receivers/editor/templateDataSuggestions.ts +++ b/public/app/features/alerting/unified/components/receivers/editor/templateDataSuggestions.ts @@ -17,7 +17,7 @@ import { SuggestionDefinition } from './suggestionDefinition'; export function getGlobalSuggestions(monaco: Monaco): SuggestionDefinition[] { const kind = monaco.languages.CompletionItemKind.Field; - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ return [ { label: 'Alerts', @@ -39,14 +39,14 @@ export function getGlobalSuggestions(monaco: Monaco): SuggestionDefinition[] { { label: 'GroupKey', kind, detail: 'string' }, { label: 'TruncatedAlerts', kind, detail: 'integer' }, ]; - /* eslint-enable @grafana/no-untranslated-strings */ + /* eslint-enable @grafana/i18n/no-untranslated-strings */ } // Suggestions that are valid only in the scope of an alert (e.g. in the .Alerts loop) export function getAlertSuggestions(monaco: Monaco): SuggestionDefinition[] { const kind = monaco.languages.CompletionItemKind.Field; - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ return [ { label: { label: 'Status', detail: '(Alert)', description: 'string' }, @@ -148,26 +148,26 @@ export function getAlertSuggestions(monaco: Monaco): SuggestionDefinition[] { ), }, ]; - /* eslint-enable @grafana/no-untranslated-strings */ + /* eslint-enable @grafana/i18n/no-untranslated-strings */ } // Suggestions for .Alerts export function getAlertsSuggestions(monaco: Monaco): SuggestionDefinition[] { const kind = monaco.languages.CompletionItemKind.Field; - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ return [ { label: 'Firing', kind, detail: 'Alert[]' }, { label: 'Resolved', kind, detail: 'Alert[]' }, ]; - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-enable @grafana/i18n/no-untranslated-strings */ } // Suggestions for the KeyValue types export function getKeyValueSuggestions(monaco: Monaco): SuggestionDefinition[] { const kind = monaco.languages.CompletionItemKind.Field; - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ return [ { label: 'SortedPairs', kind, detail: '[]KeyValue' }, { label: 'Names', kind, detail: '[]string' }, @@ -178,7 +178,7 @@ export function getKeyValueSuggestions(monaco: Monaco): SuggestionDefinition[] { kind: monaco.languages.CompletionItemKind.Method, }, ]; - /* eslint-enable @grafana/no-untranslated-strings */ + /* eslint-enable @grafana/i18n/no-untranslated-strings */ } export const snippets = { diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx index ff75fa7fce0..27e57e9069c 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx @@ -39,7 +39,7 @@ export const SubformArrayField = ({
diff --git a/public/app/features/alerting/unified/components/rule-editor/AnnotationsStep.tsx b/public/app/features/alerting/unified/components/rule-editor/AnnotationsStep.tsx index ad78011828b..7035dc68d29 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AnnotationsStep.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AnnotationsStep.tsx @@ -182,7 +182,7 @@ const AnnotationsStep = () => { {...register(`annotations.${index}.value`)} placeholder={ isUrl - ? // eslint-disable-next-line @grafana/no-untranslated-strings + ? // eslint-disable-next-line @grafana/i18n/no-untranslated-strings 'https://' : (annotationField.key && t('alerting.annotations-step.placeholder-value-input', 'Enter a {{key}}...', { diff --git a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx index db8fee5792e..393639a820f 100644 --- a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx @@ -49,7 +49,7 @@ export const GroupAndNamespaceFields = ({ rulesSourceName }: Props) => { label={t('alerting.group-and-namespace-fields.namespace-picker-label-namespace', 'Namespace')} // Disable translations as we don't intend to use this dropdown longterm, // so avoiding us adding translations for the sake of it - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings description="Type to search for an existing namespace or create a new one" error={errors.namespace?.message} invalid={!!errors.namespace?.message} @@ -82,7 +82,7 @@ export const GroupAndNamespaceFields = ({ rulesSourceName }: Props) => { label={t('alerting.group-and-namespace-fields.group-picker-label-group', 'Group')} // Disable translations as we don't intend to use this dropdown longterm, // so avoiding us adding translations for the sake of it - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings description="Type to search for an existing group or create a new one" error={errors.group?.message} invalid={!!errors.group?.message} diff --git a/public/app/features/alerting/unified/components/rules/RuleDetails.tsx b/public/app/features/alerting/unified/components/rules/RuleDetails.tsx index eeee887a29e..f1c272cc3a4 100644 --- a/public/app/features/alerting/unified/components/rules/RuleDetails.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleDetails.tsx @@ -118,7 +118,7 @@ const EvaluationBehaviorSummary = ({ rule }: EvaluationBehaviorSummaryProps) => > @@ -138,7 +138,7 @@ const EvaluationBehaviorSummary = ({ rule }: EvaluationBehaviorSummaryProps) => > diff --git a/public/app/features/alerting/unified/components/rules/RulesTable.tsx b/public/app/features/alerting/unified/components/rules/RulesTable.tsx index 46406324d8b..6907ed2bef7 100644 --- a/public/app/features/alerting/unified/components/rules/RulesTable.tsx +++ b/public/app/features/alerting/unified/components/rules/RulesTable.tsx @@ -268,7 +268,7 @@ function useColumns( nextEvalInfo && ( diff --git a/public/app/features/alerting/unified/components/silences/SilencesFilter.tsx b/public/app/features/alerting/unified/components/silences/SilencesFilter.tsx index ee187b70381..7427d37535c 100644 --- a/public/app/features/alerting/unified/components/silences/SilencesFilter.tsx +++ b/public/app/features/alerting/unified/components/silences/SilencesFilter.tsx @@ -59,7 +59,7 @@ export const SilencesFilter = () => {
- {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
severity=critical, env=production
} diff --git a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx index f29a66f23b0..ec28ce958c5 100644 --- a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx +++ b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx @@ -332,7 +332,7 @@ function useColumns(alertManagerSourceName: string) { {Array.isArray(silencedAlerts) ? silencedAlerts.length - : // eslint-disable-next-line @grafana/no-untranslated-strings + : // eslint-disable-next-line @grafana/i18n/no-untranslated-strings '-'} ); diff --git a/public/app/features/alerting/unified/testSetup/plugins.ts b/public/app/features/alerting/unified/testSetup/plugins.ts index 09a9fb2b276..68c3b81944a 100644 --- a/public/app/features/alerting/unified/testSetup/plugins.ts +++ b/public/app/features/alerting/unified/testSetup/plugins.ts @@ -1,4 +1,3 @@ -/* eslint-disable @grafana/no-untranslated-strings */ import { PluginLoadingStrategy, PluginMeta, PluginType } from '@grafana/data'; import { AppPluginConfig, setPluginComponentsHook, setPluginLinksHook } from '@grafana/runtime'; import { SupportedPlugin } from 'app/features/alerting/unified/types/pluginBridges'; diff --git a/public/app/features/auth-config/fields.tsx b/public/app/features/auth-config/fields.tsx index d787f4c1be8..9541c95a381 100644 --- a/public/app/features/auth-config/fields.tsx +++ b/public/app/features/auth-config/fields.tsx @@ -433,13 +433,13 @@ export function fieldMap(provider: string): Record { ), multi: false, options: [ - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ { value: 'AutoDetect', label: 'AutoDetect' }, { value: 'InParams', label: 'InParams' }, { value: 'InHeader', label: 'InHeader' }, ], defaultValue: { value: 'AutoDetect', label: 'AutoDetect' }, - /* eslint-enable @grafana/no-untranslated-strings */ + /* eslint-enable @grafana/i18n/no-untranslated-strings */ }, tokenUrl: { label: tokenURLLabel, @@ -914,7 +914,7 @@ function orgMappingDescription(provider: string): string { function clientAuthenticationOptions(provider: string): Array> { // Other options are purposefully not translated - /* eslint-disable @grafana/no-untranslated-strings */ + /* eslint-disable @grafana/i18n/no-untranslated-strings */ switch (provider) { case 'azuread': return [ @@ -930,5 +930,5 @@ function clientAuthenticationOptions(provider: string): Array ({ const rect = moveable.getRect(); return ( - // eslint-disable-next-line @grafana/no-untranslated-strings
, React: Renderer) { const rect = moveable.getRect(); return ( - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings
{ // never shown to end user - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings return
FRAME!
; }, }; diff --git a/public/app/features/commandPalette/ResultItem.tsx b/public/app/features/commandPalette/ResultItem.tsx index b8e7924bc11..75e68b3b3d0 100644 --- a/public/app/features/commandPalette/ResultItem.tsx +++ b/public/app/features/commandPalette/ResultItem.tsx @@ -54,7 +54,6 @@ export const ResultItem = React.forwardRef( {!hasCommandOrLink(ancestor) && ( <> {ancestor.name} - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} )} diff --git a/public/app/features/commandPalette/actions/staticActions.ts b/public/app/features/commandPalette/actions/staticActions.ts index 7f4f7d0adb3..0c5fb88c9f5 100644 --- a/public/app/features/commandPalette/actions/staticActions.ts +++ b/public/app/features/commandPalette/actions/staticActions.ts @@ -103,7 +103,7 @@ function getGlobalActions(): CommandPaletteAction[] { ]; if (process.env.NODE_ENV === 'development') { - // eslint-disable @grafana/no-untranslated-strings + // eslint-disable @grafana/i18n/no-untranslated-strings const section = 'Dev tooling'; const currentState = currentMockApiState(); const mockApiAction = currentState ? 'Disable' : 'Enable'; @@ -128,7 +128,7 @@ function getGlobalActions(): CommandPaletteAction[] { togglePseudoLocale(); }, }); - // eslint-enable @grafana/no-untranslated-strings + // eslint-enable @grafana/i18n/no-untranslated-strings } return actions; diff --git a/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx b/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx index a0cc03080a7..c2216526e25 100644 --- a/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx +++ b/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx @@ -76,7 +76,7 @@ export const ConfigureCorrelationSourceForm = () => { {name} {i < variables.length - 1 - ? // eslint-disable-next-line @grafana/no-untranslated-strings + ? // eslint-disable-next-line @grafana/i18n/no-untranslated-strings ', ' : ''} diff --git a/public/app/features/correlations/Forms/TransformationEditorRow.tsx b/public/app/features/correlations/Forms/TransformationEditorRow.tsx index 3d2f8941af6..ffbe52c6ee6 100644 --- a/public/app/features/correlations/Forms/TransformationEditorRow.tsx +++ b/public/app/features/correlations/Forms/TransformationEditorRow.tsx @@ -138,7 +138,7 @@ const TransformationEditorRow = (props: Props) => { diff --git a/public/app/features/dashboard-scene/embedding/EmbeddedDashboardTestPage.tsx b/public/app/features/dashboard-scene/embedding/EmbeddedDashboardTestPage.tsx index 4a55f99d2e3..5accee2f31b 100644 --- a/public/app/features/dashboard-scene/embedding/EmbeddedDashboardTestPage.tsx +++ b/public/app/features/dashboard-scene/embedding/EmbeddedDashboardTestPage.tsx @@ -24,7 +24,7 @@ export function EmbeddedDashboardTestPage() { layout={PageLayoutType.Canvas} > {/* this is a test page, no need to translate */} - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} Internal url state: {state} diff --git a/public/app/features/dashboard-scene/settings/variables/VariableSetEditableElement.tsx b/public/app/features/dashboard-scene/settings/variables/VariableSetEditableElement.tsx index 74861227cd1..ecd76e213c1 100644 --- a/public/app/features/dashboard-scene/settings/variables/VariableSetEditableElement.tsx +++ b/public/app/features/dashboard-scene/settings/variables/VariableSetEditableElement.tsx @@ -80,7 +80,6 @@ function VariableList({ set }: { set: SceneVariableSet }) { // TODO fix keyboard a11y here // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
onEditVariable(variable)}> - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} ${variable.state.name}
} - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings placeholder="/.*-(?.*)-(?.*)-.*/" onBlur={onRegExChange} testId={selectors.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2} diff --git a/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.tsx b/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.tsx index 2332f44e778..92c56fedab7 100644 --- a/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.tsx +++ b/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.tsx @@ -246,7 +246,7 @@ export function Editor({ variable }: { variable: QueryVariable }) {
} - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings placeholder="/.*-(?.*)-(?.*)-.*/" onBlur={onRegExChange} testId={selectors.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2} diff --git a/public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx b/public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx index c0c417e1525..b5d20ed7a2a 100644 --- a/public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx @@ -106,7 +106,7 @@ export class TimePickerSettings extends PureComponent { - {/* eslint-disable-next-line @grafana/no-untranslated-strings*/} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings*/}
TODO mappings editor!
diff --git a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx b/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx index b1a25c37095..7213154c219 100644 --- a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx +++ b/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx @@ -191,10 +191,7 @@ export class ThresholdsEditor extends PureComponent { enableNamedColors={true} />
- {isPercent && ( - // eslint-disable-next-line @grafana/no-untranslated-strings -
%
- )} + {isPercent &&
%
}
} suffix={ diff --git a/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingEditRow.tsx b/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingEditRow.tsx index efc251c31cb..36cab7a6946 100644 --- a/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingEditRow.tsx +++ b/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingEditRow.tsx @@ -123,7 +123,7 @@ export function ValueMappingEditRow({ mapping, index, onChange, onRemove, onDupl const specialMatchOptions: Array> = [ { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'Null', value: SpecialValueMatch.Null, description: t( @@ -132,7 +132,7 @@ export function ValueMappingEditRow({ mapping, index, onChange, onRemove, onDupl ), }, { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'NaN', value: SpecialValueMatch.NaN, description: t( @@ -141,7 +141,7 @@ export function ValueMappingEditRow({ mapping, index, onChange, onRemove, onDupl ), }, { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'Null + NaN', value: SpecialValueMatch.NullAndNaN, description: t( @@ -150,7 +150,7 @@ export function ValueMappingEditRow({ mapping, index, onChange, onRemove, onDupl ), }, { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'True', value: SpecialValueMatch.True, description: t( @@ -159,7 +159,7 @@ export function ValueMappingEditRow({ mapping, index, onChange, onRemove, onDupl ), }, { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label: 'False', value: SpecialValueMatch.False, description: t( diff --git a/public/app/features/explore/ExploreRunQueryButton.tsx b/public/app/features/explore/ExploreRunQueryButton.tsx index 4de8501eb45..19e7a60d8e6 100644 --- a/public/app/features/explore/ExploreRunQueryButton.tsx +++ b/public/app/features/explore/ExploreRunQueryButton.tsx @@ -108,7 +108,7 @@ export function ExploreRunQueryButton({ runQuery(pane[0]); onClick?.(); }} - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings label={`${paneLabel}: ${buttonText.translation}`} disabled={isInvalid || pane[0] === undefined} /> diff --git a/public/app/features/explore/Logs/LogsMetaRow.tsx b/public/app/features/explore/Logs/LogsMetaRow.tsx index 15a63e1feeb..199a629e0e5 100644 --- a/public/app/features/explore/Logs/LogsMetaRow.tsx +++ b/public/app/features/explore/Logs/LogsMetaRow.tsx @@ -78,11 +78,11 @@ export const LogsMetaRow = memo( const downloadMenu = ( - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} download(DownloadFormat.Text)} /> - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} download(DownloadFormat.Json)} /> - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} download(DownloadFormat.CSV)} /> ); diff --git a/public/app/features/explore/TraceView/components/TracePageHeader/SpanFilters/SpanFilters.tsx b/public/app/features/explore/TraceView/components/TracePageHeader/SpanFilters/SpanFilters.tsx index 24a4f1b0d4b..17b8df6404a 100644 --- a/public/app/features/explore/TraceView/components/TracePageHeader/SpanFilters/SpanFilters.tsx +++ b/public/app/features/explore/TraceView/components/TracePageHeader/SpanFilters/SpanFilters.tsx @@ -216,7 +216,7 @@ export const SpanFilters = memo((props: SpanFilterProps) => { ariaLabel="Select min span duration" onChange={(val) => setSpanFiltersSearch({ ...search, from: val })} isInvalidError="Invalid duration" - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings placeholder="e.g. 100ms, 1.2s" width={18} value={search.from || ''} @@ -233,7 +233,7 @@ export const SpanFilters = memo((props: SpanFilterProps) => { ariaLabel="Select max span duration" onChange={(val) => setSpanFiltersSearch({ ...search, to: val })} isInvalidError="Invalid duration" - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings placeholder="e.g. 100ms, 1.2s" width={18} value={search.to || ''} diff --git a/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.tsx b/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.tsx index 5bd331e9c62..8beaf187127 100644 --- a/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.tsx +++ b/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.tsx @@ -157,7 +157,7 @@ export const TracePageHeader = memo((props: TracePageHeaderProps) => { )} {method && method.length > 0 && ( @@ -168,7 +168,7 @@ export const TracePageHeader = memo((props: TracePageHeaderProps) => { )} {status && status.length > 0 && ( diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx index b9d2abaddb6..cceb414dfdb 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx @@ -108,7 +108,11 @@ export default function AccordianLogs({ return (
- {arrow} Events ({logs.length}) + {arrow}{' '} + + Events + {' '} + ({logs.length}) {isOpen && (
diff --git a/public/app/features/explore/extensions/getExploreExtensionConfigs.tsx b/public/app/features/explore/extensions/getExploreExtensionConfigs.tsx index bb6037cc34e..9be348955cf 100644 --- a/public/app/features/explore/extensions/getExploreExtensionConfigs.tsx +++ b/public/app/features/explore/extensions/getExploreExtensionConfigs.tsx @@ -17,7 +17,7 @@ export function getExploreExtensionConfigs(): PluginExtensionAddedLinkConfig[] { return [ createAddedLinkConfig({ // This is called at the top level, so will break if we add a translation here 😱 - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings title: 'Add to dashboard', description: 'Use the query and panel from explore and create/add it to a dashboard', targets: [PluginExtensionPoints.ExploreToolbarAction], @@ -44,9 +44,9 @@ export function getExploreExtensionConfigs(): PluginExtensionAddedLinkConfig[] { }), createAddedLinkConfig({ // This is called at the top level, so will break if we add a translation here 😱 - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings title: 'Add correlation', - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings description: 'Create a correlation from this query', targets: [PluginExtensionPoints.ExploreToolbarAction], icon: 'link', diff --git a/public/app/features/invites/SignupInvited.tsx b/public/app/features/invites/SignupInvited.tsx index 0ee449c33b9..184e767555f 100644 --- a/public/app/features/invites/SignupInvited.tsx +++ b/public/app/features/invites/SignupInvited.tsx @@ -106,7 +106,7 @@ export const SignupInvitedPage = () => { label={t('invites.signup-invited-page.label-email', 'Email')} > { const styles = importStyles(this.props.theme); const GcomDashboardsLink = () => ( - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings grafana.com/dashboards diff --git a/public/app/features/migrate-to-cloud/shared/AlertWithTraceID.tsx b/public/app/features/migrate-to-cloud/shared/AlertWithTraceID.tsx index 6b3581c344a..09f5ba7f020 100644 --- a/public/app/features/migrate-to-cloud/shared/AlertWithTraceID.tsx +++ b/public/app/features/migrate-to-cloud/shared/AlertWithTraceID.tsx @@ -17,7 +17,7 @@ export function AlertWithTraceID(props: AlertWithTraceIDProps) { {traceID && ( /* Deliberately don't want to translate 'Trace ID' */ - /* eslint-disable-next-line @grafana/no-untranslated-strings */ + /* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */ Trace ID: {traceID} diff --git a/public/app/features/org/UserInviteForm.tsx b/public/app/features/org/UserInviteForm.tsx index 5fb9383a861..e79df23801f 100644 --- a/public/app/features/org/UserInviteForm.tsx +++ b/public/app/features/org/UserInviteForm.tsx @@ -79,7 +79,7 @@ export const UserInviteForm = () => { error={!!errors.loginOrEmail ? 'Email or username is required' : undefined} label={t('org.user-invite-form.label-email-or-username', 'Email or username')} > - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} diff --git a/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx b/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx index 6b61dd97fb4..c3be98741da 100644 --- a/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx +++ b/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx @@ -246,7 +246,7 @@ export function PluginDetailsPanel(props: Props): React.ReactElement | null { This feature is for reporting malicious or harmful behaviour within plugins. For plugin concerns, email us at:{' '} - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} integrations@grafana.com diff --git a/public/app/features/plugins/components/PluginPageContext.tsx b/public/app/features/plugins/components/PluginPageContext.tsx index 5c5673bc2d8..a3e9e6c1411 100644 --- a/public/app/features/plugins/components/PluginPageContext.tsx +++ b/public/app/features/plugins/components/PluginPageContext.tsx @@ -13,9 +13,9 @@ PluginPageContext.displayName = 'PluginPageContext'; function getInitialPluginPageContext(): PluginPageContextType { return { sectionNav: { - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings main: { text: 'Plugin page' }, - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings node: { text: 'Plugin page' }, }, }; diff --git a/public/app/features/plugins/extensions/utils.tsx b/public/app/features/plugins/extensions/utils.tsx index 7613ae537f4..e60cff38877 100644 --- a/public/app/features/plugins/extensions/utils.tsx +++ b/public/app/features/plugins/extensions/utils.tsx @@ -377,7 +377,7 @@ export function createExtensionSubMenu(extensions: PluginExtensionLink[]): Panel if (uncategorized.length > 0) { if (subMenu.length > 0) { subMenu.push({ - // eslint-disable-next-line @grafana/no-untranslated-strings + // eslint-disable-next-line @grafana/i18n/no-untranslated-strings text: 'divider', type: 'divider', }); diff --git a/public/app/features/provisioning/Shared/TokenPermissionsInfo.tsx b/public/app/features/provisioning/Shared/TokenPermissionsInfo.tsx index e0200190385..e59b3e2d200 100644 --- a/public/app/features/provisioning/Shared/TokenPermissionsInfo.tsx +++ b/public/app/features/provisioning/Shared/TokenPermissionsInfo.tsx @@ -10,7 +10,7 @@ export function TokenPermissionsInfo() { return (
{/* GitHub UI is English only, so these strings are not translated */} - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable @grafana/i18n/no-untranslated-strings */} Go to @@ -20,21 +20,22 @@ export function TokenPermissionsInfo() { "Fine-grained token". Make sure to include these permissions: + {/* eslint-enable @grafana/i18n/no-untranslated-strings */}
    - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
  • Content: Read and write
  • - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
  • Metadata: Read only
  • - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
  • Pull requests: Read and write
  • - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
  • Webhooks: Read and write
  • diff --git a/public/app/features/provisioning/Wizard/ProvisioningWizard.tsx b/public/app/features/provisioning/Wizard/ProvisioningWizard.tsx index 4ae04fd6ba5..90f562ca228 100644 --- a/public/app/features/provisioning/Wizard/ProvisioningWizard.tsx +++ b/public/app/features/provisioning/Wizard/ProvisioningWizard.tsx @@ -237,7 +237,6 @@ export function ProvisioningWizard({ type }: { type: RepoType }) { - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} {currentStepIndex + 1}. {currentStepConfig?.title} diff --git a/public/app/features/query/components/QueryEditorRowHeader.tsx b/public/app/features/query/components/QueryEditorRowHeader.tsx index 79c1cb76534..443f95b04f8 100644 --- a/public/app/features/query/components/QueryEditorRowHeader.tsx +++ b/public/app/features/query/components/QueryEditorRowHeader.tsx @@ -138,7 +138,6 @@ const renderDataSource = ( const { alerting, dataSource, onChangeDataSource } = props; if (!onChangeDataSource) { - // eslint-disable-next-line @grafana/no-untranslated-strings return ({dataSource.name}); } diff --git a/public/app/features/query/components/QueryGroupOptions.tsx b/public/app/features/query/components/QueryGroupOptions.tsx index 35baa0901bb..995f74c1608 100644 --- a/public/app/features/query/components/QueryGroupOptions.tsx +++ b/public/app/features/query/components/QueryGroupOptions.tsx @@ -169,7 +169,7 @@ export const QueryGroupOptionsEditor = React.memo(({ options, dataSource, data, { 'This is optional and is primarily used for allowing custom team avatars' )} > - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */} diff --git a/public/app/features/teams/TeamSettings.tsx b/public/app/features/teams/TeamSettings.tsx index 0d936c2f386..126a5cef78e 100644 --- a/public/app/features/teams/TeamSettings.tsx +++ b/public/app/features/teams/TeamSettings.tsx @@ -78,7 +78,7 @@ export const TeamSettings = ({ team, updateTeam }: Props) => { )} disabled={!canWriteTeamSettings} > - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} + {/* eslint-disable-next-line @grafana/i18n/no-untranslated-strings */}
Macros: - {/* eslint-disable @grafana/no-untranslated-strings */} + {/* eslint-disable @grafana/i18n/no-untranslated-strings */}
  • $__time(column) -> column AS time
  • $__timeEpoch(column) -> DATEDIFF(second, '1970-01-01', column) AS time
  • @@ -84,13 +84,13 @@ export function CheatSheet() {
  • $__unixEpochGroup(column,'5m') -> FLOOR(column/300)*300
  • $__unixEpochGroupAlias(column,'5m') -> FLOOR(column/300)*300 AS [time]
- {/* eslint-enable @grafana/no-untranslated-strings */} + {/* eslint-enable @grafana/i18n/no-untranslated-strings */}

Example of group by and order by with {'{{timeGroupMacro}}'}:

- {/* eslint-disable @grafana/no-untranslated-strings */} + {/* eslint-disable @grafana/i18n/no-untranslated-strings */}
         
           SELECT $__timeGroup(date_time_col, '1h') AS time, sum(value) as value 
@@ -102,11 +102,11 @@ export function CheatSheet() {
- {/* eslint-enable @grafana/no-untranslated-strings */} + {/* eslint-enable @grafana/i18n/no-untranslated-strings */} Or build your own conditionals using these macros which just return the values: - {/* eslint-disable @grafana/no-untranslated-strings */} + {/* eslint-disable @grafana/i18n/no-untranslated-strings */}
  • $__timeFrom() -> '2017-04-21T05:01:17Z'
  • $__timeTo() -> '2017-04-21T05:01:17Z'
  • @@ -115,7 +115,7 @@ export function CheatSheet() {
  • $__unixEpochNanoFrom() -> 1494410783152415214
  • $__unixEpochNanoTo() -> 1494497183142514872
- {/* eslint-enable @grafana/no-untranslated-strings */} + {/* eslint-enable @grafana/i18n/no-untranslated-strings */}
); } diff --git a/public/app/plugins/datasource/mssql/azureauth/AzureCredentialsForm.tsx b/public/app/plugins/datasource/mssql/azureauth/AzureCredentialsForm.tsx index 17d45809fcf..b5ba267fb56 100644 --- a/public/app/plugins/datasource/mssql/azureauth/AzureCredentialsForm.tsx +++ b/public/app/plugins/datasource/mssql/azureauth/AzureCredentialsForm.tsx @@ -180,7 +180,7 @@ export const AzureCredentialsForm = (props: Props) => { > { > { @@ -367,7 +367,7 @@ export const ConfigurationEditor = (props: DataSourcePluginOptionsEditorProps { @@ -207,7 +207,7 @@ export const KerberosAdvancedSettings = (props: DataSourcePluginOptionsEditorPro { persistAuthorization={false} /> )} - - {/* eslint-disable-next-line @grafana/no-untranslated-strings */} {!url?.value &&
...{/** TODO, we can make an api docs loading page here */}
}