@servicetitan/docs-uikit 36.1.1 → 36.2.0

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.
@@ -8,7 +8,7 @@ sidebar_position: 0
8
8
  ### [@servicetitan/startup](./startup/)
9
9
 
10
10
  - `mfe-publish` now throws an error instead of silently succeeding when the branch is not configured for publishing (without `--force`).
11
- If your CI workflow calls `mfe-publish` on an unconfigured branch, either add the branch to the `web-component.branches` configuration in `package.json`, or pass `--force` to bypass the check.
11
+ If your CI workflow calls `mfe-publish` on an unrecognized branch, either add the branch to the `web-component.branches` configuration in `package.json`, or pass `--force` to bypass the check.
12
12
 
13
13
  ## v35.0.0
14
14
 
@@ -19,7 +19,7 @@ sidebar_position: 0
19
19
 
20
20
  ### [@servicetitan/launchdarkly-service](./launchdarkly-service.mdx)
21
21
 
22
- - Added `mobx-react` peer dependency. If your project does not already depend on `mobx-react`, add version `~9.2.0`.
22
+ - Added `mobx-react` peer dependency. If your project does not already depend on `mobx-react`, add version `~9.2.0`.
23
23
 
24
24
  ## v34.0.0
25
25
 
@@ -87,6 +87,7 @@ Shared uikit skills for ServiceTitan repos.
87
87
 
88
88
  #### Skills
89
89
 
90
- | Name | Description |
91
- | :------------ | :---------------------------------------- |
92
- | `spell-check` | Check for spelling errors in code changes |
90
+ | Name | Description |
91
+ | :------------------ | :------------------------------------------------------------------------------------------------------- |
92
+ | `spell-check` | Check for spelling errors in code changes |
93
+ | `switching-to-pnpm` | Migrate a project from npm to pnpm (see [migration guide](/docs/frontend/switching-to-pnpm)) |
@@ -18,8 +18,12 @@ title: ESLint & Stylelint configurations
18
18
 
19
19
  ### ESLint
20
20
 
21
+ The ESLint config bundles rules from ESLint core, `eslint-plugin-import`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `typescript-eslint`, and Prettier, along with the ServiceTitan rules from `@servicetitan/eslint-plugin`. Pick the entry point that matches your repo layout.
22
+
21
23
  #### In the Lerna project
22
24
 
25
+ Use `mono` in a workspace-based monorepo. It discovers every workspace package at lint time and wires up `import/no-extraneous-dependencies` for each one, so imports are checked against both the package's own `package.json` and the repo root.
26
+
23
27
  ```js title="eslint.config.js"
24
28
  import { defineConfig } from 'eslint/config';
25
29
  import mono from '@servicetitan/eslint-config/mono';
@@ -29,6 +33,8 @@ export default defineConfig(mono);
29
33
 
30
34
  #### Without Lerna
31
35
 
36
+ Use `single` in a standalone project. It points the TypeScript parser at `./tsconfig.json` and skips the per-package dependency check.
37
+
32
38
  ```js title="eslint.config.js"
33
39
  import { defineConfig } from 'eslint/config';
34
40
  import single from '@servicetitan/eslint-config/single';
@@ -36,8 +42,80 @@ import single from '@servicetitan/eslint-config/single';
36
42
  export default defineConfig(single);
37
43
  ```
38
44
 
45
+ ### QA lint rules
46
+
47
+ The `qa` config adds lint rules that help keep user interfaces testable by automated suites. Apply it to component and feature files; test files themselves do not need it.
48
+
49
+ `qa` accepts a single optional options object of type `Omit<Linter.Config, 'name' \| 'plugins'>`.
50
+
51
+ #### Common options
52
+
53
+ The options object accepts any property from the ESLint [Linter.Config](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects) type. The properties below are the ones you are most likely to set.
54
+
55
+ | Name | Type | Description |
56
+ | :-------- | :--------- | :---------------------------------------------------------------------- |
57
+ | `files` | `string[]` | (optional) Glob patterns for files to lint. Defaults to `['**/*.tsx']`. |
58
+ | `rules` | `object` | (optional) Rule overrides, merged with the default rules. |
59
+ | `ignores` | `string[]` | (optional) Glob patterns for files to exclude. |
60
+
61
+ #### Rules
62
+
63
+ ##### `@servicetitan/qa/require-qa-attr`
64
+
65
+ Automated test suites such as Cypress target interactive elements through dedicated selector attributes like `data-cy`. When these attributes are missing, tests have to rely on brittle selectors (class names, text content, DOM position) that break whenever surrounding markup changes.
66
+
67
+ This rule requires a QA selector attribute on interactive elements so tests can target them reliably as the UI evolves. It reports an error in three cases.
68
+
69
+ **1. Interactive Anvil2 components.** The rule tracks imports from `@servicetitan/anvil2` and `@servicetitan/anvil2/beta`, then flags any of these components when rendered without a QA attribute. Aliased imports (for example, `Button as Btn`) resolve to the original export name before the check runs.
70
+
71
+ | Category | Components |
72
+ | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | Form inputs | `Checkbox`, `Radio`, `Switch`, `TextField`, `Textarea`, `NumberField`, `SearchField`, `TimeField`, `DateField`, `DateFieldRange`, `DateFieldSingle`, `DateFieldYearless`, `Calendar`, `Pagination` |
74
+ | Selection | `SelectCard`, `SegmentedControl`, `DaysOfTheWeek`, `SelectTrigger`, `Combobox.SearchField`, `Combobox.SelectTrigger` |
75
+ | Actions | `Button`, `ButtonToggle`, `Link`, `Toolbar.Button`, `Toolbar.ButtonToggle`, `Toolbar.ButtonLink`, `Toolbar.Select` |
76
+ | Navigation | `SideNavLink`, `SideNavCollapsible`, `SideNav.Link`, `SideNav.Collapsible`, `BreadcrumbsLink`, `Breadcrumbs.Link`, `Stepper.PrevButton`, `Stepper.NextButton`, `Stepper.Step` |
77
+ | Overlays, menus | `Menu`, `Menu.Item`, `Popover.Button`, `Popover.Close`, `Tab.Button`, `EditCard`, `Chip` |
78
+
79
+ **2. Direct children of `Tooltip.Trigger` or `Popover.Trigger`.** The trigger forwards interactions to its child, so the attribute belongs on the child element rather than the trigger itself.
80
+
81
+ **3. Any JSX element with an `onClick` handler.** This catches custom interactive elements that fall outside the Anvil2 component list, including native elements such as `div` or `span` that receive click handlers.
82
+
83
+ The rule skips elements that use JSX spread (`{...props}`), since the QA attribute or `onClick` handler may come from the spread object.
84
+
85
+ ###### Options
86
+
87
+ | Name | Type | Default | Description |
88
+ | :----------- | :--------- | :----------- | :------------------------------------------------------------------------------------- |
89
+ | `attributes` | `string[]` | `['data-cy']` | Acceptable attribute names. At least one must be present on the flagged element. |
90
+
91
+ The example below shows two ways to enable the rule. The first call uses the defaults and requires `data-cy`. The second call passes a `rules` override so the rule accepts `data-testid` instead, which is useful for projects that already use a different attribute convention.
92
+
93
+ ```js title="eslint.config.js"
94
+ import { defineConfig } from 'eslint/config';
95
+ import mono from '@servicetitan/eslint-config/mono';
96
+ import qa from '@servicetitan/eslint-config/qa';
97
+
98
+ // Default usage requires data-cy
99
+ export default defineConfig([mono, qa()]);
100
+
101
+ // Accept data-testid in place of data-cy
102
+ export default defineConfig([
103
+ mono,
104
+ qa({
105
+ rules: {
106
+ '@servicetitan/qa/require-qa-attr': ['error', { attributes: ['data-testid'] }],
107
+ },
108
+ }),
109
+ ]);
110
+ ```
111
+
39
112
  ### Stylelint
40
113
 
114
+ The Stylelint config extends [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard) and [`stylelint-prettier`](https://github.com/prettier/stylelint-prettier), applies the matching standard extensions for `.scss` and `.less` files, and adds two ServiceTitan rules:
115
+
116
+ - `@servicetitan/function-url-no-absolute` rejects absolute paths inside `url()` values.
117
+ - `@servicetitan/use-tokens` requires design tokens from `@servicetitan/tokens` for colors, spacing, border radii, font families and weights, line heights, opacities, type scales, and z-indexes, instead of raw values.
118
+
41
119
  ```json title=".stylelintrc.json"
42
120
  {
43
121
  "extends": ["@servicetitan/stylelint-config"]
@@ -0,0 +1,172 @@
1
+ ---
2
+ title: ESLint plugins
3
+ ---
4
+
5
+ #### [CHANGELOG (@servicetitan/eslint-plugin)](https://github.com/servicetitan/uikit/blob/master/packages/eslint-plugin/CHANGELOG.md)
6
+
7
+ `@servicetitan/eslint-plugin` contains custom ESLint rules for React, MobX, TypeScript, and testing best practices used across ServiceTitan frontend projects.
8
+ Rules are included in `@servicetitan/eslint-config` by default (except the QA rules), but can also be used separately if you want to apply them selectively.
9
+
10
+ ## Rules
11
+
12
+ ### Base rules
13
+
14
+ #### `@servicetitan/no-async-in-foreach`
15
+
16
+ Disallows passing async callbacks to `Array.forEach`. Async callbacks in `forEach` cause unhandled promise rejections because `forEach` ignores the returned promise. Use `reduce` for sequential execution or `Promise.all` with `.map` for parallel execution instead.
17
+
18
+ ```ts
19
+ // Bad
20
+ items.forEach(async item => {
21
+ await doSomething(item);
22
+ });
23
+
24
+ // Good
25
+ await items.reduce(async (promise, item) => {
26
+ await promise;
27
+ await doSomething(item);
28
+ }, Promise.resolve());
29
+ ```
30
+
31
+ #### `@servicetitan/use-declare-with-decorators`
32
+
33
+ Requires the `declare` keyword when using `@injectDependency` or `@koObservableToMobx` decorators on class fields. Without `declare`, TypeScript emits a class field initializer that overwrites the decorator's effect.
34
+
35
+ ```ts
36
+ // Bad
37
+ class MyService {
38
+ @injectDependency(OtherService)
39
+ private otherService: OtherService;
40
+ }
41
+
42
+ // Good
43
+ class MyService {
44
+ @injectDependency(OtherService)
45
+ declare private otherService: OtherService;
46
+ }
47
+ ```
48
+
49
+ ---
50
+
51
+ ### MobX rules
52
+
53
+ #### `@servicetitan/mobx/no-abstract-decorators`
54
+
55
+ Disallows MobX decorators (`@observable`, `@action`, `@computed`, `@override`) on abstract class fields or methods. Abstract members have no implementation, so MobX decorators have no effect on them.
56
+
57
+ ```ts
58
+ // Bad
59
+ abstract class BaseStore {
60
+ @observable abstract count: number;
61
+ }
62
+
63
+ // Good
64
+ abstract class BaseStore {
65
+ abstract count: number;
66
+ }
67
+ ```
68
+
69
+ #### `@servicetitan/mobx/use-makeObservable-with-decorators`
70
+
71
+ Requires a `makeObservable(this)` call in the constructor when a class uses MobX decorators. Without it, decorators are not activated at runtime.
72
+
73
+ ```ts
74
+ // Bad
75
+ class CounterStore {
76
+ @observable count = 0;
77
+ }
78
+
79
+ // Good
80
+ class CounterStore {
81
+ @observable count = 0;
82
+
83
+ constructor() {
84
+ makeObservable(this);
85
+ }
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ ### React rules
92
+
93
+ #### `@servicetitan/react/destructure-default-import`
94
+
95
+ Disallows importing the React default export (`import React from 'react'` or `import * as React from 'react'`). With modern JSX transform, the default import is unnecessary. Import only what you need.
96
+
97
+ ```ts
98
+ // Bad
99
+ import React from 'react';
100
+ import * as React from 'react';
101
+
102
+ // Good
103
+ import { useState, useEffect } from 'react';
104
+ ```
105
+
106
+ #### `@servicetitan/react/no-qualified-type`
107
+
108
+ Disallows using React types via the qualified name `React.XXX` in type annotations. Import specific types from `react` instead.
109
+
110
+ ```ts
111
+ // Bad
112
+ const MyComponent: React.FC = () => null;
113
+ const ref: React.RefObject<HTMLDivElement> = createRef();
114
+
115
+ // Good
116
+ import { FC, RefObject } from 'react';
117
+ const MyComponent: FC = () => null;
118
+ const ref: RefObject<HTMLDivElement> = createRef();
119
+ ```
120
+
121
+ ---
122
+
123
+ ### QA rules
124
+
125
+ #### `@servicetitan/qa/require-qa-attr`
126
+
127
+ Requires a QA selector attribute on interactive Anvil2 components and any JSX element with an `onClick` handler, so automated tests can reliably select them.
128
+
129
+ The rule tracks imports from `@servicetitan/anvil2` and `@servicetitan/anvil2/beta`. Elements with JSX spread attributes are skipped (the attribute may come from the spread).
130
+
131
+ By default the rule expects `data-cy`. Use the `attributes` option to accept a different attribute or a list of alternatives (the rule passes if any one is present):
132
+
133
+ ```js
134
+ '@servicetitan/qa/require-qa-attr': ['error', { attributes: ['data-testid'] }]
135
+ // or accept either:
136
+ '@servicetitan/qa/require-qa-attr': ['error', { attributes: ['data-cy', 'data-testid'] }]
137
+ ```
138
+
139
+ **Components that always require a QA selector attribute** (when imported from Anvil2):
140
+
141
+ | Category | Components |
142
+ | :----------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
143
+ | Form inputs | `Checkbox`, `Radio`, `Switch`, `TextField`, `Textarea`, `NumberField`, `SearchField`, `TimeField`, `DateField`, `DateFieldRange`, `DateFieldSingle`, `DateFieldYearless`, `Calendar`, `Pagination` |
144
+ | Selection | `SelectCard`, `SegmentedControl`, `DaysOfTheWeek`, `SelectTrigger` |
145
+ | Actions | `Button`, `ButtonToggle`, `Link` |
146
+ | Complex | `Menu`, `EditCard`, `Chip` |
147
+ | Standalone | `SideNavLink`, `SideNavCollapsible`, `BreadcrumbsLink` |
148
+ | Member expressions | `Popover.Button`, `Popover.Close`, `Menu.Item`, `Tab.Button`, `SideNav.Link`, `SideNav.Collapsible`, `Breadcrumbs.Link`, `Stepper.PrevButton`, `Stepper.NextButton`, `Stepper.Step`, `Toolbar.Button`, `Toolbar.ButtonToggle`, `Toolbar.ButtonLink`, `Toolbar.Select`, `Combobox.SearchField`, `Combobox.SelectTrigger` |
149
+
150
+ **Trigger children**: The direct child of `Tooltip.Trigger` or `Popover.Trigger` must also have a QA selector attribute, because automated tests interact with the child element.
151
+
152
+ **`onClick` fallback**: Any JSX element (including native DOM elements) with an `onClick` prop must have a QA selector attribute.
153
+
154
+ ```tsx
155
+ // Bad
156
+ import { Button, Tooltip } from '@servicetitan/anvil2';
157
+
158
+ <Button onClick={save} />
159
+ <Tooltip.Trigger>
160
+ <span>Hover me</span>
161
+ </Tooltip.Trigger>
162
+ <div onClick={handleClick} />
163
+
164
+ // Good
165
+ import { Button, Tooltip } from '@servicetitan/anvil2';
166
+
167
+ <Button data-cy="save-button" onClick={save} />
168
+ <Tooltip.Trigger>
169
+ <span data-cy="tooltip-trigger">Hover me</span>
170
+ </Tooltip.Trigger>
171
+ <div data-cy="clickable-area" onClick={handleClick} />
172
+ ```
package/docs/install.mdx CHANGED
@@ -7,7 +7,7 @@ import TabItem from '@theme/TabItem';
7
7
 
8
8
  #### [CHANGELOG (@servicetitan/install)](https://github.com/servicetitan/uikit/blob/master/packages/install/CHANGELOG.md)
9
9
 
10
- `@servicetitan/install` is a lightweight wrapper around `npm install` that automatically configures access to private ServiceTitan packages and runs `npm install` with ServiceTitan's standard options. Use it instead of plain `npm install` to guarantee that all packages are installed correctly and any necessary pre- and post-installation steps are performed.
10
+ `@servicetitan/install` is a lightweight wrapper that automatically configures access to private ServiceTitan packages and installs dependencies using your project's package manager. Use it instead of running your package manager directly to guarantee that all packages are installed correctly and any necessary pre- and post-installation steps are performed.
11
11
 
12
12
  ```sh
13
13
  npx --yes @servicetitan/install
@@ -22,12 +22,73 @@ The dedicated `@servicetitan/install` package performs a single task and runs qu
22
22
  And because it has no runtime dependencies, also eliminates risks from third-party changes.
23
23
  :::
24
24
 
25
+ ## Package Manager Support
26
+
27
+ `@servicetitan/install` supports both **npm** and **pnpm**. It reads the `cli.packageManager` field in your project's `package.json` to determine which package manager to use. When the field is absent, it defaults to npm.
28
+
29
+ ```json title="package.json"
30
+ {
31
+ "cli": {
32
+ "packageManager": "pnpm"
33
+ }
34
+ }
35
+ ```
36
+
37
+ :::note
38
+ The `npx --yes @servicetitan/install` command works regardless of which package manager your project uses. `npx` is only used to download and run the install CLI itself; the actual dependency installation uses whichever package manager is configured.
39
+ :::
40
+
41
+ ### pnpm support
42
+
43
+ ✨ New in **[INSERT-VERSION-HERE]** ✨
44
+
45
+ `@servicetitan/startup` includes experimental pnpm support. See the [Switching to pnpm](/docs/frontend/switching-to-pnpm) migration guide to get started.
46
+
47
+ :::caution
48
+ pnpm support is experimental. It has been validated against several internal repos but may require adjustments for your project. Please report any issues you encounter.
49
+ :::
50
+
25
51
  ## Options
26
52
 
27
- | Option | Description |
28
- | :----------- | :----------------------------------------------------------------------- |
29
- | `--no-token` | Only install dependencies. Don't configure the npm authentication token. |
30
- | `--token` | Only configure the npm authentication token. Don't install dependencies. |
53
+ | Option | Description |
54
+ | :------------------- | :--------------------------------------------------------------------------------------------------------------------- |
55
+ | `--allow-scripts` | Additional packages allowed to run install scripts. Accepts a comma-separated list or can be specified multiple times. |
56
+ | `--no-allow-scripts` | Disable all install scripts, including the default allowlist. |
57
+ | `--no-token` | Only install dependencies. Don't configure the npm authentication token. |
58
+ | `--token` | Only configure the npm authentication token. Don't install dependencies. |
59
+ | `--fix` | Update the lock file without installing packages. |
60
+
61
+ ## Install Script Protection (Preview)
62
+
63
+ In npm projects `@servicetitan/install` runs all install scripts by default. A future release will flip this default to block untrusted packages from running any install script (`preinstall`, `install`, and `postinstall`), protecting against supply chain attacks. To help teams prepare, `@servicetitan/install` warns about installed packages with untrusted install scripts:
64
+
65
+ ```
66
+ WARNING: The following packages have untrusted install scripts.
67
+ Review and add trusted packages to --allow-scripts:
68
+ - some-package@1.2.3
69
+ ```
70
+
71
+ :::caution
72
+ Audit each package in the warning. Verify it is trustworthy or remove the dependency.
73
+ :::
74
+
75
+ :::tip
76
+ Not sure what an install script does? Ask Claude: "What does the install script for _X_ do?". Claude reads the package source and summarizes the behavior, so you can decide whether to trust it.
77
+ :::
78
+
79
+ To disable all install scripts, including the default allowlist, use `--no-allow-scripts`:
80
+
81
+ ```sh
82
+ npx --yes @servicetitan/install --no-allow-scripts
83
+ ```
84
+
85
+ :::tip
86
+ `@servicetitan/install` checks for untrusted install scripts when the lockfile changes. If you see the warning after adding a new dependency, verify the package is trustworthy or remove it.
87
+ :::
88
+
89
+ ### Pnpm projects
90
+
91
+ pnpm blocks install scripts by default and emits a "Ignored build scripts" warning for packages whose scripts were skipped and must be approved.
31
92
 
32
93
  ## Configuring NPM Token in Development
33
94
 
@@ -79,6 +140,10 @@ RUN npm run build
79
140
  </TabItem>
80
141
  </Tabs>
81
142
 
143
+ :::tip
144
+ This step uses `npm config set` regardless of your project's package manager. Npm and pnpm read the same configuration for registry authentication.
145
+ :::
146
+
82
147
  ### Option 2: Use environment variable
83
148
 
84
149
  :::caution
@@ -41,6 +41,8 @@ and automatically [provides a store](#use-flags-in-mobx-store) that allows flag
41
41
  | `context` | `object` | (Optional) Context for targeting rules. Defaults to anonymous user. Use LaunchDarkly's [`identify`](https://docs.launchdarkly.com/sdk/features/identify) method to change the context after initialization. |
42
42
  | `waitForInitialization` | `boolean` | (Optional) Whether or not to wait until flags values are available before rendering children. Defaults to `true`. |
43
43
 
44
+ To configure additional [`LDOptions`](https://launchdarkly.github.io/js-client-sdk/interfaces/LDOptions.html) (for example, inspectors that forward flag evaluations to Datadog RUM), pass them to [`LDServiceProvider`](#ldserviceprovider) at the host level. They apply to every nested `LDProvider`.
45
+
44
46
  :::caution
45
47
  When a `context` is provided, only the initial value takes affect. Subsequent calls with the same client-side ID reuse the client that was created with the initial context.
46
48
 
@@ -142,9 +144,10 @@ export const HostApp: FC = () => {
142
144
 
143
145
  #### Props
144
146
 
145
- | Name | Type | Description |
146
- | :------------ | :-------------- | :--------------------------------------------------------------------- |
147
- | `application` | `LDApplication` | (Optional) Application and version details to provide to LaunchDarkly. |
147
+ | Name | Type | Description |
148
+ | :------------ | :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
149
+ | `application` | `LDApplication` | (Optional) Application and version details to provide to LaunchDarkly. |
150
+ | `options` | `Omit<LDOptions, 'application'>` | (Optional) Default [`LDOptions`](https://launchdarkly.github.io/js-client-sdk/interfaces/LDOptions.html) applied to every [`LDProvider`](#ldprovider) within the host. Set [`application`](#application) via the dedicated prop. |
148
151
 
149
152
  #### LDApplication
150
153
 
@@ -158,7 +161,7 @@ export interface LDApplication {
158
161
  Use `application` to make the application id and version available for flag evaluations in LaunchDarkly. Every LaunchDarkly client created by [LDProvider](#ldprovider) (within the host and within MFEs) will automatically pass through the application metadata to LaunchDarkly.
159
162
 
160
163
  :::caution
161
- `LDServiceProvider` should not be used in MFEs. If an MFE does use `LDServiceProvider`, the host's `application` overrides the MFE's.
164
+ `LDServiceProvider` should not be used in MFEs. If an MFE does use `LDServiceProvider`, the host's `application` and `options` override the MFE's.
162
165
  :::
163
166
 
164
167
  #### Example
@@ -177,6 +180,7 @@ The `LDService` interface enables [headless bundles](./microfrontends/developing
177
180
  export interface LDService {
178
181
  getClient: (config: ClientConfig) => LDClient;
179
182
  application?: LDApplication;
183
+ options?: Omit<LDOptions, 'application'>;
180
184
  }
181
185
 
182
186
  export interface ClientConfig {
@@ -200,6 +204,10 @@ Returns an `LDClient` instance configured with the following parameters.
200
204
 
201
205
  Optional [LDApplication](#ldapplication) that was passed to [LDServiceProvider](#ldserviceprovider).
202
206
 
207
+ #### options
208
+
209
+ Optional default `LDOptions` (excluding `application`) that were passed to [LDServiceProvider](#ldserviceprovider). Applied to every [LDProvider](#ldprovider) within the host.
210
+
203
211
  ### FeatureFlagStore
204
212
 
205
213
  `LDProvider` automatically provides a `FeatureFlagStore` that allows you to access
@@ -271,6 +279,43 @@ Render component when flag is on, and render other component when flag is turned
271
279
  <WithFeatureFlag flagKey={flagKey} on={() => 'Flag is ON'} off={() => 'Flag is OFF'} />
272
280
  ```
273
281
 
282
+ ### createDatadogInspector
283
+
284
+ `createDatadogInspector` creates an inspector that forwards feature flag evaluations to Datadog RUM via [`datadogRum.addFeatureFlagEvaluation`](https://docs.datadoghq.com/real_user_monitoring/feature_flag_tracking/?tab=browserrum). Register it once at the host via [`LDServiceProvider`](#ldserviceprovider)'s `options.inspectors`; every nested `LDProvider` picks it up automatically.
285
+
286
+ This helper requires `@datadog/browser-rum` as a peer dependency. It is available as a subpath import so it is only loaded when used:
287
+
288
+ ```tsx
289
+ import { createDatadogInspector } from '@servicetitan/launchdarkly-service/datadog-rum';
290
+ ```
291
+
292
+ #### Options
293
+
294
+ | Name | Type | Description |
295
+ | :----- | :------- | :--------------------------------------------------------------------------------------------------- |
296
+ | `name` | `string` | (Optional) Inspector name reported in LaunchDarkly logs. Defaults to `datadog-feature-flag-tracking`. |
297
+
298
+ #### Example
299
+
300
+ ```tsx title="host-app.tsx"
301
+ import { LDServiceProvider } from '@servicetitan/launchdarkly-service';
302
+ import { createDatadogInspector } from '@servicetitan/launchdarkly-service/datadog-rum';
303
+ import { FC, StrictMode } from 'react';
304
+
305
+ const datadogInspector = createDatadogInspector();
306
+
307
+ export const HostApp: FC = () => (
308
+ <StrictMode>
309
+ <LDServiceProvider
310
+ application={{ id: 'app', version: '71' }}
311
+ options={{ inspectors: [datadogInspector] }}
312
+ >
313
+ {...}
314
+ </LDServiceProvider>
315
+ </StrictMode>
316
+ );
317
+ ```
318
+
274
319
  ## Examples
275
320
 
276
321
  ### Using flag values in React component
@@ -5,7 +5,7 @@ title: clean
5
5
  Resets project workspace to a fresh state by clearing build caches and removing untracked files.
6
6
 
7
7
  It runs tools like `nx reset` and `jest --clearCache` to clear project and test
8
- caches, clears the npm and npx caches, and then uses `git clean -fdX` to delete
8
+ caches, clears the package manager and npx caches, and then uses `git clean -fdX` to delete
9
9
  all files ignored by Git (such as build outputs and temporary files).
10
10
 
11
11
  ```sh
@@ -12,7 +12,7 @@ This helps maintain consistency, avoid dependency hell, and enforce best practic
12
12
  npx startup review
13
13
  ```
14
14
 
15
- - Run from the root of your workspace (where your root `package.json` and `package-lock.json` are located).
15
+ - Run from the root of your workspace (where your root `package.json` and lock file are located).
16
16
  - The command will scan all packages (as defined by your workspace configuration) and report any errors or warnings found by the enabled rules.
17
17
 
18
18
  ---
@@ -20,7 +20,7 @@ npx startup review
20
20
  ## How It Works
21
21
 
22
22
  1. **Workspace Discovery**: Finds all packages in your monorepo using your workspace configuration.
23
- 2. **Dependency Analysis**: Builds a dependency graph and collects all installed versions from `package-lock.json`.
23
+ 2. **Dependency Analysis**: Builds a dependency graph and collects all installed versions from the lock file (`package-lock.json` or `pnpm-lock.yaml`).
24
24
  3. **Rule Execution**: Runs each enabled rule against your project and packages.
25
25
  4. **Reporting**: Outputs a summary of all problems found, grouped by file and severity.
26
26
 
@@ -37,7 +37,7 @@ npx startup review
37
37
  ## Troubleshooting
38
38
 
39
39
  - Make sure you run the command from the workspace root.
40
- - If you see unexpected results, check your configuration and ensure your `package-lock.json` is up to date.
40
+ - If you see unexpected results, check your configuration and ensure your lock file is up to date.
41
41
 
42
42
  ---
43
43
 
@@ -424,18 +424,20 @@ npm pkg set sideEffects=false -w @servicetitan/package
424
424
 
425
425
  ### require-npmrc
426
426
 
427
- Checks that your project contains a `.npmrc` file with `legacy-peer-deps=true`.
427
+ Checks that your project contains a `.npmrc` file with the following required and recommended settings:
428
428
 
429
429
  ```text title=".npmrc"
430
430
  legacy-peer-deps=true
431
431
  ```
432
432
 
433
- Setting `legacy-peer-deps=true` tells npm to use the older, more permissive peer dependency resolution algorithm (as in npm v6). This can help avoid installation failures when packages in your dependency tree have conflicting or unmet peer dependencies, which is common in large monorepos or when using older packages.
433
+ | Setting | Description |
434
+ | :----------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
435
+ | `legacy-peer-deps` | (Recommended) Tells npm to use the older, more permissive peer dependency resolution algorithm (as in npm v6). This can help avoid installation failures when packages in your dependency tree have conflicting or unmet peer dependencies, which is common in large monorepos or when using older packages. |
434
436
 
435
437
  #### ✅ Autofix
436
438
 
437
439
  This rule supports autofix.
438
- It creates or updates your `.npmrc` file to include `legacy-peer-deps=true`. E.g.,
440
+ It creates or updates your `.npmrc` file to include the missing settings. E.g.,
439
441
 
440
442
  ```sh
441
443
  npm config set --location=project legacy-peer-deps=true
@@ -536,24 +538,26 @@ To manually hoist packages to the root `node_modules`:
536
538
 
537
539
  Where `<name>` is the package name and `<version>` is the package version to hoist.
538
540
 
539
- 2. Update the `package-lock.json`:
541
+ 2. Update the lock file:
540
542
 
541
543
  ```sh
542
544
  npm install --legacy-peer-deps --package-lock-only --prefer-dedupe
543
545
  ```
544
546
 
545
- 3. Remove the package(s) from the root `package.json`. E.g.,
547
+ Or, for pnpm projects:
546
548
 
547
549
  ```sh
548
- npm pkg delete dependencies[<name>]
550
+ pnpm install --lockfile-only
549
551
  ```
550
552
 
551
- 4. Update `package-lock.json` a final time:
553
+ 3. Remove the package(s) from the root `package.json`. E.g.,
552
554
 
553
555
  ```sh
554
- npm install --legacy-peer-deps --package-lock-only --prefer-dedupe
556
+ npm pkg delete dependencies[<name>]
555
557
  ```
556
558
 
559
+ 4. Update the lock file a final time using the same command from step 2.
560
+
557
561
  ---
558
562
 
559
563
  ### require-tsconfig-references
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-uikit",
3
- "version": "36.1.1",
3
+ "version": "36.2.0",
4
4
  "description": "Documentation content for Uikit packages published at docs.st.dev",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "613ecdc5bb02a009292843c9674bcd18f408bcfa"
19
+ "gitHead": "87254b2caf60b20eb46c33b40ffb4dd05ad3e0f7"
20
20
  }