Always define configuration properties with sensible defaults and consistent naming conventions. When adding new configurable features, establish clear defaults that follow platform conventions and document their purpose.
Guidelines:
Example:
const defaults = {
// HTTP request defaults
headers: {
common: {
'Accept': 'application/json, text/plain, */*'
}
},
// Fetch-related configurations
fetcher: null,
fetchOptions: {
cache: 'default',
redirect: 'follow'
},
// Character encoding settings
charset: 'utf-8',
// Feature flags
experimental_http2: false
};
For experimental features, use clearly named boolean flags (like experimental_http2
). For encoding or format settings, follow platform conventions and provide fallbacks where appropriate (e.g., config.charset || 'utf-8'
). This approach ensures configurations are discoverable, maintainable, and properly understood by all developers.
Enter the URL of a public GitHub repository