Ensure compatibility flags follow consistent naming conventions, use explicit typing, and maintain proper usage patterns throughout the codebase. Compatibility flags should use descriptive, version-specific names that accurately reflect their purpose and lifecycle.
Naming Convention:
remove_nodejs_compat_eol_v22
for even releases)jsWeakRef
instead of “a specific flag”)Type Safety:
Record<string, boolean>
Cloudflare.compatibilityFlags
consistently instead of alternative approachesDocumentation:
Example:
// Good: Explicit flag usage with clear naming
if (!Cloudflare.compatibilityFlags.remove_nodejs_compat_eol_v22) {
// Implementation for Node.js compatibility
}
// Good: Document flag interactions
// Note: The disallow_importable_env flag should NOT be set
// when using this feature as it prevents env access
This ensures configuration management remains maintainable, predictable, and well-documented as the system evolves.
Enter the URL of a public GitHub repository