diff --git a/esphome/components/web_server_idf/web_server_idf.cpp b/esphome/components/web_server_idf/web_server_idf.cpp index 774378523c..d2447681f5 100644 --- a/esphome/components/web_server_idf/web_server_idf.cpp +++ b/esphome/components/web_server_idf/web_server_idf.cpp @@ -39,7 +39,10 @@ static const char *const TAG = "web_server_idf"; // Global instance to avoid guard variable (saves 8 bytes) // This is initialized at program startup before any threads -static DefaultHeaders default_headers_instance; +namespace { +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) +DefaultHeaders default_headers_instance; +} // namespace DefaultHeaders &DefaultHeaders::Instance() { return default_headers_instance; }