Ban the null literal via ESLint and replace existing usages with undefined or truthiness checks (#4401)

This commit is contained in:
Keavon Chambers
2026-09-14 12:58:21 +02:00
committed by Dennis Kobert
parent 360321e0ce
commit 6480de274e
4 changed files with 17 additions and 11 deletions
+8 -1
View File
@@ -73,6 +73,13 @@ export default defineConfig([
],
},
],
"no-restricted-syntax": [
"error",
{
selector: "Literal[raw='null']",
message: "Use `undefined` instead of `null`.",
},
],
// TypeScript plugin config (for TS-specific linting)
"@typescript-eslint/indent": "off",
@@ -96,7 +103,7 @@ export default defineConfig([
"@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "never" }],
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
"@typescript-eslint/no-restricted-types": ["error", { types: { null: "Use `undefined` instead." } }],
"@typescript-eslint/no-restricted-types": ["error", { types: { null: "Use `undefined` instead of `null`." } }],
// Prettier plugin config (for validating and fixing formatting)
"prettier/prettier": "error",