Skip to content

Commit

Permalink
Move closure-independent fuctions to module scope
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed Dec 13, 2021
1 parent e550a7e commit e5a29d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/rules/no-empty-description.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { getStringIfConstant, getStaticValue } = require('eslint-utils');
const { getStringIfConstant } = require('eslint-utils');

const DEFAULT_TEST_NAMES = [ 'describe', 'context', 'suite', 'it', 'test', 'specify' ];
const ERROR_MESSAGE = 'Unexpected empty test description.';
Expand All @@ -14,6 +14,14 @@ function objectOptions(options = {}) {
return { testNames, message };
}

function isTemplateString(node) {
return [ 'TaggedTemplateExpression', 'TemplateLiteral' ].includes(node && node.type);
}

function isIdentifier(node) {
return node && node.type === 'Identifier';
}

module.exports = {
meta: {
type: 'suggestion',
Expand Down Expand Up @@ -51,14 +59,6 @@ module.exports = {
return node.callee && node.callee.name && testNames.includes(node.callee.name);
}

function isTemplateString(node) {
return [ 'TaggedTemplateExpression', 'TemplateLiteral' ].includes(node && node.type);
}

function isIdentifier(node) {
return node && node.type === 'Identifier';
}

function checkDescription(mochaCallExpression) {
const description = mochaCallExpression.arguments[0];
const text = getStringIfConstant(description, context.getScope());
Expand Down

0 comments on commit e5a29d4

Please sign in to comment.