eslint-plugin-mocha
Advanced tools
Comparing version 0.5.1 to 1.0.0
@@ -0,1 +1,24 @@ | ||
## 1.0.0 (September 17, 2015) | ||
### Enhancements | ||
* Implement autofix for no-exclusive-tests (#34) | ||
* Improve detection if done callback is handled (#23) | ||
* Add integration tests (#30) | ||
* Instrumment all sources for coverage (#29) | ||
### Build-Related | ||
* Add node 4 to travis-ci build (#42) | ||
### Dependency Upgrades | ||
* Update devDependencies (#43) | ||
* Update eslint (#31) | ||
### Documentation | ||
* Add NPM Downloads badge (#41) | ||
* Badges in README.md should only show master status (#40) | ||
## 0.5.1 (August 20, 2015) | ||
@@ -2,0 +25,0 @@ |
@@ -46,2 +46,12 @@ 'use strict'; | ||
function isReferenceHandled(reference) { | ||
var parent = context.getNodeByRangeIndex(reference.identifier.range[0]).parent; | ||
return parent.type === 'CallExpression'; | ||
} | ||
function hasHandledReferences(references) { | ||
return references.some(isReferenceHandled); | ||
} | ||
function checkAsyncMochaFunction(functionExpression) { | ||
@@ -53,3 +63,3 @@ var scope = context.getScope(), | ||
if (callbackVariable && callbackVariable.references.length === 0) { | ||
if (callbackVariable && !hasHandledReferences(callbackVariable.references)) { | ||
context.report(callback, 'Expected "{{name}}" callback to be handled.', { name: callbackName }); | ||
@@ -56,0 +66,0 @@ } |
@@ -26,2 +26,12 @@ 'use strict'; | ||
function createAutofixFunction(callee) { | ||
var endRangeOfMemberExpression = callee.range[1], | ||
endRangeOfMemberExpressionObject = callee.object.range[1], | ||
rangeToRemove = [ endRangeOfMemberExpressionObject, endRangeOfMemberExpression ]; | ||
return function removeOnlyProperty(fixer) { | ||
return fixer.removeRange(rangeToRemove); | ||
}; | ||
} | ||
return { | ||
@@ -32,3 +42,7 @@ CallExpression: function (node) { | ||
if (callee && isCallToMochasOnlyFunction(callee)) { | ||
context.report(callee.property, 'Unexpected exclusive mocha test.'); | ||
context.report({ | ||
node: callee.property, | ||
message: 'Unexpected exclusive mocha test.', | ||
fix: createAutofixFunction(callee) | ||
}); | ||
} | ||
@@ -35,0 +49,0 @@ } |
@@ -47,4 +47,5 @@ 'use strict'; | ||
function checkPromiseReturn(functionExpression) { | ||
var bodyStatement = functionExpression.body; | ||
var returnStatement = null; | ||
var bodyStatement = functionExpression.body, | ||
returnStatement = null; | ||
if (bodyStatement.type === 'BlockStatement') { | ||
@@ -51,0 +52,0 @@ returnStatement = findPromiseReturnStatement(functionExpression.body.body); |
{ | ||
"name": "eslint-plugin-mocha", | ||
"version": "0.5.1", | ||
"version": "1.0.0", | ||
"description": "Eslint rules for mocha.", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"test": "npm run test:unit --coverage && npm run check-coverage", | ||
"test:unit": "istanbul test --dir build/coverage _mocha test -- --recursive --reporter dot", | ||
"test:unit": "istanbul test _mocha test -- --recursive --reporter dot", | ||
"check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100 --lines 100", | ||
@@ -19,10 +19,11 @@ "coveralls": "cat ./build/coverage/lcov.info | coveralls", | ||
"devDependencies": { | ||
"chai": "3.2.0", | ||
"pr-log": "1.3.0", | ||
"istanbul": "0.3.17", | ||
"mocha": "2.2.5", | ||
"eslint": "1.1.0", | ||
"coveralls": "2.11.2" | ||
"istanbul": "0.3.20", | ||
"mocha": "2.3.2", | ||
"eslint": "1.4.1", | ||
"coveralls": "2.11.4" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=0.8.0" | ||
"eslint": "^1.4.1" | ||
}, | ||
@@ -29,0 +30,0 @@ "repository": { |
[![NPM Version](https://img.shields.io/npm/v/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha) | ||
[![Build Status](https://img.shields.io/travis/lo1tuma/eslint-plugin-mocha.svg?style=flat)](https://travis-ci.org/lo1tuma/eslint-plugin-mocha) | ||
[![Coverage Status](https://img.shields.io/coveralls/lo1tuma/eslint-plugin-mocha.svg?style=flat)](https://coveralls.io/r/lo1tuma/eslint-plugin-mocha) | ||
[![Build Status](https://img.shields.io/travis/lo1tuma/eslint-plugin-mocha/master.svg?style=flat)](https://travis-ci.org/lo1tuma/eslint-plugin-mocha) | ||
[![Coverage Status](https://img.shields.io/coveralls/lo1tuma/eslint-plugin-mocha/master.svg?style=flat)](https://coveralls.io/r/lo1tuma/eslint-plugin-mocha) | ||
[![Peer Dependencies](http://img.shields.io/david/peer/lo1tuma/eslint-plugin-mocha.svg?style=flat)](https://david-dm.org/lo1tuma/eslint-plugin-mocha#info=peerDependencies&view=table) | ||
[![NPM Downloads](https://img.shields.io/npm/dm/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha) | ||
@@ -12,3 +13,3 @@ # eslint-plugin-mocha | ||
This plugin requires ESLint `0.8.0` or later. | ||
This plugin requires ESLint `1.4.1` or later. | ||
@@ -15,0 +16,0 @@ `npm install --save-dev eslint-plugin-mocha` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17041
12
168
0
38
6