src/content/docs/linter/rules/use-qwik-valid-lexical-scope.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v2.2.6` - Diagnostic Category: [`lint/correctness/useQwikValidLexicalScope`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - This rule belongs to the following domains: - [`qwik`](/linter/domains#qwik) - Sources: - Same as [`qwik/valid-lexical-scope`](https://qwik.dev/docs/advanced/eslint/#valid-lexical-scope){
"linter": {
"rules": {
"correctness": {
"useQwikValidLexicalScope": "error"
}
}
}
}
Disallow unserializable expressions in Qwik dollar ($) scopes.
Ensures all captured values in Qwik components can be properly serialized for resumability. See Qwik Optimizer: Lexical Scope for proper usage patterns.
// Arrow function assigned without wrapping it in $(...)
const handleClick = () => {
console.log("clicked");
};
const handleClick = $(() => {
// Valid: only using serializable variables or props
console.log("clicked");
});