eslint-plugin-mocha
Advanced tools
| module.exports = function (context) { | ||
| 'use strict'; | ||
| var mochaTestFunctions = [ | ||
| 'it', | ||
| 'describe', | ||
| 'suite', | ||
| 'test' | ||
| ]; | ||
| function isCallToMochasOnlyFunction(callee) { | ||
| return callee.type === 'MemberExpression' && | ||
| isObjectNamedItOrDescribe(callee.object) && | ||
| isPropertyNamedOnly(callee.property); | ||
| matchesMochaTestFunction(callee.object) && | ||
| isPropertyNamedOnly(callee.property); | ||
| } | ||
| function isObjectNamedItOrDescribe(object) { | ||
| return object && (object.name === 'it' || object.name === 'describe'); | ||
| function matchesMochaTestFunction(object) { | ||
| return object && mochaTestFunctions.indexOf(object.name) !== -1; | ||
| } | ||
@@ -13,0 +20,0 @@ |
+5
-5
| { | ||
| "name": "eslint-plugin-mocha", | ||
| "version": "0.1.1", | ||
| "version": "0.2.0", | ||
| "description": "Eslint rules for mocha.", | ||
@@ -14,10 +14,10 @@ "main": "index.js", | ||
| "devDependencies": { | ||
| "istanbul": "0.3.0", | ||
| "istanbul": "0.3.2", | ||
| "mocha": "1.21.4", | ||
| "eslint-tester": "0.2.0", | ||
| "eslint": "~0.8.0", | ||
| "eslint-tester": "0.2.1", | ||
| "eslint": "^0.8.0", | ||
| "coveralls": "2.11.1" | ||
| }, | ||
| "peerDependencies": { | ||
| "eslint": "~0.8.0" | ||
| "eslint": "^0.8.0" | ||
| }, | ||
@@ -24,0 +24,0 @@ "repository": { |
4479
2.03%34
21.43%