Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-mocha

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-mocha - npm Package Compare versions

Comparing version 4.3.0 to 4.4.0

.editorconfig

20

CHANGELOG.md

@@ -0,1 +1,21 @@

## 4.4.0 (August 24, 2016)
### Features
* Add `no-hooks-for-single-case` rule (fixes #44) (#95)
* Add rule `no-return-and-callback` (fixes #88) (#94)
* Add `no-top-level-hooks` rule (fixes #37) (#87)
### Documentation
* Fix title in `no-sibling-hooks` documentation file (#92)
### Dependency Upgrades
* Update ramda to version 0.22.1 🚀 (#93)
### Build-Related
* Add editorconfig file (#91)
## 4.3.0 (August 1, 2016)

@@ -2,0 +22,0 @@

5

index.js

@@ -11,2 +11,3 @@ 'use strict';

'no-global-tests': require('./lib/rules/no-global-tests'),
'no-return-and-callback': require('./lib/rules/no-return-and-callback'),
'valid-test-description': require('./lib/rules/valid-test-description'),

@@ -16,3 +17,5 @@ 'valid-suite-description': require('./lib/rules/valid-suite-description'),

'no-hooks': require('./lib/rules/no-hooks'),
'no-sibling-hooks': require('./lib/rules/no-sibling-hooks')
'no-hooks-for-single-case': require('./lib/rules/no-hooks-for-single-case'),
'no-sibling-hooks': require('./lib/rules/no-sibling-hooks'),
'no-top-level-hooks': require('./lib/rules/no-top-level-hooks')
},

@@ -19,0 +22,0 @@ configs: {

6

lib/rules/no-hooks.js
'use strict';
var astUtil = require('../util/ast');
module.exports = function (context) {
var hooks = [ 'before', 'after', 'beforeEach', 'afterEach' ];
return {
CallExpression: function (node) {
if (node.callee.type === 'Identifier' && hooks.indexOf(node.callee.name) !== -1) {
if (astUtil.isHookIdentifier(node.callee)) {
context.report({

@@ -10,0 +10,0 @@ node: node.callee,

'use strict';
var describeAliases = [ 'describe', 'xdescribe', 'context', 'xcontext' ];
var astUtil = require('../util/ast');

@@ -15,18 +15,4 @@ function newDescribeLayer(describeNode) {

function isDescribeIdentifier(node) {
return node.type === 'Identifier' && describeAliases.indexOf(node.name) !== -1;
}
function isDescribe(node) {
return node
&& node.type === 'CallExpression'
&& (isDescribeIdentifier(node.callee)
// eslint-disable-next-line no-extra-parens
|| (node.callee.type === 'MemberExpression' && isDescribeIdentifier(node.callee.object))
);
}
module.exports = function (context) {
var hooks = [ 'before', 'after', 'beforeEach', 'afterEach' ],
isUsed = [];
var isUsed = [];

@@ -38,5 +24,5 @@ return {

CallExpression: function (node) { // eslint-disable-line complexity
CallExpression: function (node) {
var name = node.callee && node.callee.name;
if (isDescribe(node)) {
if (astUtil.isDescribe(node)) {
isUsed.push(newDescribeLayer(node));

@@ -46,3 +32,3 @@ return;

if (node.callee.type !== 'Identifier' || hooks.indexOf(name) === -1) {
if (!astUtil.isHookIdentifier(node.callee)) {
return;

@@ -49,0 +35,0 @@ }

{
"name": "eslint-plugin-mocha",
"version": "4.3.0",
"version": "4.4.0",
"description": "Eslint rules for mocha.",

@@ -15,3 +15,3 @@ "main": "index.js",

"dependencies": {
"ramda": "^0.21.0"
"ramda": "^0.22.1"
},

@@ -18,0 +18,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc