# useQwikValidLexicalScope

Rule `biome/useQwikValidLexicalScope`. Disallow unserializable expressions in Qwik dollar ($) scopes.

- Source: biome
- Technologies: Qwik, React
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #602 by reach, #237 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `correctness/useQwikValidLexicalScope` | yes | no | group correctness, since 2.2.6 | [docs](https://biomejs.dev/linter/rules/use-qwik-valid-lexical-scope/) |

## Code examples

### Incorrect: the rule reports this

```js
// Arrow function assigned without wrapping it in $(...)
const handleClick = () => {
  console.log("clicked");
};
```

### Correct: the rule accepts this

```js
const handleClick = $(() => {
  // Valid: only using serializable variables or props
  console.log("clicked");
});
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "useQwikValidLexicalScope": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/useQwikMethodUsage](https://lintradar.dev/rules/biome/useQwikMethodUsage.md): Disallow `use*` hooks outside of `component$` or other `use*` hooks in Qwik applications.
- [biome/useReactAsyncServerFunction](https://lintradar.dev/rules/biome/useReactAsyncServerFunction.md): Require functions with the "use server" directive to be async.
- [biome/useQwikLoaderLocation](https://lintradar.dev/rules/biome/useQwikLoaderLocation.md): Enforce that Qwik loader functions are declared in the correct location.
- [biome/useReactNativePlatformComponents](https://lintradar.dev/rules/biome/useReactNativePlatformComponents.md): Ensure that platform-specific React Native components are only imported in files named for that platform.
- [biome/useQwikClasslist](https://lintradar.dev/rules/biome/useQwikClasslist.md): Prefer using the `class` prop as a classlist over the `classnames` helper.
- [biome/useReactNativeValidPlatformColors](https://lintradar.dev/rules/biome/useReactNativeValidPlatformColors.md): Require `PlatformColor()` and `DynamicColorIOS()` calls to use values written directly in the call.

---

Web page: https://lintradar.dev/rules/biome/useQwikValidLexicalScope. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
