Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions devin_lifeguard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
rules:
- name: localize-messages
trigger: >-
when adding user-facing text or aria-label attributes, ensure the
strings are localized

for example: aria-label="Expand" should instead use formatMessage(...)
solution: >-
wrap any user-visible string in formatMessage from useIntl so that it can
be properly localized

e.g. aria-label={formatMessage(messages.someLabel)}
- name: use-intl-hook
trigger: >-
when a component imports or uses injectIntl from 'react-intl' instead of
using useIntl
solution: >-
remove injectIntl usage and refactor the component to use useIntl
directly. for example:

import { useIntl } from 'react-intl';

const { formatMessage } = useIntl();
- name: use-blueprint-tokens
trigger: >-
when adding or modifying styles, if numeric px values are used, prefer
blueprint tokens
solution: |-
avoid hard-coded px. use blueprint tokens (e.g. $space-2, $space-3) or
existing scss variables for consistent theming
- name: testing-literal-strings
trigger: >-
when writing tests for localized text, if the code checks against a
variable reference or message ID, the test won't fail if the translation
changes.
solution: >-
use the literal translated string in the test assertion so that the test
accurately fails when the copy changes, for example getByRole('button', {
name: 'Choose' }) instead of referencing a variable or ID.
- name: match-peer-and-dev-deps
trigger: >-
mismatch in version constraints for peerDependencies and devDependencies
for the same library
solution: >-
ensure that the peerDependencies version matches devDependencies version
to avoid unexpected version conflicts
- name: avoid-data-testid
trigger: >-
when writing tests, if there's a role or accessible label or text
available, data-testid should be avoided to ensure we test the actual
accessibility.
solution: >-
use queries like getByRole, getByLabelText, or getByText with the actual
user-facing string or aria-label. Only use test IDs as a last resort.