How to use the eslint-plugin-sonarjs/lib/utils/nodes.isObjectExpression function in eslint-plugin-sonarjs

To help you get started, we’ve selected a few eslint-plugin-sonarjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SonarSource / SonarJS / eslint-bridge / src / rules / no-dead-store.ts View on Github external
function isBasicValue(node: estree.Node): boolean {
      if (isLiteral(node)) {
        return node.value === "" || [0, 1, null, true, false].includes(node.value as any);
      }
      if (isIdentifier(node)) {
        return node.name === "undefined";
      }
      if (isUnaryExpression(node)) {
        return isBasicValue(node.argument);
      }
      if (isObjectExpression(node)) {
        return node.properties.length === 0;
      }
      if (isArrayExpression(node)) {
        return node.elements.length === 0;
      }
      return false;
    }