Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: add eslint rule for zustand getState (#10648)

Ashwin Bhatkal2ca9085b5276
diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs
index 7eb7ba320b..2c8d0fab18 100644
--- a/frontend/.eslintrc.cjs
+++ b/frontend/.eslintrc.cjs
@@ -193,6 +193,16 @@ module.exports = {
],
},
],
+ 'no-restricted-syntax': [
+ 'error',
+ {
+ selector:
+ // TODO: Make this generic on removal of redux
+ "CallExpression[callee.property.name='getState'][callee.object.name=/^use/]",
+ message:
+ 'Avoid calling .getState() directly. Export a standalone action from the store instead.',
+ },
+ ],
},
overrides: [
{
@@ -217,5 +227,13 @@ module.exports = {
'@typescript-eslint/no-unused-vars': 'warn',
},
},
+ {
+ // Store definition files are the only place .getState() is permitted —
+ // they are the canonical source for standalone action exports.
+ files: ['**/*Store.{ts,tsx}'],
+ rules: {
+ 'no-restricted-syntax': 'off',
+ },
+ },
],
};