grafana/packages/grafana-eslint-rules
github-actions[bot] 3ae140cc19
Actionlint / Lint GitHub Actions files (push) Has been cancelled Details
Backend Unit Tests / Detect whether code changed (push) Has been cancelled Details
CodeQL checks / Analyze (actions) (push) Has been cancelled Details
CodeQL checks / Analyze (go) (push) Has been cancelled Details
CodeQL checks / Analyze (javascript) (push) Has been cancelled Details
Lint Frontend / Detect whether code changed (push) Has been cancelled Details
Verify i18n / verify-i18n (push) Has been cancelled Details
End-to-end tests / Detect whether code changed (push) Has been cancelled Details
Frontend tests / Detect whether code changed (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
publish-technical-documentation-release / sync (push) Has been cancelled Details
Reject GitHub secrets / reject-gh-secrets (push) Has been cancelled Details
Shellcheck / Shellcheck scripts (push) Has been cancelled Details
Swagger generated code / Verify committed API specs match (push) Has been cancelled Details
Dispatch sync to mirror / dispatch-job (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Backend Unit Tests / All backend unit tests complete (push) Has been cancelled Details
Lint Frontend / Lint (push) Has been cancelled Details
Lint Frontend / Typecheck (push) Has been cancelled Details
Lint Frontend / Betterer (push) Has been cancelled Details
End-to-end tests / Build & Package Grafana (push) Has been cancelled Details
End-to-end tests / Build E2E test runner (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (--flags="--env dashboardScene=false", e2e/old-arch/dashboards-suite, dashboards-suite (old arch)) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (--flags="--env dashboardScene=false", e2e/old-arch/panels-suite, panels-suite (old arch)) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (--flags="--env dashboardScene=false", e2e/old-arch/smoke-tests-suite, smoke-tests-suite (old arch)) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (--flags="--env dashboardScene=false", e2e/old-arch/various-suite, various-suite (old arch)) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (e2e/dashboards-suite, dashboards-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (e2e/panels-suite, panels-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (e2e/smoke-tests-suite, smoke-tests-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (e2e/various-suite, various-suite) (push) Has been cancelled Details
End-to-end tests / A11y test (push) Has been cancelled Details
End-to-end tests / All E2E tests complete (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (1) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (2) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (3) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (4) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (5) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (6) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (7) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (8) (push) Has been cancelled Details
Frontend tests / All frontend unit tests complete (push) Has been cancelled Details
Integration Tests / All backend integration tests complete (push) Has been cancelled Details
Release: 12.1.1 (#109625)
* Update changelog

* Update version to 12.1.1

* baldm0mma/ update version to 12.1.2

---------

Co-authored-by: grafana-delivery-bot[bot] <grafana-delivery-bot[bot]@users.noreply.github.com>
Co-authored-by: jev forsberg <jev.forsberg@grafana.com>
2025-08-13 11:53:51 -06:00
..
rules Storybook: Rearrange and tidy stories (#107270) 2025-07-08 12:37:09 +00:00
tests Storybook: Rearrange and tidy stories (#107270) 2025-07-08 12:37:09 +00:00
LICENSE_APACHE2
README.md Storybook: Rearrange and tidy stories (#107270) 2025-07-08 12:37:09 +00:00
index.cjs Storybook: Rearrange and tidy stories (#107270) 2025-07-08 12:37:09 +00:00
package.json Release: 12.1.1 (#109625) 2025-08-13 11:53:51 -06:00
project.json Build: Nx improvements (#88341) 2024-10-15 14:25:45 +02:00
tsconfig.json Chore: Fix custom eslint rule typechecking (#85886) 2024-04-10 17:12:31 +01:00

README.md

Grafana ESLint Rules

This package contains custom eslint rules for use within the Grafana codebase only. They're extremely specific to our codebase, and are of little use to anyone else. They're not published to NPM, and are consumed through the Yarn workspace.

Rules

no-aria-label-selectors

Require aria-label JSX properties to not include selectors from the @grafana/e2e-selectors package.

Previously we hijacked the aria-label property to use as E2E selectors as an attempt to "improve accessibility" while making this easier for testing. However, this lead to many elements having poor, verbose, and unnecessary labels.

Now, we prefer using data-testid for E2E selectors.

no-border-radius-literal

Check if border-radius theme tokens are used.

To improve the consistency across Grafana we encourage devs to use tokens instead of custom values. In this case, we want the borderRadius to use the appropriate token such as theme.shape.radius.default, theme.shape.radius.pill or theme.shape.radius.circle.

Instead of using 0 to remove a previously set border-radius, use unset.

no-unreduced-motion

Avoid direct use of animation* or transition* properties.

To account for users with motion sensitivities, these should always be wrapped in a prefers-reduced-motion media query.

There is a handleMotion utility function exposed on the theme that can help with this.

Examples

// Bad ❌
const getStyles = (theme: GrafanaTheme2) => ({
  loading: css({
    animationName: rotate,
    animationDuration: '2s',
    animationIterationCount: 'infinite',
  }),
});

// Good ✅
const getStyles = (theme: GrafanaTheme2) => ({
  loading: css({
    [theme.transitions.handleMotion('no-preference')]: {
      animationName: rotate,
      animationDuration: '2s',
      animationIterationCount: 'infinite',
    },
    [theme.transitions.handleMotion('reduce')]: {
      animationName: pulse,
      animationDuration: '2s',
      animationIterationCount: 'infinite',
    },
  }),
});

// Good ✅
const getStyles = (theme: GrafanaTheme2) => ({
  loading: css({
    '@media (prefers-reduced-motion: no-preference)': {
      animationName: rotate,
      animationDuration: '2s',
      animationIterationCount: 'infinite',
    },
    '@media (prefers-reduced-motion: reduce)': {
      animationName: pulse,
      animationDuration: '2s',
      animationIterationCount: 'infinite',
    },
  }),
});

Note we've switched the potentially sensitive rotating animation to a less intense pulse animation when prefers-reduced-motion is set.

Animations that involve only non-moving properties, like opacity, color, and blurs, are unlikely to be problematic. In those cases, you still need to wrap the animation in a prefers-reduced-motion media query, but you can use the same animation for both cases:

// Bad ❌
const getStyles = (theme: GrafanaTheme2) => ({
  card: css({
    transition: theme.transitions.create(['background-color'], {
      duration: theme.transitions.duration.short,
    }),
  }),
});

// Good ✅
const getStyles = (theme: GrafanaTheme2) => ({
  card: css({
    [theme.transitions.handleMotion('no-preference', 'reduce')]: {
      transition: theme.transitions.create(['background-color'], {
        duration: theme.transitions.duration.short,
      }),
    },
  }),
});

// Good ✅
const getStyles = (theme: GrafanaTheme2) => ({
  card: css({
    '@media (prefers-reduced-motion: no-preference), @media (prefers-reduced-motion: reduce)': {
      transition: theme.transitions.create(['background-color'], {
        duration: theme.transitions.duration.short,
      }),
    },
  }),
});

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!

consistent-story-titles

Enforce consistent Storybook titles in .story.tsx files.

Storybook titles should not contain more than one / for sections (resulting in maximum 2 parts), unless one of the sections is 'Deprecated'. This helps maintain a clean and organized Storybook structure.

Examples

// Bad ❌
export default { title: 'Components/Forms/Button' };

// Good ✅
export default { title: 'Components/Button' };

// Good ✅ - Deprecated allows any number of sections
export default { title: 'Components/Deprecated/Forms/Button/Extra' };

// Good ✅ - Variable assignment pattern
const storyConfig = { title: 'Components/Button' };
export default storyConfig;

// Bad ❌ - Variable assignment with too many sections
const storyConfig = { title: 'Components/Forms/Button' };
export default storyConfig;