Prompt
Always use named constants, enums, or well-defined configuration objects instead of magic strings, numbers, or inline literals for configuration values. This improves maintainability, reduces typos, enables better IDE support, and makes configuration changes easier to track.
Examples of good practices:
- Use enums for status values:
status === EngineStatus.readyinstead ofstatus === 'ready' - Define constants for localStorage keys:
const EXPERIMENTAL_FEATURE = 'experimentalFeature'instead of inline strings - Use declarative configuration arrays with proper defaults:
localStorage.getItem(HTTPS_PROXY_FEATURE) ?? "" - Avoid optional parameters for configuration that always has a value:
serverEnabled: booleaninstead ofserverEnabled?: boolean
This approach makes configuration management more robust and prevents runtime errors from typos in configuration keys or values.