Skip to content

Commit 9f488b4

Browse files
Rel1cxCopilot
andauthored
Enable 'strictNullChecks' in tsconfig samples, closes #1299 (#1301)
Signed-off-by: REL1CX <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 70645ae commit 9f488b4

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

apps/website/content/docs/configuration/configure-project-config.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ The following rules require type information:
2828
- [`react-x/no-unused-props`](/docs/rules/no-unused-props)
2929
- [`react-x/prefer-read-only-props`](/docs/rules/prefer-read-only-props)
3030

31+
<Callout type="warning">
32+
Some rules, such as `react-x/no-leaked-conditional-rendering`, work better when certain TypeScript compiler options are enabled. We recommend enabling `strictNullChecks` in your `tsconfig.json` or `jsconfig.json`:
33+
34+
```json
35+
{
36+
"compilerOptions": {
37+
"strictNullChecks": true,
38+
// ...
39+
}
40+
}
41+
```
42+
</Callout>
43+
3144
**The `project` or `projectService` options in `parserOptions` must be set correctly for the rules to work**.
3245

3346
Enabling these rules **will have performance impact**, but they are more powerful than traditional lint rules.

apps/website/content/docs/getting-started/javascript.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
8484
{
8585
"compilerOptions": {
8686
// ...other options
87-
"jsx": "react-jsx"
87+
"jsx": "react-jsx",
88+
"strictNullChecks": true // Recommended for better type inference
8889
},
8990
"include": ["**/*.js", "**/*.jsx"]
9091
}

apps/website/content/docs/getting-started/typescript.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
8686
{
8787
"compilerOptions": {
8888
// ...other options
89-
"jsx": "react-jsx"
89+
"jsx": "react-jsx",
90+
"strictNullChecks": true // Recommended for better type inference
9091
},
9192
"include": ["**/*.ts", "**/*.tsx"]
9293
}

0 commit comments

Comments
 (0)