requireMatchingFunctionName

Requires function names to match member and property names.

It doesn't affect anonymous functions nor functions assigned to members or properties named with a reserved word. Assigning to module.exports is also ignored, unless includeModuleExports: true is configured.

Types: Boolean or Object

Values: true or Object with includeModuleExports: true

Example

"requireMatchingFunctionName": true
Valid
var test = {};
test.foo = function foo() {};
var test = {};
test['foo'] = function foo() {};
var test = {foo: function foo() {}};
module.exports = function foo() {};
module['exports'] = function foo() {};
Invalid
var test = {};
test.foo = function bar() {};
var test = {};
test['foo'] = function bar() {};
var test = {foo: function bar() {}};
var test = {module: {}};
test.module.exports = function foo() {};

Example

"requireMatchingFunctionName": { "includeModuleExports": true }
Invalid
module.exports = function foo() {};
module['exports'] = function foo() {};
Rule source
Test source