eslint-plugin-mocha
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -0,1 +1,8 @@ | ||
## 6.1.0 (August 22, 2019) | ||
### Enhancements | ||
* Add custom message for valid-suite-description ([#207](https://github.com/lo1tuma/eslint-plugin-mocha/pull/207)) | ||
* Add custom message for valid-test-description rule ([#206](https://github.com/lo1tuma/eslint-plugin-mocha/pull/206)) | ||
## 6.0.0 (July 17, 2019) | ||
@@ -2,0 +9,0 @@ |
@@ -11,6 +11,25 @@ 'use strict'; | ||
module.exports = function (context) { | ||
function inlineOptions(context) { | ||
const pattern = new RegExp(context.options[0]); | ||
const suiteNames = context.options[1] ? context.options[1] : defaultSuiteNames; | ||
const message = context.options[2]; | ||
return { pattern, suiteNames, message }; | ||
} | ||
function objectOptions(options) { | ||
const pattern = new RegExp(options.pattern); | ||
const suiteNames = options.suiteNames ? options.suiteNames : defaultSuiteNames; | ||
const message = options.message; | ||
return { pattern, suiteNames, message }; | ||
} | ||
module.exports = function (context) { | ||
const options = context.options[0]; | ||
const { pattern, suiteNames, message } = typeof options === 'object' && !(options instanceof RegExp) ? | ||
objectOptions(options) : | ||
inlineOptions(context); | ||
function isSuite(node) { | ||
@@ -44,3 +63,3 @@ return node.callee && node.callee.name && suiteNames.indexOf(node.callee.name) > -1; | ||
if (!hasValidOrNoSuiteDescription(node)) { | ||
context.report(node, `Invalid "${ callee.name }()" description found.`); | ||
context.report(node, message || `Invalid "${ callee.name }()" description found.`); | ||
} | ||
@@ -47,0 +66,0 @@ } |
@@ -12,6 +12,25 @@ 'use strict'; | ||
module.exports = function (context) { | ||
function inlineOptions(context) { | ||
const pattern = context.options[0] ? new RegExp(context.options[0]) : /^should/; | ||
const testNames = context.options[1] ? context.options[1] : defaultTestNames; | ||
const message = context.options[2]; | ||
return { pattern, testNames, message }; | ||
} | ||
function objectOptions(options) { | ||
const pattern = options.pattern ? new RegExp(options.pattern) : /^should/; | ||
const testNames = options.testNames ? options.testNames : defaultTestNames; | ||
const message = options.message; | ||
return { pattern, testNames, message }; | ||
} | ||
module.exports = function (context) { | ||
const options = context.options[0]; | ||
const { pattern, testNames, message } = typeof options === 'object' && !(options instanceof RegExp) ? | ||
objectOptions(options) : | ||
inlineOptions(context); | ||
function isTest(node) { | ||
@@ -45,3 +64,3 @@ return node.callee && node.callee.name && testNames.indexOf(node.callee.name) > -1; | ||
if (!hasValidOrNoTestDescription(node)) { | ||
context.report(node, `Invalid "${ callee.name }()" description found.`); | ||
context.report(node, message || `Invalid "${ callee.name }()" description found.`); | ||
} | ||
@@ -48,0 +67,0 @@ } |
{ | ||
"name": "eslint-plugin-mocha", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Eslint rules for mocha.", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
67220
1431