Socket
Socket
Sign inDemoInstall

eslint-plugin-mocha

Package Overview
Dependencies
90
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.0.1 to 10.0.2

28

lib/rules/no-empty-description.js

@@ -17,2 +17,18 @@ 'use strict';

function isTemplateString(node) {
return [ 'TaggedTemplateExpression', 'TemplateLiteral' ].includes(node && node.type);
}
function isIdentifier(node) {
return node && node.type === 'Identifier';
}
function isStaticallyAnalyzableDescription(node, extractedText) {
if (extractedText === null) {
return !(isTemplateString(node) || isIdentifier(node));
}
return true;
}
module.exports = {

@@ -55,11 +71,7 @@ meta: {

function isTemplateString(node) {
return [ 'TaggedTemplateExpression', 'TemplateLiteral' ].includes(node && node.type);
}
function checkDescription(mochaCallExpression) {
function isNonEmptyDescription(mochaCallExpression) {
const description = mochaCallExpression.arguments[0];
const text = getStringIfConstant(description);
const text = getStringIfConstant(description, context.getScope());
if (isTemplateString(description) && text === null) {
if (!isStaticallyAnalyzableDescription(description, text)) {
return true;

@@ -74,3 +86,3 @@ }

if (isTest(node)) {
if (!checkDescription(node)) {
if (!isNonEmptyDescription(node)) {
context.report({

@@ -77,0 +89,0 @@ node,

{
"name": "eslint-plugin-mocha",
"version": "10.0.1",
"version": "10.0.2",
"description": "Eslint rules for mocha.",

@@ -5,0 +5,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc