box-ui-elements 22.1.0-beta.60 → 22.1.0-beta.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ rules:
2
+ - name: localize-messages
3
+ trigger: >-
4
+ when adding user-facing text or aria-label attributes, ensure the
5
+ strings are localized
6
+
7
+ for example: aria-label="Expand" should instead use formatMessage(...)
8
+ solution: >-
9
+ wrap any user-visible string in formatMessage from useIntl so that it can
10
+ be properly localized
11
+
12
+ e.g. aria-label={formatMessage(messages.someLabel)}
13
+ - name: use-intl-hook
14
+ trigger: >-
15
+ when a component imports or uses injectIntl from 'react-intl' instead of
16
+ using useIntl
17
+ solution: >-
18
+ remove injectIntl usage and refactor the component to use useIntl
19
+ directly. for example:
20
+
21
+ import { useIntl } from 'react-intl';
22
+
23
+ const { formatMessage } = useIntl();
24
+ - name: use-blueprint-tokens
25
+ trigger: >-
26
+ when adding or modifying styles, if numeric px values are used, prefer
27
+ blueprint tokens
28
+ solution: |-
29
+ avoid hard-coded px. use blueprint tokens (e.g. $space-2, $space-3) or
30
+ existing scss variables for consistent theming
31
+ - name: testing-literal-strings
32
+ trigger: >-
33
+ when writing tests for localized text, if the code checks against a
34
+ variable reference or message ID, the test won't fail if the translation
35
+ changes.
36
+ solution: >-
37
+ use the literal translated string in the test assertion so that the test
38
+ accurately fails when the copy changes, for example getByRole('button', {
39
+ name: 'Choose' }) instead of referencing a variable or ID.
40
+ - name: match-peer-and-dev-deps
41
+ trigger: >-
42
+ mismatch in version constraints for peerDependencies and devDependencies
43
+ for the same library
44
+ solution: >-
45
+ ensure that the peerDependencies version matches devDependencies version
46
+ to avoid unexpected version conflicts
47
+ - name: avoid-data-testid
48
+ trigger: >-
49
+ when writing tests, if there's a role or accessible label or text
50
+ available, data-testid should be avoided to ensure we test the actual
51
+ accessibility.
52
+ solution: >-
53
+ use queries like getByRole, getByLabelText, or getByText with the actual
54
+ user-facing string or aria-label. Only use test IDs as a last resort.