Commit Graph

27 Commits

Author SHA1 Message Date
Tom Ratcliffe a243259063
Chore: Fix e2e-selectors eslint rule to check for `startsWith` (#111733) 2025-09-29 16:02:34 +01:00
Josh Hunt a9e70d4a1d
Storybook: Rearrange and tidy stories (#107270)
* Tidy up storybook a little bit

* change sort order, delete some stories

* More tidy up of actions

* More tidy up of actions

* tweak story sorting, again

* Make all internal stories public

* fix sort

* Add ESLint rule to enforce storybook titles

* update verify storybook test

* simplify glob
2025-07-08 12:37:09 +00:00
Josh Hunt 443ea5924c
Eslint: Allow 'unset' in no-border-radius-literal lint rule (#106619)
* allow border radius of 0

* Prefer unset or initial over 0

* readme

* add an autofix for 0 -> unset

* replace 0 with unset

* fix fixes tests

* fix snapshot

* Fix lint in SecretFormField

* fix unused cx
2025-07-04 15:43:48 +01:00
Tom Ratcliffe abb885c585
I18n: Move eslint rule to package (#105860) 2025-05-29 16:11:59 +02:00
Tom Ratcliffe 7bfa78c6e6
I18n: Update eslint rule to catch some untranslated object properties (#105072) 2025-05-28 21:14:43 +01:00
Tom Ratcliffe c2ebb9cbbf
i18n: Update lint rule suggested import location to `@grafana/i18n` (#105091) 2025-05-19 15:00:15 +01:00
Tom Ratcliffe 8f17f607fa
FEMT: Add `no-restricted-img-srcs` rule (#105006) 2025-05-12 10:34:17 +01:00
Ashley Harrison 1c5545da04
Internationalisation: Check and mark up tooltip content prop (#104536)
* make lint rule check for "content"

* undo unnecessary translation
2025-04-30 14:40:15 +01:00
Ashley Harrison b56a4a5295
Border radius: Improve rule and fix remaining violations (#104569)
* improve rule and fix remaining borderRadius violations

* prettier

* Add test case for nested classes

* Fix unnecessary string wrapping

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2025-04-30 14:03:54 +01:00
Tom Ratcliffe 8161e52061
i18n: Improve how ternary cases are captured as untranslated text (#104034) 2025-04-15 14:07:23 +01:00
Tom Ratcliffe eac312753f
Internationalization: Update translation rule to catch ternary cases (#104027) 2025-04-15 12:25:41 +01:00
Tom Ratcliffe 754c0e1534
Internationalisation: Check if strings are entirely non-alphanumeric before reporting as issues (#103900) 2025-04-14 13:24:47 +00:00
Tom Ratcliffe d2b8994d80
Chore: Make sure we run prettier on cjs files (#103903) 2025-04-14 13:24:45 +01:00
Ashley Harrison c83c486c9b
Internationalisation: Lint rule improvement (#103788)
* improve autofix so it can fix foo={"bar"}

* apply fixes

* fix type checks + betterer

* tweak to make types happy
2025-04-10 16:22:52 +01:00
Tom Ratcliffe 85a3ae2d07
Chore: Add heuristic approach to fixing untranslated text with eslint rule (#101561)
* Add heuristic approach to fixing untranslated text with eslint rule

* Update logic of how we track and report untranslated strings so we can prevent autofixes

* Update betterer to reflect different reporting of untranslated text

* Move logic for rule to utils and change to suggest instead of fix

* Update tests to cope with suggest instead of fix

* Remove commented out `only`

* Add config to allow force fixing

* Fix type errors and improve shouldFix logic
2025-03-13 13:17:05 +00:00
Tom Ratcliffe ac0fd38183
Chore: Add new `no-translation-top-level` eslint rule (#101550) 2025-03-04 15:42:37 +02:00
Tom Ratcliffe 1ba9a27f70
Chore: Update `no-untranslated-strings` to check tooltip and template literals (#98281) 2025-01-10 16:26:03 +00:00
Tom Ratcliffe a9cd0f19f4
Chore: Update `no-untranslated-strings` rule to check some text props as well (#97190)
* Update no-untranslated-strings rule to check some props as well

* Update betterer with new no-untranslated-strings results
2024-12-13 12:04:00 +02:00
Jack Westbrook 8c41137bcf
Frontend: Update to Eslint 9 (#94823)
* chore(eslint): bump all eslint related packages to latest

* chore(eslint): update linting scripts work with v9

* chore(eslint): introduce flat config

* chore(eslint): delete legacy configs

* feat(grafana-eslint-rules): update rules to use eslint 9 APIs

* chore(eslint): migrate all nested eslintrc files over to root config

* chore(packages): bump eslint dependencies

* feat(betterer): make it work with eslint 9

* style(grafana-data): remove non-existant ban-types rule from disable declarations

* chore(wip): [wip] link eslint-config-grafana

* chore(packages): add @eslint/compat

* chore(eslint): add compat to testing library and fix alerting rules

* chore(eslint): bump grafana eslint-config to v8

* chore(explore): delete legacy eslint config

* chore: clean codeowners file, remove grafana/eslint-config from e2e plugins

* test(eslint-rules): fix no-border-radius-literal and no-aria-label-e2e-selectors rule tests

* Add .js to prettier checks so new eslint.config.js file isn't missed

* chore(eslint): move emotion/syntax-preference to grafana/defaults

* test(eslint): use core-js structured-clone

* revert(services): undo merge backend-format githook changes

* test(eslint-rules): remove structured-clone polyfill from tests

* chore(eslint): add back public/lib/monaco to ignore list, sort alphabetically

* chore(e2e-plugins): remove eslint config 7 from plugins package.json

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2024-11-07 16:31:06 +01:00
Ashley Harrison 9f95841c45
Chore: Fix typo in lint rule file name (#88662)
rename file
2024-06-04 12:08:37 +03:00
Laura Fernández a47e71fd34
Chore: create the `no-untranslated-literals` rule (#88271) 2024-05-29 13:03:59 +02:00
Ashley Harrison c151a97110
Chore: Enable `no-unreduced-motion` and fix errors (#86572)
* enable `no-unreduced-motion` in betterer

* move all animation calls inside handleReducedMotion

* fix violations + enable rule

* update rule README

* remove unnecessary transition from <Collapse>

* remove handleReducedMotion utility and add handleMotion to theme

* update to use new theme value

* handle Dropdown and IconButton

* handle AppChromeMenu and update lint message

* keep rotation at a reduced speed

* handle DashboardLoading
2024-04-29 13:12:36 +01:00
Ashley Harrison 5e74b6962b
Chore: Add lint rule for `no-unreduced-motion` (#85862)
* add lint rule for no-unreduced-motion

* update to satisfy types
2024-04-15 09:18:56 +01:00
Josh Hunt 7aac5f6b3e
Chore: Fix custom eslint rule typechecking (#85886) 2024-04-10 17:12:31 +01:00
Laura Fernández 7469f58709
GLDS: Check if tokens are used as borderRadius values (#71187) 2023-08-01 12:44:25 +02:00
Ashley Harrison ae4810f854
Chore: Emit theme token usage metrics (#72500)
* create rule to find instances of theme variables

* emit theme token usage metrics

* move awking into script

* make sure theme usage is covering ts and tsx files, remove commented lines
2023-07-28 17:08:02 +03:00
Josh Hunt 959c89793f
Chore: eslint rule for preventing e2e selectors in aria-label (#59731)
* Create eslint plugin/rule for catching e2e selectors in aria-label

* Add no-aria-label-e2e-selectors to betterer

* chore: skip levitate for the `grafana-eslint-rules` package

* Fix rule

* Add readme

* Add Apache 2 license

* Typecheck using @typescript-eslint/utils

* actually export the rule

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
2023-01-18 15:02:35 +00:00