Always validate configuration values and provide clear, actionable error messages when validation fails. Handle invalid values gracefully by either ignoring them or providing sensible defaults, and validate that configuration options are used in the correct context.
Always validate configuration values and provide clear, actionable error messages when validation fails. Handle invalid values gracefully by either ignoring them or providing sensible defaults, and validate that configuration options are used in the correct context.
Key practices:
if (tabWidth === 0) { /* ignore invalid value */ }
"--cache-strategy cannot be used without --cache"
if (ignoreFilePaths.length === 0 && !withNodeModules) { ignoreFilePaths = [undefined]; }
This prevents runtime crashes, improves user experience, and makes configuration errors easier to debug and fix.
Enter the URL of a public GitHub repository